From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Please why ORDER of .emacs lines here matters..... Date: Fri, 1 Aug 2003 20:50:15 +0000 Organization: muc.de e.V. -- private internet access Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <7qjegb.5f.ln@acm.acm> References: <3F298FDA.10906@yahoo.com> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1059779657 27978 80.91.224.249 (1 Aug 2003 23:14:17 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 1 Aug 2003 23:14:17 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 02 01:14:16 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19ij6G-0007H8-00 for ; Sat, 02 Aug 2003 01:14:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19ihYt-0001Vi-UQ for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Aug 2003 17:35:43 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!news.m-online.net!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 48 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1059772927 76341 193.149.49.134 (1 Aug 2003 21:22:07 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 1 Aug 2003 21:22:07 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:115628 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 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 Xref: main.gmane.org gmane.emacs.help:11542 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11542 Christian Seberino wrote on 31 Jul 2003 22:36:22 -0700: > Why is it better/different to invoke my customizations in a "hook" then > just calling my function in place of the mode??? My way worked for c, > java, fortran77 and fortran90. It would have worked in python too > except for this one variable.... I don't think it's a good idea to put (setq-default)s into a mode function either. It's confusing: you're setting the "default" each time you call the mode. Sometimes you ending up evaluating the (setq-default) after the buffer-local value has already been set, causing even more confusion. You're better using normal (setq)s in a hook function, thus overriding the default in each buffer. If you _really_ want to use (setq-default), call it exactly once for each variable by putting in your .emacs. To be safe, you probably want to embed this in an (eval-after-load) something like this: (eval-after-load "python-mode" '(progn (setq-default auto-fill-function 'do-auto-fill) (setq-default py-python-command "python2.2" ) .... )) This way, it won't fail through python-mode not being loaded at initialisation time. > Should I redo all other langs to have "hook functions"?? Like > cs-java-mode-hook, cs-fortran90-mode-hook, etc.??? I would say yes. Not urgently, but over the course of the next few time-units. > If it is better in general for some reason then I'll do it. It'll be less likely to cause obscure errors the next time you amend one of these hooks, because you'll then be doing it the same tried and trusted way as everybody else. > Chris -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").