From: Ted Zlatanov <tzz@lifelogs.com>
Cc: ding@gnus.org
Subject: Re: Fancy splitting getting headers from included text
Date: Tue, 15 Apr 2003 13:44:43 -0400 [thread overview]
Message-ID: <4n3ckjbqpg.fsf@lockgroove.bwh.harvard.edu> (raw)
In-Reply-To: <87znmsygfh.fsf@cag.lcs.mit.edu> (David Z. Maze's message of "Mon, 14 Apr 2003 16:25:54 -0400")
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
next prev parent reply other threads:[~2003-04-15 17:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-25 19:02 David Z Maze
2003-03-26 8:21 ` Niklas Morberg
2003-03-30 2:47 ` Lars Magne Ingebrigtsen
2003-03-30 9:31 ` Kai Großjohann
2003-03-30 12:08 ` Simon Josefsson
2003-04-05 13:29 ` Ted Zlatanov
2003-04-14 15:53 ` David Z Maze
2003-04-14 16:33 ` Simon Josefsson
2003-04-14 20:25 ` David Z Maze
2003-04-15 17:44 ` Ted Zlatanov [this message]
2003-04-15 18:12 ` David Z Maze
2003-04-15 19:47 ` Ted Zlatanov
2003-05-07 14:27 ` Niklas Morberg
2003-06-11 9:23 ` Niklas Morberg
2003-06-13 8:33 ` Niklas Morberg
2003-06-13 9:35 ` Niklas Morberg
2003-06-13 9:50 ` [PATCH] " Niklas Morberg
2003-06-13 21:07 ` Kai Großjohann
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=4n3ckjbqpg.fsf@lockgroove.bwh.harvard.edu \
--to=tzz@lifelogs.com \
--cc=ding@gnus.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.
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).