all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Different options for different modes?
Date: Tue, 03 Apr 2012 20:59:26 -0400	[thread overview]
Message-ID: <jwvvclgs4eb.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: 863e1697-9d6d-4b4d-a9b2-4b05f9e2f498@pg6g2000pbb.googlegroups.com

>> (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.


        Stefan


      reply	other threads:[~2012-04-04  0:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23 14:24 Different options for different modes? winkerbean
2012-03-29  9:51 ` Philipp Haselwarter
     [not found] ` <mailman.53.1333014742.20052.help-gnu-emacs@gnu.org>
2012-03-29 13:00   ` rusi
2012-04-04  0:59     ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvvclgs4eb.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.