2012-03-10 Richard Stallman <rms@gnu.org>
+ * mail/rmail.el (rmail-buffers-swapped-p): Don't assume dead
+ view buffer means not swapped.
+ (rmail-view-buffer-kill-buffer-hook): Give buf name in error msg.
+ (rmail-write-region-annotate): Error if real text has disappeared.
+
* epa-mail.el (epa-mail-encrypt): Bind inhibit-read-only.
2012-03-10 Chong Yidong <cyd@gnu.org>
(defun rmail-buffers-swapped-p ()
"Return non-nil if the message collection is in `rmail-view-buffer'."
;; This is analogous to tar-data-swapped-p in tar-mode.el.
- (and (buffer-live-p rmail-view-buffer)
- rmail-buffer-swapped))
+ rmail-buffer-swapped)
(defun rmail-change-major-mode-hook ()
;; Bring the actual Rmail messages back into the main buffer.
(kill-buffer rmail-view-buffer))))
(defun rmail-view-buffer-kill-buffer-hook ()
- (error "Can't kill message view buffer by itself"))
+ (error "Can't kill Rmail view buffer `%s' by itself"
+ (buffer-name (current-buffer))))
;; Set up the permanent locals associated with an Rmail file.
(defun rmail-perm-variables ()
;; Used in `write-region-annotate-functions' to write rmail files.
(defun rmail-write-region-annotate (start end)
- (when (and (null start) (rmail-buffers-swapped-p))
+ (when (and (null start) rmail-buffer-swapped)
+ (unless (buffer-live-p rmail-view-buffer)
+ (error "Buffer `%s' with real text of `%s' has disappeared"
+ (buffer-name rmail-view-buffer)
+ (buffer-name (current-buffer))))
(setq rmail-message-encoding buffer-file-coding-system)
(set-buffer rmail-view-buffer)
(widen)