* bug#15718: 24.3.50; `C-M-x' does not work, with `defcustom' inside `when'
@ 2013-10-25 15:44 Drew Adams
2019-08-15 2:57 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2013-10-25 15:44 UTC (permalink / raw)
To: 15718
emacs -Q
(when t
(defcustom foo nil
"..."
:type boolean))
M-x set-variable foo t
Put point on foo in the defcustom sexp, and do `C-M-x'. `foo' is echoed
in the echo area, giving you the impression that the defcustom was
reevaluated, reinitializing `foo'.
C-h v foo ;; => t, not nil.
Without the `when', i.e., with the `defcustom' at top level, the value
is nil, as a user would expect.
In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
of 2013-10-19 on LEG570
Bzr revision: 114715 rgm@gnu.org-20131019023520-s8mwtib7xcx9e05w
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --enable-checking 'CFLAGS=-O0 -g3' CPPFLAGS=-DGLYPH_DEBUG=1'
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#15718: 24.3.50; `C-M-x' does not work, with `defcustom' inside `when'
2013-10-25 15:44 bug#15718: 24.3.50; `C-M-x' does not work, with `defcustom' inside `when' Drew Adams
@ 2019-08-15 2:57 ` Lars Ingebrigtsen
2019-08-15 4:41 ` Drew Adams
0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-15 2:57 UTC (permalink / raw)
To: Drew Adams; +Cc: 15718
Drew Adams <drew.adams@oracle.com> writes:
> emacs -Q
>
> (when t
> (defcustom foo nil
> "..."
> :type boolean))
>
> M-x set-variable foo t
>
> Put point on foo in the defcustom sexp, and do `C-M-x'. `foo' is echoed
> in the echo area, giving you the impression that the defcustom was
> reevaluated, reinitializing `foo'.
>
> C-h v foo ;; => t, not nil.
>
> Without the `when', i.e., with the `defcustom' at top level, the value
> is nil, as a user would expect.
I think this works as documented:
--
Evaluate the top-level form containing point, or after point.
If the current defun is actually a call to ‘defvar’ or ‘defcustom’,
evaluating it this way resets the variable using its initial value
expression (using the defcustom’s :set function if there is one), even
if the variable already has some other value. (Normally ‘defvar’ and
‘defcustom’ do not alter the value if there already is one.)
--
So only if the def* is top-level does the magic DWIM value-setting thing
happen.
Closing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#15718: 24.3.50; `C-M-x' does not work, with `defcustom' inside `when'
2019-08-15 2:57 ` Lars Ingebrigtsen
@ 2019-08-15 4:41 ` Drew Adams
0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2019-08-15 4:41 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 15718
> > emacs -Q
> >
> > (when t
> > (defcustom foo nil
> > "..."
> > :type boolean))
> >
> > M-x set-variable foo t
> >
> > Put point on foo in the defcustom sexp, and do `C-M-x'. `foo' is
> echoed
> > in the echo area, giving you the impression that the defcustom was
> > reevaluated, reinitializing `foo'.
> >
> > C-h v foo ;; => t, not nil.
> >
> > Without the `when', i.e., with the `defcustom' at top level, the
> value
> > is nil, as a user would expect.
>
> I think this works as documented:
>
> --
> Evaluate the top-level form containing point, or after point.
^^^^^^^^^^^^^^^^^^
>
> If the current defun is actually a call to ‘defvar’ or ‘defcustom’,
> evaluating it this way resets the variable using its initial value
> expression (using the defcustom’s :set function if there is one), even
> if the variable already has some other value. (Normally ‘defvar’ and
> ‘defcustom’ do not alter the value if there already is one.)
> --
>
> So only if the def* is top-level does the magic DWIM value-setting
> thing happen.
Yes. That's the problem.
This is an enhancement request - a request that it
instead work not just at the top level.
What's the reason why it should not "work" when
inside, say, `when'? AFAIK, that feature just
hasn't been implemented yet. Hence this request.
> Closing.
Unfortunate.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-15 4:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-25 15:44 bug#15718: 24.3.50; `C-M-x' does not work, with `defcustom' inside `when' Drew Adams
2019-08-15 2:57 ` Lars Ingebrigtsen
2019-08-15 4:41 ` Drew Adams
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).