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

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

custom: how do I augment an option?


From: Sam Steingold
Subject: custom: how do I augment an option?
Date: Wed, 05 Sep 2012 13:56:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

If I want to set a custom variable, I can do
--8<---------------cut here---------------start------------->8---
(custom-set-variables
 '(foo 42))
--8<---------------cut here---------------end--------------->8---
in my .emacs.
However, if I want to modify the custom variable, I have to resort to
something like
--8<---------------cut here---------------start------------->8---
(add-hook 'message-load-hook
  (lambda ()
    (add-to-list 'message-syntax-checks
                 '(long-lines . disabled))))
--8<---------------cut here---------------end--------------->8---
because
--8<---------------cut here---------------start------------->8---
(custom-set-variables
 '(message-syntax-checks (adjoin '(long-lines . disabled)
                                 message-syntax-checks
                                 :key 'equal)))
--8<---------------cut here---------------end--------------->8---
will evaluate `message-syntax-checks' too early:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (void-variable message-syntax-checks)
  (adjoin (quote (long-lines . disabled)) message-syntax-checks :key (quote 
equal))
  eval((adjoin (quote (long-lines . disabled)) message-syntax-checks :key 
(quote equal)))
  custom-initialize-reset(message-syntax-checks (if message-insert-canlock 
(quote ((sender . disabled))) nil))
  custom-declare-variable(message-syntax-checks...
  byte-code...
  require(message)
  byte-code...
  gnus-msg-mail(nil nil nil nil nil nil nil nil)
  compose-mail(nil nil nil nil)
  call-interactively(compose-mail nil nil)
--8<---------------cut here---------------end--------------->8---
(it also uses a CL function which emacs purists frown upon).

So, how do I use the custom facility to add something to a custom variable?
Thanks!

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://americancensorship.org http://jihadwatch.org
http://iris.org.il http://think-israel.org http://ffii.org
Don't use force -- get a bigger hammer.




reply via email to

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