* doc problems with defcustom
@ 2004-06-08 5:30 Werner LEMBERG
2004-06-08 6:52 ` Miles Bader
0 siblings, 1 reply; 16+ messages in thread
From: Werner LEMBERG @ 2004-06-08 5:30 UTC (permalink / raw)
[CVS 2004-05-30]
Neither in emacs.info nor elisp.info it is described how to customize
a variable defined with defcustom in a non-interactive way, this is,
how to configure it the `.emacs' file instead of using the `customize'
feature -- at least there isn't a link from the defcustom description
to such a place if it exists.
For example, I would like to make my users add `CJKinclude' to
reftex-include-file-commands, defined in reftex-vars.el. For me, the
easiest way is to write
(add-to-list 'reftex-include-file-commands "CJKinclude")
in `.emacs' (and this is what I recommend my users).
If such a solution is deprecated or should be avoided, please say so
in the documentation.
Werner
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 5:30 doc problems with defcustom Werner LEMBERG
@ 2004-06-08 6:52 ` Miles Bader
2004-06-08 6:58 ` Werner LEMBERG
0 siblings, 1 reply; 16+ messages in thread
From: Miles Bader @ 2004-06-08 6:52 UTC (permalink / raw)
Cc: emacs-devel
Werner LEMBERG <wl@gnu.org> writes:
> Neither in emacs.info nor elisp.info it is described how to customize
> a variable defined with defcustom in a non-interactive way, this is,
> how to configure it the `.emacs' file instead of using the `customize'
> feature
Perhaps that's because it's the same as it has always been -- just use
setq, or add-to-list, or whatever you like.
Werner LEMBERG <wl@gnu.org> writes:
> For me, the easiest way is to write
>
> (add-to-list 'reftex-include-file-commands "CJKinclude")
>
> in `.emacs' (and this is what I recommend my users).
That should be fine.
Actually for lists, customize's behavior is kind of non-optimal anyway,
because one can't just _add_ to a list with customize, you have to
explicitly set the whole thing, which can interact badly with upgrades
&c.
Personally I use a mixture of explicit .emacs settings and customize,
whatever is most convenient for the task at hand (for complicated data
structures, customize can be nice because it often provides little
mini-editors for the data structure).
-Miles
--
"Though they may have different meanings, the cries of 'Yeeeee-haw!' and
'Allahu akbar!' are, in spirit, not actually all that different."
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 6:52 ` Miles Bader
@ 2004-06-08 6:58 ` Werner LEMBERG
2004-06-08 7:59 ` Kim F. Storm
2004-06-08 23:31 ` Richard Stallman
0 siblings, 2 replies; 16+ messages in thread
From: Werner LEMBERG @ 2004-06-08 6:58 UTC (permalink / raw)
Cc: emacs-devel
> > Neither in emacs.info nor elisp.info it is described how to
> > customize a variable defined with defcustom in a non-interactive
> > way, this is, how to configure it the `.emacs' file instead of
> > using the `customize' feature
>
> Perhaps that's because it's the same as it has always been -- just
> use setq, or add-to-list, or whatever you like.
I think it would be a good idea to mention this somewhere...
Werner
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 6:58 ` Werner LEMBERG
@ 2004-06-08 7:59 ` Kim F. Storm
2004-06-08 8:25 ` Juanma Barranquero
` (2 more replies)
2004-06-08 23:31 ` Richard Stallman
1 sibling, 3 replies; 16+ messages in thread
From: Kim F. Storm @ 2004-06-08 7:59 UTC (permalink / raw)
Cc: miles, emacs-devel, miles
Werner LEMBERG <wl@gnu.org> writes:
> > > Neither in emacs.info nor elisp.info it is described how to
> > > customize a variable defined with defcustom in a non-interactive
> > > way, this is, how to configure it the `.emacs' file instead of
> > > using the `customize' feature
> >
> > Perhaps that's because it's the same as it has always been -- just
> > use setq, or add-to-list, or whatever you like.
>
> I think it would be a good idea to mention this somewhere...
It should mention that it is not always safe to do this.
There are some defcustom variables which have no (or incorrect) effect
if you set them with setq -- such variables typically have a :set
action which must be called for the setting to take effect.
For example pc-selection-mode and global-reveal-mode.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 7:59 ` Kim F. Storm
@ 2004-06-08 8:25 ` Juanma Barranquero
2004-06-08 9:23 ` Miles Bader
` (2 more replies)
2004-06-08 10:20 ` Kenichi Handa
2004-06-08 23:31 ` Richard Stallman
2 siblings, 3 replies; 16+ messages in thread
From: Juanma Barranquero @ 2004-06-08 8:25 UTC (permalink / raw)
> There are some defcustom variables which have no (or incorrect) effect
> if you set them with setq -- such variables typically have a :set
> action which must be called for the setting to take effect.
Which is the right way to set such a variable in .emacs (for those of us
who don't want to use customize)?
(customize-set-variable 'pc-selection-mode t)
perhaps?
Juanma
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 8:25 ` Juanma Barranquero
@ 2004-06-08 9:23 ` Miles Bader
2004-06-08 9:33 ` David Kastrup
2004-06-08 9:35 ` Per Abrahamsen
2004-06-08 11:02 ` Kenichi Handa
2 siblings, 1 reply; 16+ messages in thread
From: Miles Bader @ 2004-06-08 9:23 UTC (permalink / raw)
Cc: emacs-devel
Juanma Barranquero <jmbarranquero@wke.es> writes:
> Which is the right way to set such a variable in .emacs (for those of us
> who don't want to use customize)?
>
> (customize-set-variable 'pc-selection-mode t)
No, just use the associated function, e.g., (pc-selection-mode t)
The issue is really independent of customize; some modes need setup to
be done, and the way you do it these days is by calling the mode function.
-Miles
--
"1971 pickup truck; will trade for guns"
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 9:23 ` Miles Bader
@ 2004-06-08 9:33 ` David Kastrup
0 siblings, 0 replies; 16+ messages in thread
From: David Kastrup @ 2004-06-08 9:33 UTC (permalink / raw)
Cc: Juanma Barranquero, emacs-devel
Miles Bader <miles@lsi.nec.co.jp> writes:
> Juanma Barranquero <jmbarranquero@wke.es> writes:
> > Which is the right way to set such a variable in .emacs (for those of us
> > who don't want to use customize)?
> >
> > (customize-set-variable 'pc-selection-mode t)
>
> No, just use the associated function, e.g., (pc-selection-mode t)
>
> The issue is really independent of customize; some modes need setup
> to be done, and the way you do it these days is by calling the mode
> function.
Which customize-set-variable does just fine. The problem is that if
you use customize-set-variable, customize is of the opinion that it
is able to manage the variable settings itself, and it isn't.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 8:25 ` Juanma Barranquero
2004-06-08 9:23 ` Miles Bader
@ 2004-06-08 9:35 ` Per Abrahamsen
2004-06-08 11:02 ` Kenichi Handa
2 siblings, 0 replies; 16+ messages in thread
From: Per Abrahamsen @ 2004-06-08 9:35 UTC (permalink / raw)
Juanma Barranquero <jmbarranquero@wke.es> writes:
>> There are some defcustom variables which have no (or incorrect) effect
>> if you set them with setq -- such variables typically have a :set
>> action which must be called for the setting to take effect.
>
> Which is the right way to set such a variable in .emacs (for those of us
> who don't want to use customize)?
There are supposed to be a "setter" function for such variables (in
fact, the varable often only exists because Customize can't call
setter functions directy, it always need to go through a variable), and
the doc string of the variable is supposed to mention the name of the
setter function. If it doesn't, report it as a bug.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 7:59 ` Kim F. Storm
2004-06-08 8:25 ` Juanma Barranquero
@ 2004-06-08 10:20 ` Kenichi Handa
2004-06-08 10:49 ` Stephan Stahl
2004-06-09 1:15 ` Miles Bader
2004-06-08 23:31 ` Richard Stallman
2 siblings, 2 replies; 16+ messages in thread
From: Kenichi Handa @ 2004-06-08 10:20 UTC (permalink / raw)
Cc: miles, miles, wl, emacs-devel
In article <m3brjuscoe.fsf@kfs-l.imdomain.dk>, storm@cua.dk (Kim F. Storm) writes:
> There are some defcustom variables which have no (or incorrect) effect
> if you set them with setq -- such variables typically have a :set
> action which must be called for the setting to take effect.
> For example pc-selection-mode and global-reveal-mode.
Isn't it possible to have a function, say
custom-set-variable, that sets a value and calls :set action
if necessary.
Ex: (custom-set-variable 'pc-selection-mode t)
I'm now working on utf-translate-cjk-mode and want to check
the result of setting/unsetting it repeatedly, but it's
quite annoying to do that via *Customize Option* buffer.
---
Ken'ichi HANDA
handa@m17n.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 10:20 ` Kenichi Handa
@ 2004-06-08 10:49 ` Stephan Stahl
2004-06-09 1:15 ` Miles Bader
1 sibling, 0 replies; 16+ messages in thread
From: Stephan Stahl @ 2004-06-08 10:49 UTC (permalink / raw)
Cc: emacs-devel
Hi.
Kenichi Handa said:
> Isn't it possible to have a function, say
> custom-set-variable, that sets a value and calls :set action
There is:
customize-set-variable is an interactive compiled Lisp function in
`cus-edit'.
(customize-set-variable variable value &optional comment)
Set the default for variable to value, and return value.
value is a Lisp object.
If variable has a `custom-set' property, that is used for setting
variable, otherwise `set-default' is used.
The `customized-value' property of the variable will be set to a list
with a quoted value as its sole list member.
If variable has a `variable-interactive' property, that is used as if
it were the arg to `interactive' (which see) to interactively read the value.
If variable has a `custom-type' property, it must be a widget and the
`:prompt-value' property of that widget will be used for reading the value.
If given a prefix (or a comment argument), also prompt for a comment.
--
Stephan Stahl
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 8:25 ` Juanma Barranquero
2004-06-08 9:23 ` Miles Bader
2004-06-08 9:35 ` Per Abrahamsen
@ 2004-06-08 11:02 ` Kenichi Handa
2 siblings, 0 replies; 16+ messages in thread
From: Kenichi Handa @ 2004-06-08 11:02 UTC (permalink / raw)
Cc: emacs-devel
In article <20040608101857.9673.JMBARRANQUERO@wke.es>, Juanma Barranquero <jmbarranquero@wke.es> writes:
> Which is the right way to set such a variable in .emacs (for those of us
> who don't want to use customize)?
> (customize-set-variable 'pc-selection-mode t)
Oops, I didn't know about this function.
By the way, the docstring contains this sentence:
value is a Lisp object.
but I think it's not necessary because we can't have
anything other than Lisp object.
Miles Bader <miles@lsi.nec.co.jp> writes:
> No, just use the associated function, e.g., (pc-selection-mode t)
> The issue is really independent of customize; some modes need setup to
> be done, and the way you do it these days is by calling the mode function.
For minor-mode variables, what's the difference between
customize-set-variable and the associated function?
---
Ken'ichi HANDA
handa@m17n.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 6:58 ` Werner LEMBERG
2004-06-08 7:59 ` Kim F. Storm
@ 2004-06-08 23:31 ` Richard Stallman
2004-06-09 5:18 ` Werner LEMBERG
1 sibling, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2004-06-08 23:31 UTC (permalink / raw)
Cc: miles, emacs-devel, miles
> Perhaps that's because it's the same as it has always been -- just
> use setq, or add-to-list, or whatever you like.
I think it would be a good idea to mention this somewhere...
Can you find a place in the manual that would be a good place to say
this?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 7:59 ` Kim F. Storm
2004-06-08 8:25 ` Juanma Barranquero
2004-06-08 10:20 ` Kenichi Handa
@ 2004-06-08 23:31 ` Richard Stallman
2 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2004-06-08 23:31 UTC (permalink / raw)
Cc: miles, miles, wl, emacs-devel
There are some defcustom variables which have no (or incorrect) effect
if you set them with setq -- such variables typically have a :set
action which must be called for the setting to take effect.
For example pc-selection-mode and global-reveal-mode.
In such cases, the variable's doc string should always say so.
We should try to minimize the number of such cases.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 10:20 ` Kenichi Handa
2004-06-08 10:49 ` Stephan Stahl
@ 2004-06-09 1:15 ` Miles Bader
1 sibling, 0 replies; 16+ messages in thread
From: Miles Bader @ 2004-06-09 1:15 UTC (permalink / raw)
Cc: wl, emacs-devel, storm
Kenichi Handa <handa@m17n.org> writes:
> I'm now working on utf-translate-cjk-mode and want to check
> the result of setting/unsetting it repeatedly, but it's
> quite annoying to do that via *Customize Option* buffer.
Um, `M-x utf-translate-cjk-mode RET' ...
-Miles
--
We live, as we dream -- alone....
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-08 23:31 ` Richard Stallman
@ 2004-06-09 5:18 ` Werner LEMBERG
2004-06-10 6:55 ` Richard Stallman
0 siblings, 1 reply; 16+ messages in thread
From: Werner LEMBERG @ 2004-06-09 5:18 UTC (permalink / raw)
Cc: miles, emacs-devel, miles
> > Perhaps that's because it's the same as it has always been -- just
> > use setq, or add-to-list, or whatever you like.
>
> I think it would be a good idea to mention this somewhere...
>
> Can you find a place in the manual that would be a good place to say
> this?
In the documentation section for defcustom (in elisp.info) , and in
the `Init File' section (of emacs.info).
Werner
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: doc problems with defcustom
2004-06-09 5:18 ` Werner LEMBERG
@ 2004-06-10 6:55 ` Richard Stallman
0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2004-06-10 6:55 UTC (permalink / raw)
Cc: miles, emacs-devel, miles
> Can you find a place in the manual that would be a good place to say
> this?
In the documentation section for defcustom (in elisp.info) , and in
the `Init File' section (of emacs.info).
I will add text there. Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2004-06-10 6:55 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-08 5:30 doc problems with defcustom Werner LEMBERG
2004-06-08 6:52 ` Miles Bader
2004-06-08 6:58 ` Werner LEMBERG
2004-06-08 7:59 ` Kim F. Storm
2004-06-08 8:25 ` Juanma Barranquero
2004-06-08 9:23 ` Miles Bader
2004-06-08 9:33 ` David Kastrup
2004-06-08 9:35 ` Per Abrahamsen
2004-06-08 11:02 ` Kenichi Handa
2004-06-08 10:20 ` Kenichi Handa
2004-06-08 10:49 ` Stephan Stahl
2004-06-09 1:15 ` Miles Bader
2004-06-08 23:31 ` Richard Stallman
2004-06-08 23:31 ` Richard Stallman
2004-06-09 5:18 ` Werner LEMBERG
2004-06-10 6:55 ` Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).