[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: defcustom: order matters in `choice' with value-to-internal
From: |
Andreas Schwab |
Subject: |
Re: defcustom: order matters in `choice' with value-to-internal |
Date: |
Fri, 21 Mar 2008 22:49:54 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) |
Reiner Steib <address@hidden> 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, address@hidden
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."