help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Please why ORDER of .emacs lines here matters.....


From: Alan Mackenzie
Subject: Re: Please why ORDER of .emacs lines here matters.....
Date: Fri, 1 Aug 2003 20:50:15 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Christian Seberino <seberino@spawar.navy.mil> 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").



reply via email to

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