all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: custom: how do I augment an option?
Date: Fri, 26 Oct 2012 14:21:56 -0400	[thread overview]
Message-ID: <jwvip9xw1lp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <871uifhv31.fsf@gnu.org> (Sam Steingold's message of "Thu, 06 Sep 2012 14:20:18 -0400")

> If I want to _modify_ a custom variable, I have to resort to something like
> --8<---------------cut here---------------start------------->8---
> (custom-set-variables
>  '(message-syntax-checks
>    (cl-adjoin '(long-lines . disabled)
>     (eval (car (get 'message-syntax-checks 'standard-value)))
>     :test 'equal)))
> --8<---------------cut here---------------end--------------->8---
> which uses a CL function _and_ also eval.

While `adjoin' is frowned upon, using `cl-adjoin' is accepted.

> How about changing `custom-set-variables' to accept
> (SYMBOL EXP [NOW [REQUEST [COMMENT [SETTER]]]])
> instead of
> (SYMBOL EXP [NOW [REQUEST [COMMENT]]])
> where SETTER would be a function acceptable as the :set argument to
> defcustom.

That doesn't sound good to me.  A `setter' is the function that takes
the value of EXP and "puts it at the right place" (possibly changing it
to another representation along the way).  That sounds quite different
from what you want.

> Also, semi-independently, I propose a function
> (defun custom-standard-value (symbol)
>   "Return the standard value of the customizable option."
>   (eval (car (get symbol 'standard-value))))

That sounds OK.  Tho, since Custom also manages faces, it would make
sense to give it a name that includes "variable".  Sadly,
custom-variable-standard-value is already taken for "the same thing but
without `eval' and `car'".
OTOH, there's only one use of custom-variable-standard-value currently,
and we can hope that it's not used outside, so it might be OK to
change that use and hijack the name for your above function (post 24.3,
obviously).


        Stefan



      reply	other threads:[~2012-10-26 18:21 UTC|newest]

Thread overview: 11+ 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
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
2012-09-06 18:20     ` Sam Steingold
2012-10-26 18:21       ` Stefan Monnier [this message]

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

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

  git send-email \
    --in-reply-to=jwvip9xw1lp.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.