GNU bug report logs -
#71861
31.0.50; Keep better track of options to be :set-after others
Previous Next
To reply to this bug, email your comments to 71861 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
philipk <at> posteo.net, bug-gnu-emacs <at> gnu.org
:
bug#71861
; Package
emacs
.
(Sun, 30 Jun 2024 17:35:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
philipk <at> posteo.net, bug-gnu-emacs <at> gnu.org
.
(Sun, 30 Jun 2024 17:35:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In help-gnu-emacs <877ceftlof.fsf <at> gmail.com>, we noted that user options
that depend on each other induce some manual work to properly keep in
sync. The examples in that thread were:
* which-key-dont-use-unicode, consulted by
* which-key-separator
* which-key-ellipsis
* ls-lisp-emulation, consulted by
* ls-lisp-ignore-case
* ls-lisp-use-string-collate
* ls-lisp-dirs-first
* ls-lisp-verbosity
In these examples, each "sub-option" is defined with a :set-after clause
on the "meta-option", i.e. they are defined with:
(defcustom SUB-OPTION
(FORM META-OPTION)
"[…]."
[…]
:set-after '(META-OPTION)
[…])
Currently, for sub-options to be recomputed when users set the
corresponding meta-option, maintainers must add a :set clause to the
latter invoking custom-reevaluate-setting on the former: see e.g.
* which-key-dont-use-unicode's :set form:
:set (lambda (sym val)
(custom-set-default sym val)
(mapc #'custom-reevaluate-setting
'(which-key-separator
which-key-ellipsis)))
* ls-lisp-set-options, invoked by ls-lisp-emulation's :set form:
(mapc 'custom-reevaluate-setting
'(ls-lisp-ignore-case
ls-lisp-dirs-first
ls-lisp-verbosity
ls-lisp-use-string-collate))
Assisting maintainers by automating some of that would be neat. I have
some half-baked ideas on the topic, but I'll tuck them in a footnote¹
and let Philip tell us about his own 😉
¹
(a) (custom-add-dependencies sub-option meta-options) could be taught
to store the reverse dependency to help with bookkeeping, e.g.
(dolist (meta-opt meta-options)
(push sub-option (get meta-opt 'custom-watchers)))
This would allow maintainers of meta-options to retrieve all settings to
reevaluate, instead of having to spell out the whole list (which,
conceivably, they might not even know, e.g. if out-of-tree package x
decides to base their defaults on in-tree package y).
(b) To go further, assuming (a) is implemented, custom.el could be
taught to automatically
(mapc #'custom-reevaluate-setting (get opt 'custom-watchers))
after setting opt? Not sure if this is one step too far. Should this
behaviour be opt-in somehow, for backward compatibility? E.g. with a
new defcustom keyword for sub-options?
:depends-on (META-OPTIONS…)
or a new form for :set-after?
:set-after ((META-OPTION t)…)
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.42, cairo version 1.18.0) of 2024-06-23 built on amdahl30
Repository revision: 93088fc13c47fbab875f9ee173c0a66d623d91c6
Repository branch: master
Windowing system distributor 'SUSE LINUX', version 11.0.12401000
System Description: openSUSE Tumbleweed
Configured using:
'configure --prefix=/home/peniblec/apps/.emacs.2024-06-23 --with-cairo
--with-sqlite3 --with-xinput2'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71861
; Package
emacs
.
(Sat, 13 Jul 2024 13:02:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 71861 <at> debbugs.gnu.org (full text, mbox):
Sorry for the delay,
Kévin Le Gouguec <kevin.legouguec <at> gmail.com> writes:
> Assisting maintainers by automating some of that would be neat. I have
> some half-baked ideas on the topic, but I'll tuck them in a footnote¹
> and let Philip tell us about his own 😉
The simplest solution is to provide a variadic function that would call
`custom-reevaluate-setting' + perhaps some additional checks to avoid an
issue like in bug#72077. I feel that this would be the simplest option
that wouldn't require fiddling with defcustom internals. We can
document what :initialize to use as well (thought I'm guessing it would
be `custom-initialize-changed' most of the time).
--
Philip Kaludercic on peregrine
This bug report was last modified 218 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.