diff options
author | Andrew Innes <[email protected]> | 1998-11-22 21:36:51 +0000 |
---|---|---|
committer | Andrew Innes <[email protected]> | 1998-11-22 21:36:51 +0000 |
commit | 582e5ff70c61921a8104265dca636f424b317f8e (patch) | |
tree | 72e46212489b345df0599f7fe5353c31021e68d4 /lisp/mail/rmail.el | |
parent | 4483ddc5a158c93887a621067f38e4d51884c934 (diff) |
(rmail-set-message-counters-counter): Detect messages that have been
added with DOS line endings and convert the line endings for such
messages.
Diffstat (limited to 'lisp/mail/rmail.el')
-rw-r--r-- | lisp/mail/rmail.el | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 419f0e21a1..eb0e39205a 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -2081,19 +2081,33 @@ change the invisible header text." (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." |