emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defcustom: order matters in `choice' with value-to-internal


From: Reiner Steib
Subject: defcustom: order matters in `choice' with value-to-internal
Date: Fri, 21 Mar 2008 21:27:46 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.92 (gnu/linux)

Hi,

consider these two defcustoms, which only differ in the order of the
choice elements:

--8<---------------cut here---------------start------------->8---
(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))
--8<---------------cut here---------------end--------------->8---

In the customize buffer, I get (Emacs 22 branch):

,----[ M-x customize-apropos RET rs-test RET ]
| rs-test-1: [Hide Value] [Value Menu] Regexp: ^From:\|^Newsgroups:\|^Subject:
|    [State]: STANDARD.
| 
| doc string 1, list of regexps, regexp or nil
| Groups: [message-faces]
| 
| rs-test-2: [Hide Value] [Value Menu] Repeat:
| [INS] [DEL] Regexp: ^From:
| [INS] [DEL] Regexp: ^Newsgroups:
| [INS] [DEL] Regexp: ^Subject:
| [INS]
|    [State]: STANDARD.
| 
| doc string 2, list of regexps, regexp or nil
| Groups: [message-faces]
`----

I would have expected the same, split result for both variables.

(BTW, I have now idea why "Groups: [message-faces]" is shown.  Seems
like some random group?)

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]