unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sam Steingold <sds@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: custom: how do I augment an option?
Date: Wed, 05 Sep 2012 13:56:20 -0400	[thread overview]
Message-ID: <87zk5473qz.fsf@gnu.org> (raw)

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	other threads:[~2012-09-05 17:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 17:56 Sam Steingold [this message]
2012-09-05 18:27 ` custom: how do I augment an option? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zk5473qz.fsf@gnu.org \
    --to=sds@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).