GNU bug report logs -
#80068
31.0.50; set-variable should read non-customizable variables
Previous Next
To reply to this bug, email your comments to 80068 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80068; Package
emacs.
(Wed, 24 Dec 2025 09:33:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Mendler <mail <at> daniel-mendler.de>:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org.
(Wed, 24 Dec 2025 09:33:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
`set-variable' only displays customizable variables during completion. I
want the completion list to show all variables, for consistency with
`describe-variable' and other Emacs interfaces. Given that the user has
full access to Elisp functionality everywhere, I think it is better to
not restrict `set-variable', also since `set-variable' is independent of
the customize UI.
Right now, I use an advice in my configuration, where the predicate has
been replaced.
(defun +read-variable (prompt &optional def)
"Allow setting arbitrary variables, not only customizable ones.
PROMPT is the minibuffer prompt, DEF the default value."
(let* ((buf (current-buffer))
(var (completing-read
prompt obarray
(lambda (v)
(and (not (or (eq v nil) (eq v t) (keywordp v)
(get v 'byte-obsolete-variable)))
(or (get v 'variable-documentation)
(boundp v) (buffer-local-boundp v buf))))
t nil 'custom-variable-history
(if (symbolp def) (symbol-name def) def))))
(and var (intern var))))
(advice-add #'read-variable :override #'+read-variable)
`read-variable' is implemented in C - but I think it could be moved to
Lisp without downsides. There is only one reference in C in the function
`Fcall_interactively'.
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.49, cairo version 1.18.4) of 2025-12-23
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux 13 (trixie)
Configured using:
'configure --prefix=$HOME/.local/share/emacs
--without-compress-install --with-tree-sitter --with-native-compilation
--with-dbus --without-selinux --without-threads --disable-gc-mark-trace
--without-gsettings --without-gpm --with-cairo --with-cairo-xcb
--with-xinput2 --with-x-toolkit=gtk3 --without-toolkit-scroll-bars
'CFLAGS=-O3 -mtune=native -march=native''
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSYSTEMD
LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 TIFF TREE_SITTER WEBP X11 XDBE XIM XINERAMA XINPUT2 XPM
XRANDR GTK3 ZLIB
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80068; Package
emacs.
(Wed, 24 Dec 2025 14:16:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 80068 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 24 Dec 2025 10:32:27 +0100
> From: Daniel Mendler via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> `set-variable' only displays customizable variables during completion. I
> want the completion list to show all variables, for consistency with
> `describe-variable' and other Emacs interfaces. Given that the user has
> full access to Elisp functionality everywhere, I think it is better to
> not restrict `set-variable', also since `set-variable' is independent of
> the customize UI.
set-variable is explicitly documented to be limited to customizable
options, and that is quite entrenched in the Emacs usage. So much so
that I have the habit of using it to check if a given variable is a
defcustom or not. You don't give any rationale for such a significant
change in the UI.
Let's please keep in mind that you can get completion with setq as
well nowadays.
So I'm not sure we need to make this change.
> `read-variable' is implemented in C - but I think it could be moved to
> Lisp without downsides. There is only one reference in C in the function
> `Fcall_interactively'.
This is a separate issue and should be discussed separately.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80068; Package
emacs.
(Wed, 24 Dec 2025 22:48:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 80068 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Date: Wed, 24 Dec 2025 10:32:27 +0100
>> From: Daniel Mendler via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> `set-variable' only displays customizable variables during completion. I
>> want the completion list to show all variables, for consistency with
>> `describe-variable' and other Emacs interfaces. Given that the user has
>> full access to Elisp functionality everywhere, I think it is better to
>> not restrict `set-variable', also since `set-variable' is independent of
>> the customize UI.
>
> set-variable is explicitly documented to be limited to customizable
> options, and that is quite entrenched in the Emacs usage. So much so
> that I have the habit of using it to check if a given variable is a
> defcustom or not. You don't give any rationale for such a significant
> change in the UI.
The motivation is that I lack a simple command to modify regular
variables, and I find the current behavior inconsistent with other
commands like `describe-variable'. The command is called `set-variable'
with no direct reference to customizable variables, so I find the
restriction artificial.
Note that there is also the command `customize-variable' if you just
want to check if a variable is customizable. I use this command, so I
understand that you have this need.
> Let's please keep in mind that you can get completion with setq as
> well nowadays.
Yes, it does, but it needs an additional step and more typing.
>> `read-variable' is implemented in C - but I think it could be moved to
>> Lisp without downsides. There is only one reference in C in the function
>> `Fcall_interactively'.
>
> This is a separate issue and should be discussed separately.
Okay, I can create a separate issue, but the way or where this is
implemented is not of major importance.
> Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80068; Package
emacs.
(Thu, 25 Dec 2025 06:18:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 80068 <at> debbugs.gnu.org (full text, mbox):
> From: Daniel Mendler <mail <at> daniel-mendler.de>
> Cc: 80068 <at> debbugs.gnu.org
> Date: Wed, 24 Dec 2025 23:47:22 +0100
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > set-variable is explicitly documented to be limited to customizable
> > options, and that is quite entrenched in the Emacs usage. So much so
> > that I have the habit of using it to check if a given variable is a
> > defcustom or not. You don't give any rationale for such a significant
> > change in the UI.
>
> The motivation is that I lack a simple command to modify regular
> variables
What about "M-:" followed by "(setq VARIABLE..." etc.? These are Lisp
variables, so why not manipulate them directly in Lisp?
> and I find the current behavior inconsistent with other
> commands like `describe-variable'. The command is called `set-variable'
> with no direct reference to customizable variables, so I find the
> restriction artificial.
Once upon a time, user options were defined using defvar, and the
indication that they are user options was by having their doc string
begin with an asterisk '*'. We have converted all of them to
defcustoms since then and removed the asterisk convention, but we
couldn't in our right minds change the name of the command which sets
their values.
> Note that there is also the command `customize-variable' if you just
> want to check if a variable is customizable. I use this command, so I
> understand that you have this need.
Alas, customize-variable loads gobs of stuff, the whole Custom
machinery, and also quite a few libraries, so it's much heavier for a
simple job like this.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80068; Package
emacs.
(Thu, 25 Dec 2025 10:09:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 80068 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Daniel Mendler <mail <at> daniel-mendler.de>
>> Cc: 80068 <at> debbugs.gnu.org
>> Date: Wed, 24 Dec 2025 23:47:22 +0100
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> > set-variable is explicitly documented to be limited to customizable
>> > options, and that is quite entrenched in the Emacs usage. So much so
>> > that I have the habit of using it to check if a given variable is a
>> > defcustom or not. You don't give any rationale for such a significant
>> > change in the UI.
>>
>> The motivation is that I lack a simple command to modify regular
>> variables
>
> What about "M-:" followed by "(setq VARIABLE..." etc.? These are Lisp
> variables, so why not manipulate them directly in Lisp?
This needs more typing, and more interaction during completion. I want
to do it in a single step.
>> and I find the current behavior inconsistent with other
>> commands like `describe-variable'. The command is called `set-variable'
>> with no direct reference to customizable variables, so I find the
>> restriction artificial.
>
> Once upon a time, user options were defined using defvar, and the
> indication that they are user options was by having their doc string
> begin with an asterisk '*'. We have converted all of them to
> defcustoms since then and removed the asterisk convention, but we
> couldn't in our right minds change the name of the command which sets
> their values.
Interesting. I didn't know how defcustoms were introduced.
Note that there are both the commands `customize-variable' and
`customize-set-variable'. But what we lack is a similar command to set
arbitrary variables, not only defcustoms.
>> Note that there is also the command `customize-variable' if you just
>> want to check if a variable is customizable. I use this command, so I
>> understand that you have this need.
>
> Alas, customize-variable loads gobs of stuff, the whole Custom
> machinery, and also quite a few libraries, so it's much heavier for a
> simple job like this.
This should not be a problem if you have Emacs running for a while -
then these libraries will likely be loaded? I see your point that you
want to check if a variable is customizable, but I do not understand why
it is a problem if some libraries get loaded.
Daniel
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80068; Package
emacs.
(Thu, 25 Dec 2025 11:52:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 80068 <at> debbugs.gnu.org (full text, mbox):
> From: Daniel Mendler <mail <at> daniel-mendler.de>
> Cc: 80068 <at> debbugs.gnu.org
> Date: Thu, 25 Dec 2025 11:08:24 +0100
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> Note that there are both the commands `customize-variable' and
> `customize-set-variable'. But what we lack is a similar command to set
> arbitrary variables, not only defcustoms.
Yes, but the problem remains with both: they work "the Customize way",
not "the setq way". So they both load gobs of Custom stuff.
> >> Note that there is also the command `customize-variable' if you just
> >> want to check if a variable is customizable. I use this command, so I
> >> understand that you have this need.
> >
> > Alas, customize-variable loads gobs of stuff, the whole Custom
> > machinery, and also quite a few libraries, so it's much heavier for a
> > simple job like this.
>
> This should not be a problem if you have Emacs running for a while -
> then these libraries will likely be loaded?
No, not here. I rarely if ever use Custom in my production sessions.
Why would I? it is very rare for me to customize variables during a
long-running session.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#80068; Package
emacs.
(Thu, 25 Dec 2025 12:06:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 80068 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Daniel Mendler <mail <at> daniel-mendler.de>
>> Cc: 80068 <at> debbugs.gnu.org
>> Date: Thu, 25 Dec 2025 11:08:24 +0100
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> Note that there are both the commands `customize-variable' and
>> `customize-set-variable'. But what we lack is a similar command to set
>> arbitrary variables, not only defcustoms.
>
> Yes, but the problem remains with both: they work "the Customize way",
> not "the setq way". So they both load gobs of Custom stuff.
As a compromise we could move `customize-set-variable' to custom.el,
such that it would always be available. This would avoid the loading
issue. Then `set-variable' could act on all variables.
As another compromise we could add a variable `set-variable-predicate'
(or `set-variable-include-all') which could be modified to change the
behavior of `set-variable'.
Daniel
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.