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: Sam Steingold
Subject: Re: custom: how do I augment an option?
Date: Wed, 05 Sep 2012 16:45:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

> * Drew Adams <qerj.nqnzf@benpyr.pbz> [2012-09-05 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?

I don't like the gui; also see below (sneak preview: customize is broken :-).

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

Hah, but this is wrong!
The correct value of message-syntax-checks depends on message-insert-canlock:

(get 'message-syntax-checks 'standard-value)
==> ((if message-insert-canlock (quote ((sender . disabled))) nil))

While if I go your way, then message-syntax-checks will not depend on
message-insert-canlock!

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://openvotingconsortium.org
http://ffii.org http://thereligionofpeace.com http://honestreporting.com
Beliefs divide, doubts unite.



reply via email to

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