help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: which one to use: custom-set-variables, customize-set-variable, or c


From: Lele Gaifax
Subject: Re: which one to use: custom-set-variables, customize-set-variable, or customize-set-value?
Date: Fri, 11 Dec 2015 19:23:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Drew Adams <drew.adams@oracle.com> writes:

> Hi Alan,
>
>> Thank you for the explanation. For the moment I'm sticking with
>> `customize-set-variable'
>
> Good choice.

After reading this thread, as well as the referenced
http://permalink.gmane.org/gmane.emacs.bugs/107690, I tried to see if I should
rectify some settings in my own init file. Indeed, I was using `setq' on a
bunch of customizable options...

Given that checking each variable documentation to see the right way to set
its value is error prone, I wrote the following macro and used it in almost
all cases, replacing `setq' and `set-default' in my configuration:

    (defmacro csetq (variable value)
      "Macro to set the value of a variable, possibly a custom user option."
      `(funcall (or (get ',variable 'custom-set)
                    (and (plist-member (symbol-plist ',variable) 
'standard-value) 'set-default)
                    'set)
                ',variable ,value))

While it seems working as expected, I like to hear other's opinion: do you see
any problem with this approach?

Thank you,
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.




reply via email to

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