Mercurial > emacs
changeset 23750:15450ece2f24
(rmail-set-message-counters-counter): Detect messages that have been
added with DOS line endings and convert the line endings for such
messages.
author | Andrew Innes <andrewi@gnu.org> |
---|---|
date | Sun, 22 Nov 1998 21:36:51 +0000 |
parents | ea095fa15fb9 |
children | 3fdde7281f9b |
files | lisp/mail/rmail.el |
diffstat | 1 files changed, 27 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/mail/rmail.el Sun Nov 22 17:31:55 1998 +0000 +++ b/lisp/mail/rmail.el Sun Nov 22 21:36:51 1998 +0000 @@ -2081,19 +2081,33 @@ (message "Counting messages...done"))))) (defun rmail-set-message-counters-counter (&optional stop) - (while (search-backward "\n\^_\^L\n" stop t) - (forward-char 1) - (setq messages-head (cons (point-marker) messages-head)) - (save-excursion - (setq deleted-head - (cons (if (search-backward ", deleted," - (prog1 (point) - (forward-line 2)) - t) - ?D ?\ ) - deleted-head))) - (if (zerop (% (setq total-messages (1+ total-messages)) 20)) - (message "Counting messages...%d" total-messages)))) + (let ((start (point)) + next) + (while (search-backward "\n\^_\^L" stop t) + ;; Detect messages that have been added with DOS line endings and + ;; convert the line endings for such messages. + (setq next (point)) + (if (looking-at "\n\^_\^L\r\n") + (let ((buffer-read-only nil) + (buffer-undo t)) + (message "Counting messages...(converting line endings)") + (save-excursion + (goto-char start) + (while (search-backward "\r\n" next t) + (delete-char 1))))) + (setq start next) + (forward-char 1) + (setq messages-head (cons (point-marker) messages-head)) + (save-excursion + (setq deleted-head + (cons (if (search-backward ", deleted," + (prog1 (point) + (forward-line 2)) + t) + ?D ?\ ) + deleted-head))) + (if (zerop (% (setq total-messages (1+ total-messages)) 20)) + (message "Counting messages...%d" total-messages))))) (defun rmail-beginning-of-message () "Show current message starting from the beginning."