From 36f419156878396b07ce4cb44b1adc9c6e2cb5d1 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Sat, 9 Apr 1994 02:46:19 +0000 Subject: [PATCH] (rmail-new-summary): Avoid unsafe save-restriction. --- lisp/mail/rmailsum.el | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 3584c9cfad2..19f72b00a1f 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -156,19 +156,23 @@ nil for FUNCTION means all messages." (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) -- 2.11.4.GIT