emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom-set-variables considered harmful


From: Vivek Dasmohapatra
Subject: Re: custom-set-variables considered harmful
Date: Wed, 8 Nov 2017 14:23:00 +0000 (GMT)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

On Wed, 8 Nov 2017, Stefan Monnier wrote:

Won't they then be surprised by the normal value sanitisation/hook-firing

Hmm... what you say rings some kind of bell, but not clearly enough:
could give a scenario to clarify the issue?

Sure, take something like glyphless-char-display-control which says:

==========================================================================
Do not set its value directly from Lisp; the value takes effect
only via a custom ‘:set’
function (‘update-glyphless-char-display’), which updates
‘glyphless-char-display’.

You can customize this variable.
==========================================================================

Or a variable which has a restricted set of possible values, as determined
by its defcustom declaration...

In the former case (or similar cases) the user might copy the setq and then
be surprised that it does not work as expected. In the latter, they would
copy the setq, alter the value (possibly to an "illegal" value) and then
be surprised it didnt work.

Maybe instead of setq a (users-will-copy-this-even-though-we-said-not-to …)
form which _could_ be copied out of the custom-set-variables expression
independently and would still trigger the relevant custom-related hooks
and value-sanitisation (I believe someone suggested custom-set or similar
instead of setq which might well do that).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]