From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/55153 Path: main.gmane.org!not-for-mail From: Per Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: nnmail-split-fancy customization type Date: Tue, 09 Dec 2003 13:20:17 +0100 Organization: The Church of Emacs Sender: ding-owner@lists.math.uh.edu Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1070972455 15863 80.91.224.253 (9 Dec 2003 12:20:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Dec 2003 12:20:55 +0000 (UTC) Original-X-From: ding-owner+M3693@lists.math.uh.edu Tue Dec 09 13:20:53 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ATgrE-0002sM-00 for ; Tue, 09 Dec 2003 13:20:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1ATgqt-0000Im-00; Tue, 09 Dec 2003 06:20:31 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1ATgql-0000Ig-00 for ding@lists.math.uh.edu; Tue, 09 Dec 2003 06:20:23 -0600 Original-Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by justine.libertine.org (Postfix) with ESMTP id 641CA3A0033 for ; Tue, 9 Dec 2003 06:20:22 -0600 (CST) Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1ATgqj-0000fb-00 for ; Tue, 09 Dec 2003 13:20:21 +0100 Mail-Followup-To: ding@gnus.org X-Injected-Via-Gmane: http://gmane.org/ Original-To: ding@gnus.org Original-Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ATgqg-0000fJ-00 for ; Tue, 09 Dec 2003 13:20:18 +0100 Original-Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1ATgqg-00046F-00 for ; Tue, 09 Dec 2003 13:20:18 +0100 Original-Lines: 116 Original-X-Complaints-To: usenet@sea.gmane.org X-Face: +kRV2]2q}lixHkE{U)mY#+6]{AH=yN~S9@IFiOa@X6?GM|8MBp/ Mail-Copies-To: nobody User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:2kyiPzXknkFp67FSXffG7+N5b2U= Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:55153 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:55153 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 + + * nnmail.el (nnmail-lazy, nnmail-split-fancy): New widgets. + (nnmail-split-fancy): Use it. + 2003-12-08 Joel Ray Holveck (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")