changeset 6762:f77de1e2b48b

(rmail-new-summary): Avoid unsafe save-restriction.
author Karl Heuer <kwzh@gnu.org>
date Sat, 09 Apr 1994 02:46:19 +0000
parents f1d73d12436e
children 51de9400bf88
files lisp/mail/rmailsum.el
diffstat 1 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmailsum.el	Fri Apr 08 21:39:52 1994 +0000
+++ b/lisp/mail/rmailsum.el	Sat Apr 09 02:46:19 1994 +0000
@@ -156,19 +156,23 @@
       (let ((summary-msgs ())
 	    (new-summary-line-count 0))
 	(let ((msgnum 1)
-	      (buffer-read-only nil))
-	  (save-restriction
-	    (save-excursion
-	      (widen)
-	      (goto-char (point-min))
-	      (while (>= rmail-total-messages msgnum)
-		(if (or (null function)
-			(apply function (cons msgnum args)))
-		    (setq summary-msgs
-			  (cons (cons msgnum (rmail-make-summary-line msgnum))
-				summary-msgs)))
-		(setq msgnum (1+ msgnum)))
-	      (setq summary-msgs (nreverse summary-msgs)))))
+	      (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.
+	  (save-excursion
+	    (widen)
+	    (goto-char (point-min))
+	    (while (>= rmail-total-messages msgnum)
+	      (if (or (null function)
+		      (apply function (cons msgnum args)))
+		  (setq summary-msgs
+			(cons (cons msgnum (rmail-make-summary-line msgnum))
+			      summary-msgs)))
+	      (setq msgnum (1+ msgnum)))
+	    (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.
 	(setq rmail-summary-buffer nil)