Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubleshooting issues with custom layer key bindings #7229

Closed
dathinaios opened this issue Sep 30, 2016 · 1 comment
Closed

Troubleshooting issues with custom layer key bindings #7229

dathinaios opened this issue Sep 30, 2016 · 1 comment

Comments

@dathinaios
Copy link
Contributor

dathinaios commented Sep 30, 2016

I am trying to incorporate a package for the SuperCollider programming language as a layer into spacemacs. It is all working well but I dont seem to be able to define custom key bindings under , or SPC m.

Click here to see the code of the underlying sclang package (at local/sclang). It defines quite a few bindings starting with C-c in sclang-mode.el. These are working fine.

In the commented out code bellow you can see all the things I tried.

(setq supercollider-packages '((sclang :location local)))

(defun supercollider/init-sclang ()
  (use-package sclang
    :config
    (setenv "PATH" (concat (getenv "PATH") ":/Applications/SuperCollider.app/Contents/Resources"))
    (setq exec-path (append exec-path '("/Applications/SuperCollider.app/Contents/Resources" )))
    ;; (define-key key-translation-map (kbd ",s") (kbd "\C-c\C-c"))
    ;; (define-key sclang-mode-map (kbd ",s")   'sclang-eval-line) 
    ;; (evil-leader/set-key-for-mode 'sclang-mode "s" 'sclang-eval-line)
    ;; (spacemacs/set-leader-keys-for-major-mode 'sclang-mode "l" 'sclang-eval-line)
    ))
@dathinaios
Copy link
Contributor Author

I finally solved this with help from the Spacemacs Gitter channel.

There was a deeper issue with the definition of the major mode itself. More specifically (quoting NJBS's answer on Gitter):

Your issue is that sclang-mode doesn't define itself properly by
deriving from fundamental-mode, but rather it defines itself using
defun. You can change sclang-mode.el's mode definition to the
following and your bindings should stick:

(define-derived-mode sclang-mode fundamental-mode "sclang-mode"
  "Major mode for editing SuperCollider language code.
\\{sclang-mode-map}
"
  (sclang-mode-set-local-variables)
  (sclang-set-font-lock-keywords)
  (sclang-init-document)
  (sclang-make-document))

Link to the commit where I fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant