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: Stefan Monnier
Subject: Re: custom-set-variables considered harmful
Date: Wed, 29 Nov 2017 10:00:34 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> Thus, if you use ‘setq’ instead of ‘custom-set-variable’ you need to
> manually check every single variable to ensure they don't have setter
> functions assigned.  If you want to be thorough (nobody is) you also
> need to check them every time your modules are updated.  This is not
> just a theoretical situation.

Note that there are also many situations where the var has a setter, yet
doing (setq foo val) on it from your ~/.emacs will still work correctly
(as long as you do it before loading the library).
I'd argue it's actually the most frequent case.

> It happened in gnu-apl-mode, a library for which I am the maintainer.
> In it, the variable ‘gnu-apl-mode-map-prefix’ got a setter function
> after the fact.

Looking at gnu-apl-mode.el, I get the impression that this is no
exception:

    (setq gnu-apl-mode-map-prefix "C-")
    (require 'gnu-apl-mode)

will result in the exact same state as

    (customize-set-variable 'gnu-apl-mode-map-prefix "C-")
    (require 'gnu-apl-mode)

after gnu-apl-mode is loaded, OTOH you indeed need to use
customize-set-variable because a setq would have no real effect.


        Stefan



reply via email to

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