unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* custom: how do I augment an option?
@ 2012-09-05 17:56 Sam Steingold
  2012-09-05 18:27 ` Jambunathan K
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Sam Steingold @ 2012-09-05 17:56 UTC (permalink / raw)
  To: help-gnu-emacs

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.




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-09-06 13:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 17:56 custom: how do I augment an option? Sam Steingold
2012-09-05 18:27 ` Jambunathan K
2012-09-05 19:18 ` Sam Steingold
2012-09-05 20:04   ` Drew Adams
2012-09-05 20:45     ` Sam Steingold
2012-09-05 21:15       ` Drew Adams
2012-09-05 21:27         ` Drew Adams
     [not found] ` <mailman.8164.1346872698.855.help-gnu-emacs@gnu.org>
2012-09-06 13:14   ` Stefan Monnier
2012-09-06 13:37     ` Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).