changeset 100655:4f54978ec0c5

(pmail-message-subject-p): Mark as broken. (pmail-message-senders-p): Likewise. (pmail-new-summary-1): Don't unswap -- search messages where they are.
author Richard M. Stallman <rms@gnu.org>
date Tue, 23 Dec 2008 03:50:17 +0000
parents 2fedbb810d01
children 10033ffd4a59
files lisp/mail/pmailsum.el
diffstat 1 files changed, 40 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/pmailsum.el	Tue Dec 23 03:47:32 2008 +0000
+++ b/lisp/mail/pmailsum.el	Tue Dec 23 03:50:17 2008 +0000
@@ -148,6 +148,8 @@
    (mail-comma-list-regexp subject) whole-message))
 
 (defun pmail-message-subject-p (msg subject &optional whole-message)
+  ;;;??? BROKEN
+  (error "pmail-message-subject-p has not been updated for Pmail")
   (save-restriction
     (goto-char (pmail-msgbeg msg))
     (search-forward "\n*** EOOH ***\n" (pmail-msgend msg) 'move)
@@ -173,6 +175,8 @@
    (mail-comma-list-regexp senders)))
 
 (defun pmail-message-senders-p (msg senders)
+  ;;;??? BROKEN
+  (error "pmail-message-senders-p has not been updated for Pmail")
   (save-restriction
     (goto-char (pmail-msgbeg msg))
     (search-forward "\n*** EOOH ***\n")
@@ -240,29 +244,39 @@
   (let ((summary-msgs ())
 	(pmail-new-summary-line-count 0)
 	(sumbuf (pmail-get-create-summary-buffer)))
-    (let ((swap (pmail-use-collection-buffer))
-	  (msgnum 1)
-	  (buffer-read-only nil)
-	  (old-min (point-min-marker))
-	  (old-max (point-max-marker)))
-      ;; Can't use save-restriction here; that doesn't work if we
-      ;; plan to modify text outside the original restriction.
+    ;; Scan the messages, getting their summary strings
+    ;; and putting the list of them in SUMMARY-MSGS.
+    (let ((msgnum 1)
+	  (total pmail-total-messages)
+	  (inhibit-read-only t))
       (save-excursion
-	(widen)
-	(goto-char (point-min))
-	(while (>= pmail-total-messages msgnum)
-	  (if (or (null function)
-		  (apply function (cons msgnum args)))
-	      (setq summary-msgs
-		    (cons (cons msgnum (pmail-get-summary msgnum))
-			  summary-msgs)))
-	  (setq msgnum (1+ msgnum))
-	  ;; Provide a periodic User progress message.
-	  (if (zerop (% pmail-new-summary-line-count 10))
-	      (message "Computing summary lines...%d"
-		       pmail-new-summary-line-count)))
-	(setq summary-msgs (nreverse summary-msgs)))
-      (narrow-to-region old-min old-max))
+	(if (pmail-buffers-swapped-p)
+	    (set-buffer pmail-view-buffer))
+	(let ((old-min (point-min-marker))
+	      (old-max (point-max-marker)))
+	  (unwind-protect
+	      ;; Can't use save-restriction here; that doesn't work if we
+	      ;; plan to modify text outside the original restriction.
+	      (save-excursion
+		(widen)
+		(goto-char (point-min))
+		(while (>= total msgnum)
+		  ;; First test whether to include this message.
+		  (if (or (null function)
+			  (apply function (cons msgnum args)))
+		      (setq summary-msgs
+			    ;; Go back to the Pmail buffer so
+			    ;; so pmail-get-summary can see its local vars.
+			    (with-current-buffer pmail-buffer
+			      (cons (cons msgnum (pmail-get-summary msgnum))
+				    summary-msgs))))
+		  (setq msgnum (1+ msgnum))
+		  ;; Provide a periodic User progress message.
+		  (if (zerop (% pmail-new-summary-line-count 10))
+		      (message "Computing summary lines...%d"
+			       pmail-new-summary-line-count)))
+		(setq summary-msgs (nreverse summary-msgs)))
+	    (narrow-to-region old-min old-max)))))
 
     ;; Temporarily, while summary buffer is unfinished,
     ;; we "don't have" a summary.
@@ -1723,5 +1737,9 @@
 
 (provide 'pmailsum)
 
+;; Local Variables:
+;; change-log-default-name: "ChangeLog.pmail"
+;; End:
+
 ;; arch-tag: 80b0a27a-a50d-4f37-9466-83d32d1e0ca8
 ;;; pmailsum.el ends here