[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: re-loading an elisp file
From: |
Pascal J. Bourguignon |
Subject: |
Re: re-loading an elisp file |
Date: |
Sat, 05 Mar 2011 16:27:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
ken <gebser@mousecar.com> writes:
> Is there a way, when reloading an elisp file, to have it examine (and
> reload new) values of variables?
There's a reason it's done: if you've painfully customized a module, you
wouldn't want all your settings to be reset to default just because you
reload its sources.
So defvar is defined to set the value of the variable only if the
variable is not already defined.
In Common Lisp, there's also a defparameter macro that always sets the
value of the variable. But of course, you wouldn't do that for
customization variables, or for variables storing important state (eg. a
database).
So you may put:
(defmacro defconstant (symbol initvalue &optional docstring)
`(defconst ,symbol ,initvalue ,docstring))
(defmacro defparameter (symbol &optional initvalue docstring)
`(progn
(defvar ,symbol nil ,docstring)
(setq ,symbol ,initvalue)))
in your ~/.emacs and use defparameter instead of defvar in some cases.
But in general you don't want to.
What you may do, is to provide a reset command to reinitialize the state
of your module.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
- Re: re-loading an elisp file, (continued)
- Re: re-loading an elisp file, ken, 2011/03/05
- RE: re-loading an elisp file, Drew Adams, 2011/03/05
- RE: re-loading an elisp file, Drew Adams, 2011/03/05
- Re: re-loading an elisp file, ken, 2011/03/05
- Re: re-loading an elisp file, PJ Weisberg, 2011/03/05
- Message not available
- Re: re-loading an elisp file, David Combs, 2011/03/24
- RE: re-loading an elisp file, Drew Adams, 2011/03/24
- Message not available
- Re: re-loading an elisp file, David Combs, 2011/03/24
- RE: re-loading an elisp file, Drew Adams, 2011/03/24
Message not available
Re: re-loading an elisp file,
Pascal J. Bourguignon <=
Message not available
Message not availableRe: re-loading an elisp file, rusi, 2011/03/06
Re: re-loading an elisp file, Le Wang, 2011/03/06
Re: re-loading an elisp file, Kevin Rodgers, 2011/03/07
Message not availableRe: re-loading an elisp file, rusi, 2011/03/07