[Top][All Lists]

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

RE: custom-set-variables considered harmful

From: Drew Adams
Subject: RE: custom-set-variables considered harmful
Date: Wed, 29 Nov 2017 07:03:39 -0800 (PST)

> > 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.

It may be the case that many uses of `setq' amount to the
same thing as using `c-s-var*'.  But I'm not sure what
that changes.

Here's a crazy possibility (not a suggestion, but maybe
food for thought): Make `setq' do `customize-set-variable'
for an option and do what it does now otherwise.

(Ducks for cover...)

reply via email to

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