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
Binding a key in a map for a different, not-yet-loaded mode? #1063
Comments
The default value for However, you can set the (use-package citar
:after (:any latex org)
:demand t
:bind
( :map LaTeX-mode-map
:package latex
("C-c [" . citar-insert-citation))) This will cause it to wait for latex.el to load (and define the keymap) before attempting to set the binding in A minor caveat is that the |
Binding a key in a map for a different mode?
I'm trying to use
citar
with both AUCTeX andorg-mode
.Problem: This works fine if, after starting Emacs, I happen to open a
.tex
file before opening a.org
file. However, if I happen to first open a.org
file, I get a(void-variable LaTeX-mode-map)
error in the*Messages*
buffer and, worse than that, when I later open a.tex
file, the binding is not set up. From what I can tell, the problem is thatorg-mode
triggers theuse-package citar
, but the binding fails becauseLaTeX-mode-map
does not exist untilLaTeX-mode
is used.Question: What is the idiomatic way to handle this kind of situation with
use-package
? Should I be splitting the clauses forcitar
into two calls touse-package
? The following does work, but I feel slightly unsettled by using twouse-package citar
. What is the recommended idiom?Also, if I expand this last
use-package citar
, I see that thebind-keys
has:package citar
, and I sort of expected to see:package latex
... Can someone please explain this to me?The text was updated successfully, but these errors were encountered: