all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
To: emacs-devel@gnu.org
Subject: defcustom: order matters in `choice' with value-to-internal
Date: Fri, 21 Mar 2008 21:27:46 +0100	[thread overview]
Message-ID: <v9k5jvom9p.fsf@marauder.physik.uni-ulm.de> (raw)

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	other threads:[~2008-03-21 20:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-21 20:27 Reiner Steib [this message]
2008-03-21 21:49 ` defcustom: order matters in `choice' with value-to-internal Andreas Schwab
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=v9k5jvom9p.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.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.