# HG changeset patch # User Alex Schroeder # Date 1137539156 0 # Node ID a71ec02fb6d378ebeed5ffc1dc910c61250b6105 # Parent e51e186c9e33de03a20f7e3cbe22e95146e4e401 (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 -r e51e186c9e33 -r a71ec02fb6d3 lisp/mail/rmail.el --- a/lisp/mail/rmail.el Tue Jan 17 22:31:55 2006 +0000 +++ b/lisp/mail/rmail.el Tue Jan 17 23:05:56 2006 +0000 @@ -797,7 +797,8 @@ (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 @@ (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;