From 7cff9c6f87651a977e752b781a28d9dc459da84a Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Thu, 26 Apr 2001 13:43:42 +0000 Subject: [PATCH] (rmail-message-regexp-p): Use rfc822-goto-eoh if necessary, like in rmail-show-message. --- lisp/ChangeLog | 5 +++++ lisp/mail/rmail.el | 36 ++++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 06b679a80b4..3d42dccf890 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2001-04-26 Gerd Moellmann + + * mail/rmail.el (rmail-message-regexp-p): Use rfc822-goto-eoh + if necessary, like in rmail-show-message. + 2001-04-26 Vinicius Jose Latorre * ps-print.el: Color specified by number is forced to be float number. diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 927ac482bba..8ff2800cda6 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -2495,22 +2495,26 @@ or forward if N is negative." (if (not primary-only) (string-match recipients (or (mail-fetch-field "Cc") "")))))) -(defun rmail-message-regexp-p (msg regexp) - "Return t, if for message number MSG, regexp REGEXP matches in the header." - (save-excursion - (goto-char (rmail-msgbeg msg)) - (let (beg end) - (save-excursion - (forward-line 2) - (setq beg (point))) - (save-excursion - (search-forward "\n*** EOOH ***\n" (point-max)) - (when (= beg (match-beginning 0)) - (setq beg (point)) - (search-forward "\n\n" (point-max))) - (setq end (point))) - (goto-char beg) - (re-search-forward regexp end t)))) +(defun rmail-message-regexp-p (n regexp) + "Return t, if for message number N, regexp REGEXP matches in the header." + (let ((beg (rmail-msgbeg n)) + (end (rmail-msgend n))) + (goto-char beg) + (forward-line 1) + (save-excursion + (save-restriction + (if (prog1 (= (following-char) ?0) + (forward-line 2) + ;; If there's a Summary-line in the (otherwise empty) + ;; header, we didn't yet get past the EOOH line. + (if (looking-at "^\\*\\*\\* EOOH \\*\\*\\*\n") + (forward-line 1)) + (narrow-to-region (point) end)) + (rfc822-goto-eoh) + (search-forward "\n*** EOOH ***\n" end t)) + (narrow-to-region beg (point)) + (goto-char (point-min)) + (re-search-forward regexp end t))))) (defvar rmail-search-last-regexp nil) (defun rmail-search (regexp &optional n) -- 2.39.5