From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/51484 Path: main.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: Fancy splitting getting headers from included text Date: Tue, 15 Apr 2003 13:44:43 -0400 Organization: =?koi8-r?q?=F4=C5=CF=C4=CF=D2=20=FA=CC=C1=D4=C1=CE=CF=D7?= @ Cienfuegos Sender: ding-owner@lists.math.uh.edu Message-ID: <4n3ckjbqpg.fsf@lockgroove.bwh.harvard.edu> References: <843cl5i4kg.fsf@lucy.is.informatik.uni-duisburg.de> <874r51jcsv.fsf@cag.lcs.mit.edu> <87znmsygfh.fsf@cag.lcs.mit.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1050428804 11254 80.91.224.249 (15 Apr 2003 17:46:44 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 15 Apr 2003 17:46:44 +0000 (UTC) Cc: ding@gnus.org Original-X-From: ding-owner+M28@lists.math.uh.edu Tue Apr 15 19:46:40 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 195UUA-0002k2-00 for ; Tue, 15 Apr 2003 19:44:46 +0200 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 195UUO-0001Iq-00; Tue, 15 Apr 2003 12:45:00 -0500 Original-Received: from sclp3.sclp.com ([64.157.176.121]) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 195UUG-0001Ik-00 for ding@lists.math.uh.edu; Tue, 15 Apr 2003 12:44:53 -0500 Original-Received: (qmail 16683 invoked by alias); 15 Apr 2003 17:44:51 -0000 Original-Received: (qmail 16678 invoked from network); 15 Apr 2003 17:44:51 -0000 Original-Received: from clifford.bwh.harvard.edu (134.174.9.41) by sclp3.sclp.com with SMTP; 15 Apr 2003 17:44:51 -0000 Original-Received: from lockgroove.bwh.harvard.edu (lockgroove [134.174.9.133]) by clifford.bwh.harvard.edu (8.10.2+Sun/8.11.0) with ESMTP id h3FHihI28027; Tue, 15 Apr 2003 13:44:43 -0400 (EDT) Original-Received: (from tzz@localhost) by lockgroove.bwh.harvard.edu (8.11.6+Sun/8.11.0) id h3FHihG05548; Tue, 15 Apr 2003 13:44:43 -0400 (EDT) Original-To: David Z Maze X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Followup-To: David Z Maze , ding@gnus.org In-Reply-To: <87znmsygfh.fsf@cag.lcs.mit.edu> (David Z. Maze's message of "Mon, 14 Apr 2003 16:25:54 -0400") User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.3 (usg-unix-v) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:51484 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:51484 On Mon, 14 Apr 2003, dmaze@MIT.EDU wrote: > Yup, still there with current CVS. I even see the proposed > save-excursion in spam-split in spam.el. > > (And I tried to follow it a little, and my brain hurt. I'm not used > to elisp code having that sort of control flow. (return) isn't in > my normal elisp vocabulary, particularly when it does something > *other* than return from the current function...it *does* look like > the save-excursion there should wrap the potential call to (widen), > though. I have spam-use-stat set to t, so the code path that calls > (widen) does get taken.) I think the code you mean is this: (save-excursion (dolist (check spam-list-of-statistical-checks) (when (symbol-value check) (widen) (gnus-message 8 "spam-split: widening the buffer (%s requires it)" (symbol-name check)) (return))) ...) The reason for (return) is that I like dolist, and (return) is what you're supposed to use to exit a dolist loop early. Are you and Simon saying the code also needs a save-restriction inside the save-excursion? If that's the case, try this (improperly indented) version of spam-split and see how it works: (defun spam-split () "Split this message into the `spam' group if it is spam. This function can be used as an entry in `nnmail-split-fancy', for example like this: (: spam-split) See the Info node `(gnus)Fancy Mail Splitting' for more details." (interactive) (save-excursion (save-restriction (dolist (check spam-list-of-statistical-checks) (when (symbol-value check) (widen) (gnus-message 8 "spam-split: widening the buffer (%s requires it)" (symbol-name check)) (return))) ;; (progn (widen) (debug (buffer-string))) (let ((list-of-checks spam-list-of-checks) decision) (while (and list-of-checks (not decision)) (let ((pair (pop list-of-checks))) (when (symbol-value (car pair)) (gnus-message 5 "spam-split: calling the %s function" (symbol-name (cdr pair))) (setq decision (funcall (cdr pair)))))) (if (eq decision t) nil decision))))) Ted