all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie<none@example.invalid>
Subject: Re: Please why ORDER of .emacs lines here matters.....
Date: Fri, 1 Aug 2003 20:50:15 +0000	[thread overview]
Message-ID: <7qjegb.5f.ln@acm.acm> (raw)
In-Reply-To: bf23f78f.0307312136.9385194@posting.google.com

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").

  parent reply	other threads:[~2003-08-01 20:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-31 20:14 Please why ORDER of .emacs lines here matters Christian Seberino
2003-07-31 21:53 ` Kevin Rodgers
2003-08-01  5:36   ` Christian Seberino
2003-08-01 16:13     ` Kevin Rodgers
2003-08-01 20:50     ` Alan Mackenzie [this message]
2003-08-05  8:42     ` Thien-Thi Nguyen
2003-08-08  8:42       ` Alan Mackenzie
2003-08-01 20:48 ` Kai Großjohann
2003-08-10 17:43 ` Stefan Monnier

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=7qjegb.5f.ln@acm.acm \
    --to=none@example.invalid \
    /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.