diff options
Diffstat (limited to 'lisp/mail/rmail.el')
-rw-r--r-- | lisp/mail/rmail.el | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 47e52f27aa1..a2629dfe1c7 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -39,6 +39,7 @@ ;; (require 'mail-utils) +(require 'rfc2047) (defconst rmail-attribute-header "X-RMAIL-ATTRIBUTES" "The header that stores the Rmail attribute data.") @@ -638,7 +639,7 @@ Element N specifies the summary line for message N+1.") This is set to nil by default.") -(defcustom rmail-enable-mime nil +(defcustom rmail-enable-mime t "If non-nil, RMAIL uses MIME features. If the value is t, RMAIL automatically shows MIME decoded message. If the value is neither t nor nil, RMAIL does not show MIME decoded message @@ -649,6 +650,7 @@ unless the feature specified by `rmail-mime-feature' is available." :type '(choice (const :tag "on" t) (const :tag "off" nil) (other :tag "when asked" ask)) + :version "23.3" :group 'rmail) (defvar rmail-enable-mime-composing nil @@ -693,13 +695,12 @@ start of the header) with three arguments MSG, REGEXP, and LIMIT, where MSG is the message number, REGEXP is the regular expression, LIMIT is the position specifying the end of header.") -(defvar rmail-mime-feature 'rmail-mime +(defvar rmail-mime-feature 'rmailmm "Feature to require to load MIME support in Rmail. When starting Rmail, if `rmail-enable-mime' is non-nil, this feature is required with `require'. -The default value is `rmail-mime'. This feature is provided by -the rmail-mime package available at <http://www.m17n.org/rmail-mime/>.") +The default value is `rmailmm'") ;; FIXME this is unused. (defvar rmail-decode-mime-charset t @@ -1509,17 +1510,9 @@ Hook `rmail-quit-hook' is run after expunging." (set-buffer-modified-p nil)) (replace-buffer-in-windows rmail-summary-buffer) (bury-buffer rmail-summary-buffer)) - (if rmail-enable-mime - (let ((obuf rmail-buffer) - (ovbuf rmail-view-buffer)) - (set-buffer rmail-view-buffer) - (quit-window) - (replace-buffer-in-windows ovbuf) - (replace-buffer-in-windows obuf) - (bury-buffer obuf)) - (let ((obuf (current-buffer))) - (quit-window) - (replace-buffer-in-windows obuf)))) + (let ((obuf (current-buffer))) + (quit-window) + (replace-buffer-in-windows obuf))) (defun rmail-bury () "Bury current Rmail buffer and its summary buffer." @@ -2219,15 +2212,7 @@ If nil, that means the current message." (let ((blurb (rmail-get-labels))) (setq mode-line-process (format " %d/%d%s" - rmail-current-message rmail-total-messages blurb)) - ;; If rmail-enable-mime is non-nil, we may have to update - ;; `mode-line-process' of rmail-view-buffer too. - (if (and rmail-enable-mime - (not (eq (current-buffer) rmail-view-buffer)) - (buffer-live-p rmail-view-buffer)) - (let ((mlp mode-line-process)) - (with-current-buffer rmail-view-buffer - (setq mode-line-process mlp)))))) + rmail-current-message rmail-total-messages blurb)))) (defun rmail-get-attr-value (attr state) "Return the character value for ATTR. @@ -2706,6 +2691,11 @@ The current mail message becomes the message displayed." (message "Showing message %d" msg)) (narrow-to-region beg end) (goto-char beg) + (if (and rmail-enable-mime + (re-search-forward "mime-version: 1.0" nil t)) + (let ((rmail-buffer mbox-buf) + (rmail-view-buffer view-buf)) + (funcall rmail-show-mime-function)) (setq body-start (search-forward "\n\n" nil t)) (narrow-to-region beg (point)) (goto-char beg) @@ -2722,11 +2712,6 @@ The current mail message becomes the message displayed." ;; unibyte temporary buffer where the character decoding takes ;; place. (with-current-buffer rmail-view-buffer - ;; We give the view buffer a buffer-local value of - ;; rmail-header-style based on the binding in effect when - ;; this function is called; `rmail-toggle-headers' can - ;; inspect this value to determine how to toggle. - (set (make-local-variable 'rmail-header-style) header-style) (erase-buffer)) (if (null character-coding) ;; Do it directly since that is fast. @@ -2749,8 +2734,13 @@ The current mail message becomes the message displayed." (error "uuencoded messages are not supported yet")) (t)) (rmail-decode-region (point-min) (point-max) - coding-system view-buf))) + coding-system view-buf)))) (with-current-buffer rmail-view-buffer + ;; We give the view buffer a buffer-local value of + ;; rmail-header-style based on the binding in effect when + ;; this function is called; `rmail-toggle-headers' can + ;; inspect this value to determine how to toggle. + (set (make-local-variable 'rmail-header-style) header-style) ;; Unquote quoted From lines (goto-char (point-min)) (while (re-search-forward "^>+From " nil t) @@ -2766,6 +2756,10 @@ The current mail message becomes the message displayed." (with-current-buffer rmail-view-buffer (insert "\n") (goto-char (point-min)) + ;; Decode the headers according to RFC2047. + (save-excursion + (search-forward "\n\n" nil 'move) + (rfc2047-decode-region (point-min) (point))) (rmail-highlight-headers) ;(rmail-activate-urls) ;(rmail-process-quoted-material) |