* bug#71861: 31.0.50; Keep better track of options to be :set-after others
@ 2024-06-30 17:34 Kévin Le Gouguec
2024-07-13 13:00 ` Philip Kaludercic
0 siblings, 1 reply; 2+ messages in thread
From: Kévin Le Gouguec @ 2024-06-30 17:34 UTC (permalink / raw)
To: 71861; +Cc: Philip Kaludercic
In help-gnu-emacs <877ceftlof.fsf@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 😉
\f
¹
(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)…)
\f
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#71861: 31.0.50; Keep better track of options to be :set-after others
2024-06-30 17:34 bug#71861: 31.0.50; Keep better track of options to be :set-after others Kévin Le Gouguec
@ 2024-07-13 13:00 ` Philip Kaludercic
0 siblings, 0 replies; 2+ messages in thread
From: Philip Kaludercic @ 2024-07-13 13:00 UTC (permalink / raw)
To: Kévin Le Gouguec; +Cc: 71861
Sorry for the delay,
Kévin Le Gouguec <kevin.legouguec@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-13 13:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-30 17:34 bug#71861: 31.0.50; Keep better track of options to be :set-after others Kévin Le Gouguec
2024-07-13 13:00 ` Philip Kaludercic
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).