[Top][All Lists]

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

Re: Different options for different modes?

From: Stefan Monnier
Subject: Re: Different options for different modes?
Date: Tue, 03 Apr 2012 20:59:26 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

>> (add-hook 'MAJOR-MODE-hook
>>           (lambda ()
>>             (set (make-local-variable 'VAR) VAL)))

> I wonder when this is used and when this:
> (eval-after-load 'MAJOR_MODE (setq VAR VAL))

Your code will be run once when loading the `MAJOR_MODE' package
(i.e. usually the first time `MAJOR_MODE' is used), whereas the code
I quoted is run every time `MAJOR-MODE' is enabled.

If you use Emacs for a single file at a time, the difference between the
two may be unnoticeable.  But if you do use several files in the same
Emacs session (which is the normal way to use Emacs), then the
difference is important.


reply via email to

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