From: Per Abrahamsen <abraham@dina.kvl.dk>
Subject: nnmail-split-fancy customization type
Date: Tue, 09 Dec 2003 13:20:17 +0100 [thread overview]
Message-ID: <rjpteyuqri.fsf@sheridan.dina.kvl.dk> (raw)
Hi!
I just gave the nnmail-split-fancy defcustom a proper :type argument.
Computers are fast enough for that these days.
The :type should handle the documented syntax of nnmail-split-fancy,
but it caught a couple of errors in my setting of that variable.
It is implemented on top of a "nnmail-lazy" widget, which I'm also
going to commit to Emacs (under the name "lazy") when their CVS server
start working again. I hope someone else will commit it to XEmacs
CVS.
If you have some recursive datastructures you want to create a :type
for, I suggest you look at the "nnmail-lazy" (or "lazy") widgets.
I have commited the following patch:
Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v
retrieving revision 6.2687
diff -u -r6.2687 ChangeLog
--- ChangeLog 8 Dec 2003 14:17:35 -0000 6.2687
+++ ChangeLog 9 Dec 2003 11:24:53 -0000
@@ -1,3 +1,8 @@
+2003-12-09 Per Abrahamsen <abraham@dina.kvl.dk>
+
+ * nnmail.el (nnmail-lazy, nnmail-split-fancy): New widgets.
+ (nnmail-split-fancy): Use it.
+
2003-12-08 Joel Ray Holveck <joelh@piquan.org> (tiny change)
* gnus-sum.el (gnus-summary-save-parts-1): Consider the "name"
Index: nnmail.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnmail.el,v
retrieving revision 6.83
diff -u -r6.83 nnmail.el
--- nnmail.el 12 Nov 2003 20:54:36 -0000 6.83
+++ nnmail.el 9 Dec 2003 11:24:53 -0000
@@ -363,6 +363,64 @@
:type '(choice (const :tag "infinite" nil)
(number :tag "count")))
+(define-widget 'nnmail-lazy 'default
+ "Base widget for recursive datastructures.
+
+This is copy of the `lazy' widget in Emacs 21.4 provided for compatibility."
+ :format "%{%t%}: %v"
+ :convert-widget 'widget-value-convert-widget
+ :value-create (lambda (widget)
+ (let ((value (widget-get widget :value))
+ (type (widget-get widget :type)))
+ (widget-put widget :children
+ (list (widget-create-child-value
+ widget (widget-convert type) value)))))
+ :value-delete 'widget-children-value-delete
+ :value-get (lambda (widget)
+ (widget-value (car (widget-get widget :children))))
+ :value-inline (lambda (widget)
+ (widget-apply (car (widget-get widget :children))
+ :value-inline))
+ :default-get (lambda (widget)
+ (widget-default-get
+ (widget-convert (widget-get widget :type))))
+ :match (lambda (widget value)
+ (widget-apply (widget-convert (widget-get widget :type))
+ :match value))
+ :validate (lambda (widget)
+ (widget-apply (car (widget-get widget :children)) :validate)))
+
+(define-widget 'nnmail-split-fancy 'nnmail-lazy
+ "Widget for customizing splits in the variable of the same name."
+ :tag "Split"
+ :type '(menu-choice :value (any ".*value.*" "misc")
+ :tag "Type"
+ (string :tag "Destination")
+ (list :tag "Or" :value (|)
+ (const :format "" |)
+ (editable-list :inline t nnmail-split-fancy))
+ (list :tag "And" :value (&)
+ (const :format "" &)
+ (editable-list :inline t nnmail-split-fancy))
+ (list :tag "Function with fixed arguments"
+ :value (:)
+ (const :format "" :value :)
+ function
+ (editable-list :inline t (sexp :tag "Arg"))
+ )
+ (list :tag "Function with split arguments" :value (!)
+ (const :format "" !)
+ function
+ (editable-list :inline t nnmail-split-fancy))
+ (list :tag "Field match"
+ (choice :tag "Field"
+ regexp symbol)
+ (choice :tag "Match"
+ regexp
+ (symbol :value mail))
+ nnmail-split-fancy)
+ (const :tag "Junk" junk)))
+
(defcustom nnmail-split-fancy "mail.misc"
"Incoming mail can be split according to this fancy variable.
To enable this, set `nnmail-split-methods' to `nnmail-split-fancy'.
@@ -438,8 +496,7 @@
;; Unmatched mail goes to the catch all group.
\"misc.misc\"))"
:group 'nnmail-split
- ;; Sigh!
- :type 'sexp)
+ :type 'nnmail-split-fancy)
(defcustom nnmail-split-abbrev-alist
'((any . "from\\|to\\|cc\\|sender\\|apparently-to\\|resent-from\\|resent-to\\|resent-cc")
next reply other threads:[~2003-12-09 12:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-09 12:20 Per Abrahamsen [this message]
2003-12-15 23:20 ` Katsumi Yamaoka
2003-12-16 10:38 ` Per Abrahamsen
2003-12-16 10:44 ` Katsumi Yamaoka
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=rjpteyuqri.fsf@sheridan.dina.kvl.dk \
--to=abraham@dina.kvl.dk \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).