[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: defvar interactively, user-variable-p
From: |
Drew Adams |
Subject: |
RE: defvar interactively, user-variable-p |
Date: |
Sun, 18 Oct 2015 08:35:15 -0700 (PDT) |
> BTW pitty that this functionality is gone. Anyhow
Note, though, that you have commands `customize-set-variable'
and `customize-set-value', each of which does a part of what
`set-variable' does (a prefix arg to `set-variable' gives the
buffer-local behavior) - and more.
Those commands have the advantage that they not only type-check
your input (respecting the defcustom `:type') but they also
respect other defcustom keywords, such as `:set'.
`set-variable' respects `:type', but unfortunately not `:set':
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6578
http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00867.html
http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00839.html
My impression is that too few users are aware of
`customize-set-variable' and `customize-set-value'. If the
(complete) behaviors of those commands were rolled into the
single command `set-variable' then users might take more
advantage of them.
And users who today still use `setq' in their init files
to set user options might then take to using that instead,
reducing problems due to ignoring `:type', `:set', and
`:initialize'.
I would also like to see defvar allow keywords `:type' and
`:set'. That is, let you optionally specify the types of
allowable values and specify a setter function.
http://lists.gnu.org/archive/html/emacs-devel/2009-10/msg00668.html
Not only are defvar variables sometimes set by users, but
they can be set by other libraries. Letting the defining
library control the allowable types would be a definite
benefit, IMO. Use of such keywords would be optional, of
course.