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

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

Re: re-loading .emacs file


From: David Vanderschel
Subject: Re: re-loading .emacs file
Date: Thu, 16 Oct 2003 21:46:24 -0500

"Lowell" <lkirsh@cs.ubc.ca> wrote in message
news:bfqtkc$a82$1@mughi.cs.ubc.ca...
> It's a bit of a pain to have to restart emacs all the time (I'm learning
> elisp and working on my .emacs file constantly), but only a _bit_ of a
> pain.

For really rapid turnaround, you can just do
eval-buffer after you have changed it.  There is a
caveat here:  You must organize your initialization
code so that it works correctly when executed more
than once.  For example, do not add things to lists
when they are already there.  add-hook is a function
which behaves correctly.  For my own purposes, I also
created

(defun dv-add-to-list (thing list-name) "Add only if not already there."
  (let ((list (eval list-name)))
    (if (not (member thing list))
 (set list-name (cons thing list)))))

Eg, (dv-add-to-list (cons "\\.nr$"   'nroff-mode) 'auto-mode-alist)

Regards,
  David V.




reply via email to

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