From: Andreas Schwab <schwab@suse.de>
To: emacs-devel@gnu.org
Subject: Re: defcustom: order matters in `choice' with value-to-internal
Date: Fri, 21 Mar 2008 22:49:54 +0100 [thread overview]
Message-ID: <je63vfbvct.fsf@sykes.suse.de> (raw)
In-Reply-To: <v9k5jvom9p.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Fri\, 21 Mar 2008 21\:27\:46 +0100")
Reiner Steib <reinersteib+gmane@imap.cc> writes:
> consider these two defcustoms, which only differ in the order of the
> choice elements:
>
> (defcustom rs-test-1
> "^From:\\|^Newsgroups:\\|^Subject:"
> "doc string 1, list of regexps, regexp or nil"
> :type '(choice
> (const nil :tag "Use gnus-ignored-headers")
> regexp
> (repeat :value-to-internal (lambda (widget value)
> (custom-split-regexp-maybe value))
> :match (lambda (widget value)
> (or (stringp value)
> (widget-editable-list-match widget value)))
> regexp)))
>
> (defcustom rs-test-2
> "^From:\\|^Newsgroups:\\|^Subject:"
> "doc string 2, list of regexps, regexp or nil"
> :type '(choice
> (repeat :value-to-internal (lambda (widget value)
> (custom-split-regexp-maybe value))
> :match (lambda (widget value)
> (or (stringp value)
> (widget-editable-list-match widget value)))
> regexp)
> (const nil :tag "Use gnus-ignored-headers")
> regexp))
Order generally matters, the first matching choice is used. There is
nothing else that favors the repeat over regexp.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2008-03-21 21:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-21 20:27 defcustom: order matters in `choice' with value-to-internal Reiner Steib
2008-03-21 21:49 ` Andreas Schwab [this message]
2008-03-22 9:22 ` Reiner Steib
2008-03-22 17:10 ` Stefan Monnier
2008-03-23 21:41 ` Reiner Steib
2008-03-24 1:23 ` Stefan Monnier
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=je63vfbvct.fsf@sykes.suse.de \
--to=schwab@suse.de \
--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.