help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode characters for transcribing to pdf


From: Alessandro Bertulli
Subject: Re: Unicode characters for transcribing to pdf
Date: Mon, 05 Sep 2022 00:16:31 +0200
User-agent: mu4e 1.8.9; emacs 29.0.50

Stefan Monnier via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> writes:

> `LaTeX-mode-map`, like most package variables, is only defined once
> its package is actually loaded, which is done lazily in response to the
> use of the package (e.g. opening a LaTeX file).
>
> So it's normal that `LaTeX-mode-map` is not defined when your init file
> is loaded.  This is on purpose to try and speed up Emacs's startup.
>
> You can use things like:
>
>     (with-eval-after-load 'latex
>       (define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
>       (define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))

You honestly opened a world to me. I have long wondered the difference
between require and with-eval-after-load (of course I could have read
the docs, but I never found time). :-)

> or
>
>     (defun my-latex-setup ()
>       (define-key LaTeX-mode-map (kbd "C-c a") #'my-bar)
>       (define-key LaTeX-mode-map (kbd "C-c b") #'my-foo))
>     (add-hook 'LaTeX-mode-hook #'my-latex-setup)
>
> in order to delay the customization to after the variable is defined.

Isn't this redundant? You call the function every time a LaTeX file is
loaded. The first method is preferrable, right?

Alessandro



reply via email to

[Prev in Thread] Current Thread [Next in Thread]