diff options
| author | Karl Heuer | 1994-04-09 02:46:19 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-04-09 02:46:19 +0000 |
| commit | 36f419156878396b07ce4cb44b1adc9c6e2cb5d1 (patch) | |
| tree | a1f1b5c1eaf72c6a99d2e31e94c995cbc636c6d7 | |
| parent | a50d43268a91c7900ee0040b4d2c39ffa70f1b6a (diff) | |
| download | emacs-36f419156878396b07ce4cb44b1adc9c6e2cb5d1.tar.gz emacs-36f419156878396b07ce4cb44b1adc9c6e2cb5d1.zip | |
(rmail-new-summary): Avoid unsafe save-restriction.
| -rw-r--r-- | lisp/mail/rmailsum.el | 30 |
1 files 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." | |||
| 156 | (let ((summary-msgs ()) | 156 | (let ((summary-msgs ()) |
| 157 | (new-summary-line-count 0)) | 157 | (new-summary-line-count 0)) |
| 158 | (let ((msgnum 1) | 158 | (let ((msgnum 1) |
| 159 | (buffer-read-only nil)) | 159 | (buffer-read-only nil) |
| 160 | (save-restriction | 160 | (old-min (point-min-marker)) |
| 161 | (save-excursion | 161 | (old-max (point-max-marker))) |
| 162 | (widen) | 162 | ;; Can't use save-restriction here; that doesn't work if we |
| 163 | (goto-char (point-min)) | 163 | ;; plan to modify text outside the original restriction. |
| 164 | (while (>= rmail-total-messages msgnum) | 164 | (save-excursion |
| 165 | (if (or (null function) | 165 | (widen) |
| 166 | (apply function (cons msgnum args))) | 166 | (goto-char (point-min)) |
| 167 | (setq summary-msgs | 167 | (while (>= rmail-total-messages msgnum) |
| 168 | (cons (cons msgnum (rmail-make-summary-line msgnum)) | 168 | (if (or (null function) |
| 169 | summary-msgs))) | 169 | (apply function (cons msgnum args))) |
| 170 | (setq msgnum (1+ msgnum))) | 170 | (setq summary-msgs |
| 171 | (setq summary-msgs (nreverse summary-msgs))))) | 171 | (cons (cons msgnum (rmail-make-summary-line msgnum)) |
| 172 | summary-msgs))) | ||
| 173 | (setq msgnum (1+ msgnum))) | ||
| 174 | (setq summary-msgs (nreverse summary-msgs))) | ||
| 175 | (narrow-to-region old-min old-max)) | ||
| 172 | ;; Temporarily, while summary buffer is unfinished, | 176 | ;; Temporarily, while summary buffer is unfinished, |
| 173 | ;; we "don't have" a summary. | 177 | ;; we "don't have" a summary. |
| 174 | (setq rmail-summary-buffer nil) | 178 | (setq rmail-summary-buffer nil) |