changeset 88196:a71ec02fb6d3

(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.
author Alex Schroeder <alex@gnu.org>
date Tue, 17 Jan 2006 23:05:56 +0000
parents e51e186c9e33
children d76320495b1b
files lisp/mail/rmail.el
diffstat 1 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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;