summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/mail/rmail.el45
2 files changed, 39 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1fed7553fa9..1e95f3c7c71 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
2001-05-17 Gerd Moellmann <gerd@gnu.org>
+ * mail/rmail.el (rmail-require-mime-maybe): New function.
+ (rmail): Use it.
+ (rmail-mode): Handle the case of finding Rmail files.
+
* emacs-lisp/elp.el (elp-instrument-function): Handle advised
functions.
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index aae9af2bcaf..d6a8f5868f5 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -574,8 +574,25 @@ The first parenthesized expression should match the MIME-charset name.")
;;;; *** Rmail Mode ***
+;; This variable is dynamically bound. The defvar is here to placate
+;; the byte compiler.
+
(defvar rmail-enable-multibyte nil)
+
+(defun rmail-require-mime-maybe ()
+ "Require `rmail-mime-feature' if that is non-nil.
+Signal an error and set `rmail-mime-feature' to nil if the feature
+isn't provided."
+ (when rmail-enable-mime
+ (condition-case err
+ (require rmail-mime-feature)
+ (error
+ (message "Feature `%s' not provided" rmail-mime-feature)
+ (sit-for 1)
+ (setq rmail-enable-mime nil)))))
+
+
;;;###autoload
(defun rmail (&optional file-name-arg)
"Read and edit incoming mail.
@@ -591,12 +608,7 @@ have a chance to specify a file name with the minibuffer.
If `rmail-display-summary' is non-nil, make a summary for this RMAIL file."
(interactive (if current-prefix-arg
(list (read-file-name "Run rmail on RMAIL file: "))))
- (if rmail-enable-mime
- (condition-case err
- (require rmail-mime-feature)
- (error (message "Feature `%s' not provided" rmail-mime-feature)
- (sit-for 1)
- (setq rmail-enable-mime nil))))
+ (rmail-require-mime-maybe)
(let* ((file-name (expand-file-name (or file-name-arg rmail-file-name)))
(existed (get-file-buffer file-name))
;; This binding is necessary because we much decide if we
@@ -993,10 +1005,23 @@ Instead, these commands are available:
\\[rmail-summary-by-topic] Summarize only messages with subject line regexp(s).
\\[rmail-toggle-header] Toggle display of complete header."
(interactive)
- (rmail-mode-2)
- (rmail-set-message-counters)
- (rmail-show-message rmail-total-messages)
- (run-hooks 'rmail-mode-hook))
+ (let ((finding-rmail-file (not (eq major-mode 'rmail-mode))))
+ (rmail-mode-2)
+ (when (and finding-rmail-file
+ (null coding-system-for-read)
+ default-enable-multibyte-characters)
+ (let ((rmail-enable-multibyte t))
+ (rmail-require-mime-maybe)
+ (rmail-convert-file)
+ (goto-char (point-max))
+ (set-buffer-multibyte t)))
+ (rmail-set-message-counters)
+ (rmail-show-message rmail-total-messages)
+ (when finding-rmail-file
+ (when rmail-display-summary
+ (rmail-summary))
+ (rmail-construct-io-menu))
+ (run-hooks 'rmail-mode-hook)))
(defun rmail-mode-2 ()
(kill-all-local-variables)