summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-02-06 06:57:40 +0000
committerRichard M. Stallman <rms@gnu.org>1998-02-06 06:57:40 +0000
commit2f1ed8ff2fe1ad55f5ce99a4499ae06786edd779 (patch)
treed151edee15054c7a3356205c36138ddd684cebf9
parentad0c9182374e1b2e44b34ba0748975dbfe38b2c8 (diff)
downloademacs-2f1ed8ff2fe1ad55f5ce99a4499ae06786edd779.tar.gz
(rmail-clear-headers): Handle the last header in a message correctly.
-rw-r--r--lisp/mail/rmail.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index febdd3ce587..0371837b6a2 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1636,16 +1636,18 @@ Otherwise, delete all header fields whose names match `rmail-ignored-headers'."
(if (and rmail-displayed-headers (null ignored-headers))
(save-restriction
(narrow-to-region (point-min) (point))
- (let (lim)
+ (let (lim next)
(goto-char (point-min))
- (while (save-excursion
- (re-search-forward "\n[^ \t]")
- (and (not (eobp))
- (setq lim (1- (point)))))
+ (while (and (not (eobp))
+ (save-excursion
+ (if (re-search-forward "\n[^ \t]" nil t)
+ (setq lim (match-beginning 0)
+ next (1+ lim))
+ (setq lim nil next (point-max)))))
(if (save-excursion
(re-search-forward rmail-displayed-headers lim t))
- (goto-char lim)
- (delete-region (point) lim))))
+ (goto-char next)
+ (delete-region (point) next))))
(goto-char (point-min)))
(or ignored-headers (setq ignored-headers rmail-ignored-headers))
(save-restriction