# HG changeset patch # User Paul Reilly # Date 1045586843 0 # Node ID 31edc813b710a941d9cf40efd475be005cb2eeb0 # Parent 3c2c324caf3879cc083cadd9f93f76d9c1f02cbd (rmail-message-subject-p, rmail-message-senders-p): Rewrite for mbox format. (rmail-make-summary-line-1, rmail-make-basic-summary-line): Use the rmail message descriptor instead of deprecated functions. diff -r 3c2c324caf38 -r 31edc813b710 lisp/mail/rmailsum.el --- a/lisp/mail/rmailsum.el Tue Feb 18 16:40:21 2003 +0000 +++ b/lisp/mail/rmailsum.el Tue Feb 18 16:47:23 2003 +0000 @@ -148,16 +148,20 @@ 'rmail-message-subject-p (mail-comma-list-regexp subject) whole-message)) +;; mbox: ready to define and execute test (defun rmail-message-subject-p (msg subject &optional whole-message) + "Return an indication if SUBJECT is found in MSG. If WHOLE-MESSAGE +is nil only the subject header will be searched, otherwise the whole +message will be searched for text matching SUBJECT. Return nil to +indicate that SUBJECT is not found, non-nil otherwise." (save-restriction - (goto-char (rmail-msgbeg msg)) - (search-forward "\n*** EOOH ***\n" (rmail-msgend msg) 'move) (narrow-to-region - (point) - (progn (search-forward (if whole-message "\^_" "\n\n")) (point))) + (rmail-desc-get-start msg) + (rmail-desc-get-end msg)) (goto-char (point-min)) - (if whole-message (re-search-forward subject nil t) - (string-match subject (let ((subj (mail-fetch-field "Subject"))) + (if whole-message + (re-search-forward subject nil t) + (string-match subject (let ((subj (mail-header-get-header "Subject"))) (if subj (funcall rmail-summary-line-decoder subj) "")))))) @@ -173,12 +177,15 @@ 'rmail-message-senders-p (mail-comma-list-regexp senders))) +;; mbox: ready to define and execute test (defun rmail-message-senders-p (msg senders) + "Return an indication of ..." (save-restriction - (goto-char (rmail-msgbeg msg)) - (search-forward "\n*** EOOH ***\n") - (narrow-to-region (point) (progn (search-forward "\n\n") (point))) - (string-match senders (or (mail-fetch-field "From") "")))) + (narrow-to-region + (rmail-desc-get-start msg) + (rmail-desc-get-end msg)) + (goto-char (point-mix)) + (string-match senders (or (mail-header-get-header "From") "")))) ;;;; General making of a summary buffer. @@ -301,8 +308,9 @@ :type 'function :group 'rmail-summary) +;; mbox: not ready (defun rmail-make-summary-line-1 (msg) - (goto-char (rmail-msgbeg msg)) + (goto-char (rmail-desc-get-start msg)) (let* ((lim (save-excursion (forward-line 2) (point))) (labels (progn @@ -339,8 +347,8 @@ ;; make a new one and put it in the message. (or line (let* ((case-fold-search t) - (next (rmail-msgend msg)) - (beg (if (progn (goto-char (rmail-msgbeg msg)) + (next (rmail-desc-get-end msg)) + (beg (if (progn (goto-char (rmail-desc-get-start msg)) (search-forward "\n*** EOOH ***\n" next t)) (point) (forward-line 1) @@ -350,7 +358,7 @@ (narrow-to-region beg end) (goto-char beg) (setq line (rmail-make-basic-summary-line))) - (goto-char (rmail-msgbeg msg)) + (goto-char (rmail-desc-get-start msg)) (forward-line 2) (insert "Summary-line: " line))) (setq pos (string-match "#" line)) @@ -380,6 +388,7 @@ :group 'rmail-retrieve :version "21.1") +;; mbox: not ready (defun rmail-make-basic-summary-line () (goto-char (point-min)) (concat (save-excursion @@ -471,8 +480,8 @@ (save-excursion (save-restriction (widen) - (let ((beg (rmail-msgbeg rmail-current-message)) - (end (rmail-msgend rmail-current-message)) + (let ((beg (rmail-desc-get-start rmail-current-message)) + (end (rmail-desc-get-end rmail-current-message)) lines) (save-excursion (goto-char beg)