[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting more info on a variable in Customize buffers
From: |
drkm |
Subject: |
Re: Getting more info on a variable in Customize buffers |
Date: |
Mon, 03 Jan 2005 18:28:42 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (windows-nt) |
Stefan <address@hidden> writes:
> The problem is that custom's "variables" aren't the same as
> Elisp variables. They look very much alike, and they usually are exactly
> the same, but that's not always the case.
> The :get, :set, and :init thingies allow you to define a custom setting
> "foo-bar" which controls "toto" rather than the variable "foo-bar".
So a big difference between variables and customs is:
- with a variable, you can `setq' it before evaluate its
definition, to overload its default value. It's very convenient
in .emacs. For example, you don't have to load any library to
change the variable value;
- with a custom, you have to wait its definition to be evaluated
before setting it in any way, to have its :get and al. to be
known. So you have to deal with `require' or `eval-after-load'
in .emacs, or correctly load autoloads file if provided (and if
it contains the desired defcustom form).
Right ?
If it is, I don't know any standard way to do that directly in
ELisp, if I don't want to use Customize. I think about something
like :
(defmacro set-custom (custom value lib)
(if (boundp custom)
`(set-variable ',custom ,value)
`(eval-after-load ,lib
'(set-variable ',custom ,value))))
But for using it, I have to know CUSTOM to be defined as a custom,
where it is defined, etc. And this doesn't deal with non-evaluating
the "default value form" (in defcustom) if `set-custom' is evaluated
before loading the LIB.
This point can be important if the custom' value is used when
loading the file, for example to compute the default value of another
variable:
(defcustom a-custom 'default
"..."
:set ...)
(defvar a-internal-var (compute a-custom))
How can I do in this case to change the value of `a-custom' (and
have `a-internal-var' correctly set)? Hum, I suppose it's the
responsability of the :set'er of `a-custom'...
So what's the clean way to set custom' value in ELisp, in a user
point of view?
--drkm
- Re: Getting more info on a variable in Customize buffers, (continued)
- Re: Getting more info on a variable in Customize buffers, Luc Teirlinck, 2005/01/03
- Re: Getting more info on a variable in Customize buffers, Richard Stallman, 2005/01/04
- Re: Getting more info on a variable in Customize buffers, Stefan Monnier, 2005/01/04
- Re: Getting more info on a variable in Customize buffers, Luc Teirlinck, 2005/01/05
- Re: Getting more info on a variable in Customize buffers, Stefan Monnier, 2005/01/06
- Re: Getting more info on a variable in Customize buffers, Richard Stallman, 2005/01/06
- Re: Getting more info on a variable in Customize buffers, Richard Stallman, 2005/01/06
- Re: Getting more info on a variable in Customize buffers, Luc Teirlinck, 2005/01/06
- Re: Getting more info on a variable in Customize buffers, Richard Stallman, 2005/01/07
- Re: Getting more info on a variable in Customize buffers, Richard Stallman, 2005/01/03
- Re: Getting more info on a variable in Customize buffers,
drkm <=
- Re: Getting more info on a variable in Customize buffers, Lennart Borgman, 2005/01/03
- Re: Getting more info on a variable in Customize buffers, drkm, 2005/01/03
- Re: Getting more info on a variable in Customize buffers, Per Abrahamsen, 2005/01/04
- Re: Getting more info on a variable in Customize buffers, Per Abrahamsen, 2005/01/04
- Re: Getting more info on a variable in Customize buffers, Lennart Borgman, 2005/01/04
- RE: Getting more info on a variable in Customize buffers, Drew Adams, 2005/01/04
Re: Getting more info on a variable in Customize buffers, Richard Stallman, 2005/01/02