unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sam Steingold <sds@gnu.org>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: custom: how do I augment an option?
Date: Wed, 05 Sep 2012 16:45:08 -0400	[thread overview]
Message-ID: <87ehmgnqqz.fsf@gnu.org> (raw)
In-Reply-To: <92BD2872D2E546BA94A3CAE398693C26@us.oracle.com> (Drew Adams's message of "Wed, 5 Sep 2012 13:04:36 -0700")

> * 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	other threads:[~2012-09-05 20:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=87ehmgnqqz.fsf@gnu.org \
    --to=sds@gnu.org \
    --cc=drew.adams@oracle.com \
    --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).