From: Alex Schroeder Date: Tue, 17 Jan 2006 23:06:58 +0000 (+0000) Subject: (rmail): Only insert the file if it actually exists. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=26f2b4d7cd9d03a790e90d6f2476c85dbeb6be48;p=emacs.git (rmail): Only insert the file if it actually exists. (rmail-show-message): Do not display labels if there are no messages. This corrects the mistake if visiting an empty file, but it doesn't fix the situation where you delete the all messages and expunge them. This may leave the labels of the last message in the modeline. --- diff --git a/lisp/mail/ChangeLog b/lisp/mail/ChangeLog index 63989e11971..b5192e781c5 100644 --- a/lisp/mail/ChangeLog +++ b/lisp/mail/ChangeLog @@ -1,3 +1,12 @@ +2006-01-18 Alex Schroeder + + * rmail.el (rmail): Only insert the file if it actually exists. + (rmail-show-message): Do not display labels if there are no + messages. This corrects the mistake if visiting an empty file, + but it doesn't fix the situation where you delete the all messages + and expunge them. This may leave the labels of the last message + in the modeline. + 2006-01-17 Henrik Enberg * rmailkwd.el: Don't require rmail. diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index dea879addb1..61ee8cbf037 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -797,7 +797,8 @@ If `rmail-display-summary' is non-nil, make a summary for this RMAIL file." (setq major-mode 'fundamental-mode)) (switch-to-buffer (get-buffer-create (file-name-nondirectory file-name))) - (insert-file-contents-literally file-name) + (when (file-exists-p file-name) + (insert-file-contents-literally file-name)) (setq buffer-file-name file-name)) ;; As we have read a file as raw-text, the buffer is set to ;; unibyte. We must make it multibyte if necessary. @@ -2102,20 +2103,11 @@ If NO-SUMMARY is non-nil, then do not update the summary buffer." (interactive "p") (or (eq major-mode 'rmail-mode) (switch-to-buffer rmail-buffer)) - - ;; If there are no messages to display, then provide a message to - ;; indicate thusly. (if (zerop rmail-total-messages) - - ;; There are no messages so display the Babyl boilerplate in the - ;; presentation buffer. It is important to keep the boilerplate - ;; out of the Rmail file so as not to break other mail agents. (progn (message "No messages to show. Add something better soon.") - (rmail-display-labels) + ;; (rmail-display-labels) (force-mode-line-update)) - - ;; There are messages. Show one. (let (blurb coding-system) ;; Set n to the first sane message based on the sign of n: ;; positive but greater than the total number of messages -> n;