From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/75289 Path: news.gmane.org!not-for-mail From: Tommy Kelly Newsgroups: gmane.emacs.gnus.general Subject: Fancy Mail Splitting documentation needs improved? Date: Sun, 19 Dec 2010 12:02:16 -0600 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1292781818 6982 80.91.229.12 (19 Dec 2010 18:03:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 19 Dec 2010 18:03:38 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M23641@lists.math.uh.edu Sun Dec 19 19:03:30 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PUNbV-00084Q-EN for ding-account@gmane.org; Sun, 19 Dec 2010 19:03:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PUNay-00072H-22; Sun, 19 Dec 2010 12:02:56 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PUNaw-000726-HJ for ding@lists.math.uh.edu; Sun, 19 Dec 2010 12:02:54 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PUNaj-0001Zt-Eq for ding@lists.math.uh.edu; Sun, 19 Dec 2010 12:02:51 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1PUNah-0007In-AD for ding@gnus.org; Sun, 19 Dec 2010 19:02:39 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PUNag-0007VC-6I for ding@gnus.org; Sun, 19 Dec 2010 19:02:38 +0100 Original-Received: from cpe-70-112-150-104.austin.res.rr.com ([70.112.150.104]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 19 Dec 2010 19:02:38 +0100 Original-Received: from tommy.kelly by cpe-70-112-150-104.austin.res.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 19 Dec 2010 19:02:38 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 138 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpe-70-112-150-104.austin.res.rr.com User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (darwin) Cancel-Lock: sha1:7QRPnmYSoy9K6tv2bQ+s3HH0Nbw= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:75289 Archived-At: I'm *really* struggling to understand "6.4.6 Fancy Mail Splitting". In this situation there's always the danger that the reader is at fault -- maybe there are some prerequisites they don't have. But I don't believe that's the case here. I know *very* minimal lisp, but I don't think that's what's holding me back. Besides, should someone really need to be a lisp programmer to split their mail? Here is the beginning of a rewrite. It'll be full of errors but that is, I claim, the fault of the current doc. I could have asked many individual questions to deal with the various uncertainties I have, but maybe this'll catch a bunch of them in one go. If folk can help me correct my errors, I think it'll help improve the whole thing. Also, if I'm stepping on toes here, apologies. Happy to retire to my cave if this is someone else's cookie. ##### START OF POSSIBLE RE-WRITE 6.4.6 Fancy Mail Splitting ========================== If the rather simple, standard method for specifying how to split mail doesn't allow you to do what you want, you can set `nnmail-split-methods' to `nnmail-split-fancy'. This allows more sophisticated control, including calls to full-blown lisp functions of your own, of how your incoming email gets split. >From a high level view, fancy splitting may be fancy, but it's not really that complicated. Basically, we set the nnmail-split-fancy variable to contain of a set of one or more email matching rules -- we'll call them "splits" from here on, 'cos we're using them to split email, and 'cos it's shorter. Each split is, again basically, simply some matching criteria and a corresponding Gnus group name. Each incoming email is tested against the splits and is then placed in (or "split into") the group, or groups, according to how it matches. See, simple. But it is in the details that we'll find the power, and devilish complexity, of fancy splitting. There are three scarily cool things that may make it worth your while to have meandered here from the world of simple splitting back in . 1. A fancy split is, in general, a recursive structure. You can have splits within splits within splits. That's very useful. And fancy. You'll see. 2. Whether splits are invoked in parallel (e.g. to allow crossposting) or in sequence is under your control 3. Splits can invoke lisp functions of your own construction Those three things together mean you can build splitting systems of immense complexity, and generally ruin your life. However, experience has shown that unless you already know how fancy splitting works (in which case move along, why are you here? -- you probably want to jump straight to ), we should start off gently with a simple example. 6.4.6.1 ------- Perhaps the easiest to understand form of split is a lisp list containing three components as follows: (FIELD VALUE GROUP) For example: (subject "gnus" "mail-about-gnus") This split would take all mails having "gnus" in the subject and place them into the group "mail-about-gnus". Although this is an example of a valid split, it would not be appropriate to set your nnmail-split-fancy variable to that alone. The reason is that it does not tell Gnus what to do with mails that do *not* match that criterion. So, to set up that split in your .gnus file you would do something like this: (setq nnmail-split-fancy '(| (subject "gnus" "mail-about-gnus") "INBOX") Here, our simple split example is given as the second item in a more complex split -- i.e. showing the recursion mentioned earlier. There are three components to the more complex split: | - this says we will treat all of the remaining items in the list as splits but that we'll process them in order, and that we'll stop whenever we get a match. (subject "gnus" "mail-about-gnus") - our original simple split. As described, it takes mails with "gnus" in the subject line and puts them into the "mail-about-gnus" group "INBOX" - a catchall, used if all previous splits fail to match. In other words, all mails that do not match the "mail-about-gnus" split will be placed in the group, "INBOX". So the overall effect of that split is to place emails with "gnus" in the subject into the "mail-about-gnus" group, and everything else into the "INBOX" group. Simple. 6.4.6.2 ------- As we've just seen, the "mail-about-gnus" split is a simple version of a more general, possibly recursive, very fancy structure. In general, a split is a lisp list taking one of four forms (note that the example from 6.4.6.1 is a simple example of the first of the four forms). The forms are: (FIELD VALUE [- RESTRICT [...] ] SPLIT [INVERT-PARTIAL]) OR ( SPLIT1 [SPLIT2 [SPLIT3 [...]]]) where is one of: |, & or : OR "" OR junk ##### END OF POSSIBLE RE-WRITE OK, I'm stopping here for comments from y'all. Note that I'm thinking aloud in the above. For example, the idea that there are four forms of split could probably be simplified into a single syntax covering all forms. But I haven't figure out what that looks like yet. Comments *very* welcome. Tommy