-
Notifications
You must be signed in to change notification settings - Fork 260
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
:bind for derived keymaps? (java-mode-map for example) #1068
Comments
what do you get if you run it thru macroexpand? as a sidenote, the main developer should add something like "if possible, include the output/result of running macroexpand on the use-package call in question" to the issues how-to hope this helps |
here is what I got, cleaned up slightly(use-package creates a variable for use in error-logging it seems, i deleted the def an replaced it with the generic "use-package--warning")u ;;; without the hack
(progn
(use-package-ensure-elpa 'cc-mode
'(t)
'nil)
(condition-case-unless-debug err
(progn
(unless
(fboundp 'indent-for-tab-command)
(autoload #'indent-for-tab-command "cc-mode" nil t))
(bind-keys :package cc-mode :map java-mode-map
("[tab]" . indent-for-tab-command)))
(error (funcall use-package--warning :catch err))))
;;; only the hack
(progn
(use-package-ensure-elpa 'cc-mode
'(t)
'nil)
(condition-case-unless-debug err
(if (not
(require 'cc-mode nil t))
(display-warning 'use-package
(format "Cannot load %s" 'cc-mode)
:error)
(condition-case-unless-debug err
(progn
(with-eval-after-load 'cc-mode
(bind-key
[tab]
#'indent-for-tab-command java-mode-map))
t)
(error (funcall use-package--warning :config err))))
(error (funcall use-package--warning :catch err)))) however, my setup is most definitely different from yours, so the output you get might be different |
I may just be doing it wrong, but is there no way of using
:bind
for a keymap likejava-mode-map
?as it stands here, this declaration does not throw any errors, but it also doesn't set the keybinding in the
java-mode-map
(M-x java-mode
C-h k TAB
->c-indent-line-or-region
).I've tried various combinations of
use-package emacs
anduse-package cc-mode
with and without the:package cc-mode
part enabled and if you useuse-package emacs
without:package ...
it throws an error on startup:Symbol's value as variable is void: java-mode-map
The part marked with
HACK
does correctly set the keybinding, which seems odd to me because my understanding of the:bind
keyword is that it would get expanded to that anyways. Is this an actual issue, or am I just doing it wrong?The text was updated successfully, but these errors were encountered: