[macemacsjp-english 733] Re: Configuring Auctex and flyspell

Back to archive index

David Reitter david****@gmail*****
Sun Nov 5 20:37:55 JST 2006


On 5 Nov 2006, at 11:11, Peter Dyballa wrote:

>
> Am 04.11.2006 um 22:16 schrieb Brian J. Lopes:
>
>> Hello Everyone,
>> (add-hook 'LaTeX-mode-hook
>>    (function (lambda ()
>>                 (require 'reftex)
>
> This statement does not belong into a hook. Require makes Emacs
> remember to load something in case it's needed. Since Emacs does not
> forget as easily as humans do it's OK to write this statement once
> and outside of a hook.

Require will load a feature-providing file if that feature hasn't  
already been provided. Emacs does not just "remember to load it" at  
that point - it actually loads the file if needed. Because loading  
takes time, you will only want to run "require" on demand. (The other  
mechanism to achieve this is to define an `autoload'.) Different  
considerations apply when developing preloaded core (e.g. for GNU  
Emacs proper).

However, I would define a function, give it a name and put that into  
the hook - adding an anonymous function makes things harder to manage  
(cf `remove-hook').

D

--
David Reitter
Blog: http://www.davids-world.com   Homepage: http://www.david- 
reitter.com




More information about the macemacsjp-english mailing list
Back to archive index