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

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

RE: custom: how do I augment an option?


From: Drew Adams
Subject: RE: custom: how do I augment an option?
Date: Wed, 5 Sep 2012 13:04:36 -0700

>> If I want to set a custom variable, I can do
>> 
>> (custom-set-variables '(foo 42))
>>
>> in my .emacs.  However, if I want to modify the custom variable,
>> I have to resort to something like
>> 
>> (add-hook 'message-load-hook
>>   (lambda ()
>>     (add-to-list 'message-syntax-checks '(long-lines . disabled))))

No, you do not have to resort to doing that.

> The "solution" is
>
> (custom-set-variables
>  '(message-syntax-checks
>    (adjoin '(long-lines . disabled)
>     (eval (car (get 'message-syntax-checks 'standard-value)))
>     :test 'equal)))
>
> which uses `eval' on top of `adjoin'.
> So, what is the official method?

Sorry, but I don't see what the problem is.  Why not just use Customize?

At the very least you could use Customize to see what it writes out.  If you
start with Emacs -Q and add (long-lines . disabled) to the default value then it
writes this:

'(message-syntax-checks
   (quote ((sender . disabled) (long-lines . disabled))))

`M-x customize-option' lets you not worry about the Lisp form to use.

But if for some reason you prefer to worry about it, the "solution" is to ask
Emacs what Lisp code it uses, i.e., use Customize to see what it does.




reply via email to

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