From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Different options for different modes? Date: Tue, 03 Apr 2012 20:59:26 -0400 Message-ID: References: <8c415ae4-eedc-41e2-9993-0c2fbd8b3573@t3g2000vbe.googlegroups.com> <863e1697-9d6d-4b4d-a9b2-4b05f9e2f498@pg6g2000pbb.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1333501214 22586 80.91.229.3 (4 Apr 2012 01:00:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 4 Apr 2012 01:00:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 04 03:00:13 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SFEa5-0000SJ-9L for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Apr 2012 03:00:13 +0200 Original-Received: from localhost ([::1]:58595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFEa4-0000gO-Ie for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Apr 2012 21:00:12 -0400 Original-Path: usenet.stanford.edu!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe16.iad.POSTED!00000000!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) Cancel-Lock: sha1:3Y2ABpD9ByCkxuj6i6i1rCLIrPk= Original-Lines: 18 Original-X-Complaints-To: abuse@UsenetServer.com Original-NNTP-Posting-Date: Wed, 04 Apr 2012 00:59:27 UTC X-Received-Bytes: 1462 Original-Xref: usenet.stanford.edu gnu.emacs.help:191891 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84305 Archived-At: >> (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