Enable display mode of MIME message in rmail.
This commit is contained in:
parent
e1a235757a
commit
186f7f0b7f
4 changed files with 876 additions and 299 deletions
21
etc/NEWS
21
etc/NEWS
|
@ -72,6 +72,27 @@ Bazaar recognizes the headers "Author", "Date" and "Fixes".
|
|||
Git, Mercurial, and Monotone recognize "Author" and "Date".
|
||||
Any unknown header is left as is in the message, so it is not lost.
|
||||
|
||||
** Rmail
|
||||
|
||||
** The default value of `rmail-enable-mime' is now t. Rmail decodes
|
||||
MIME contents automatically. You can customize the variable
|
||||
`rmail-enable-mime' back to `nil' to disable this automatic MIME
|
||||
decoding.
|
||||
|
||||
** The command `rmail-mime' change the displaying of a MIME message
|
||||
between decoded presentation form and raw data if `rmail-enable-mime'
|
||||
is non-nil. And, with prefix argument, it change only the displaying
|
||||
of the MIME entity at point.
|
||||
|
||||
** The new command TAB (rmail-mime-next-item) moves point to the next
|
||||
item of MIME message.
|
||||
|
||||
** The new command backtab (rmail-mime-previous-item) moves point to
|
||||
the previous item of MIME message.
|
||||
|
||||
** The new command RET (rmail-mime-toggle-hidden) hide or show the
|
||||
body of the MIME entity at point.
|
||||
|
||||
** Obsolete packages
|
||||
|
||||
+++
|
||||
|
|
|
@ -1,3 +1,46 @@
|
|||
2010-12-24 Kenichi Handa <handa@m17n.org>
|
||||
|
||||
* mail/rmailmm.el: New key bindings for rmail-mime-next-item,
|
||||
rmail-mime-previous-item, and rmail-mime-toggle-hidden.
|
||||
(rmail-mime-mbox-buffer)
|
||||
(rmail-mime-view-buffer, rmail-mime-coding-system): New variables.
|
||||
(rmail-mime-entity): Argument changed. All codes handling an
|
||||
entity object are changed.
|
||||
(rmail-mime-entity-header, rmail-mime-entity-body): Adjusted for
|
||||
the above change.
|
||||
(rmail-mime-entity-children, rmail-mime-entity-handler)
|
||||
(rmail-mime-entity-tagline): New functions.
|
||||
(rmail-mime-message-p): New function.
|
||||
(rmail-mime-save): Bind rmail-mime-mbox-buffer.
|
||||
(rmail-mime-entity-segment, rmail-mime-next-item)
|
||||
(rmail-mime-previous-item, rmail-mime-shown-mode)
|
||||
(rmail-mime-hidden-mode, rmail-mime-raw-mode)
|
||||
(rmail-mime-toggle-raw, rmail-mime-toggle-hidden)
|
||||
(rmail-mime-insert-tagline, rmail-mime-insert-header): New
|
||||
functions.
|
||||
(rmail-mime-text-handler): Call rmail-mime-insert-text.
|
||||
(rmail-mime-insert-decoded-text): New function.
|
||||
(rmail-mime-insert-text): Call rmail-mime-insert-decoded-text.
|
||||
(rmail-mime-insert-image): Argument changed. Caller changed.
|
||||
(rmail-mime-image): Call rmail-mime-toggle-hidden.
|
||||
(rmail-mime-set-bulk-data): New funciton.
|
||||
(rmail-mime-insert-bulk): Argument changed.
|
||||
(rmail-mime-multipart-handler): Return t.
|
||||
(rmail-mime-process-multipart): Argument changed. Handle
|
||||
"multipart/alternative" here.
|
||||
(rmail-mime-process): Argument changed.
|
||||
(rmail-mime-parse): Bind rmail-mime-mbox-buffer.
|
||||
(rmail-mime-insert): Argument changed. Handle raw display mode.
|
||||
(rmail-mime): Argument changed. Handle toggling of raw display
|
||||
mode.
|
||||
(rmail-show-mime): Bind rmail-mime-mbox-buffer and
|
||||
rmail-mime-view-buffer.
|
||||
(rmail-insert-mime-forwarded-message): Likewise.
|
||||
(rmail-search-mime-message): Likewise. Don't bind rmail-buffer.
|
||||
|
||||
* mail/rmail.el (rmail-show-message-1): If rmail-enable-mime is
|
||||
non-nil, handle the header in rmail-show-mime-function.
|
||||
|
||||
2010-12-20 Leo <sdl.web@gmail.com>
|
||||
|
||||
* help-fns.el (describe-variable): Fix 2010-12-17 change.
|
||||
|
|
|
@ -2691,75 +2691,72 @@ 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)
|
||||
(save-excursion
|
||||
(if (re-search-forward "^X-Coding-System: *\\(.*\\)$" nil t)
|
||||
(setq coding-system (intern (match-string 1)))
|
||||
(setq coding-system (rmail-get-coding-system))))
|
||||
(setq character-coding (mail-fetch-field "content-transfer-encoding")
|
||||
is-text-message (rmail-is-text-p))
|
||||
(if character-coding
|
||||
(setq character-coding (downcase character-coding)))
|
||||
(narrow-to-region beg end)
|
||||
;; Decode the message body into an empty view buffer using a
|
||||
;; unibyte temporary buffer where the character decoding takes
|
||||
;; place.
|
||||
(with-current-buffer rmail-view-buffer
|
||||
(erase-buffer))
|
||||
(if (null character-coding)
|
||||
;; Do it directly since that is fast.
|
||||
(rmail-decode-region body-start end coding-system view-buf)
|
||||
;; Can this be done directly, skipping the temp buffer?
|
||||
(with-temp-buffer
|
||||
(set-buffer-multibyte nil)
|
||||
(insert-buffer-substring mbox-buf body-start end)
|
||||
(cond
|
||||
((string= character-coding "quoted-printable")
|
||||
;; See bug#5441.
|
||||
(or (mail-unquote-printable-region (point-min) (point-max)
|
||||
nil t 'unibyte)
|
||||
(message "Malformed MIME quoted-printable message")))
|
||||
((and (string= character-coding "base64") is-text-message)
|
||||
(condition-case err
|
||||
(base64-decode-region (point-min) (point-max))
|
||||
(error (message "%s" (cdr err)))))
|
||||
((eq character-coding 'uuencode)
|
||||
(error "uuencoded messages are not supported yet"))
|
||||
(t))
|
||||
(rmail-decode-region (point-min) (point-max)
|
||||
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)
|
||||
(beginning-of-line)
|
||||
(delete-char 1)
|
||||
(forward-line))
|
||||
(goto-char (point-min)))
|
||||
;; Copy the headers to the front of the message view buffer.
|
||||
(rmail-copy-headers beg end)
|
||||
;; Add the separator (blank line) between headers and body;
|
||||
(set (make-local-variable 'rmail-header-style) header-style))
|
||||
(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)
|
||||
(save-excursion
|
||||
(if (re-search-forward "^X-Coding-System: *\\(.*\\)$" nil t)
|
||||
(setq coding-system (intern (match-string 1)))
|
||||
(setq coding-system (rmail-get-coding-system))))
|
||||
(setq character-coding (mail-fetch-field "content-transfer-encoding")
|
||||
is-text-message (rmail-is-text-p))
|
||||
(if character-coding
|
||||
(setq character-coding (downcase character-coding)))
|
||||
(narrow-to-region beg end)
|
||||
;; Decode the message body into an empty view buffer using a
|
||||
;; unibyte temporary buffer where the character decoding takes
|
||||
;; place.
|
||||
(with-current-buffer rmail-view-buffer
|
||||
(erase-buffer))
|
||||
(if (null character-coding)
|
||||
;; Do it directly since that is fast.
|
||||
(rmail-decode-region body-start end coding-system view-buf)
|
||||
;; Can this be done directly, skipping the temp buffer?
|
||||
(with-temp-buffer
|
||||
(set-buffer-multibyte nil)
|
||||
(insert-buffer-substring mbox-buf body-start end)
|
||||
(cond
|
||||
((string= character-coding "quoted-printable")
|
||||
;; See bug#5441.
|
||||
(or (mail-unquote-printable-region (point-min) (point-max)
|
||||
nil t 'unibyte)
|
||||
(message "Malformed MIME quoted-printable message")))
|
||||
((and (string= character-coding "base64") is-text-message)
|
||||
(condition-case err
|
||||
(base64-decode-region (point-min) (point-max))
|
||||
(error (message "%s" (cdr err)))))
|
||||
((eq character-coding 'uuencode)
|
||||
(error "uuencoded messages are not supported yet"))
|
||||
(t))
|
||||
(rmail-decode-region (point-min) (point-max)
|
||||
coding-system view-buf)))
|
||||
(with-current-buffer rmail-view-buffer
|
||||
;; Prepare the separator (blank line) before the body.
|
||||
(goto-char (point-min))
|
||||
(insert "\n")
|
||||
;; Unquote quoted From lines
|
||||
(while (re-search-forward "^>+From " nil t)
|
||||
(beginning-of-line)
|
||||
(delete-char 1)
|
||||
(forward-line))
|
||||
(goto-char (point-min)))
|
||||
;; Copy the headers to the front of the message view buffer.
|
||||
(rmail-copy-headers beg end))
|
||||
;; highlight the message, activate any URL like text and add
|
||||
;; special highlighting for and quoted material.
|
||||
(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)
|
||||
|
@ -4290,18 +4287,28 @@ With prefix argument N moves forward N messages with these labels.
|
|||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "222ca7c1e672a08e5799e5a72fb25049")
|
||||
;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "faa9e26c7781c426785e671a040128ad")
|
||||
;;; Generated autoloads from rmailmm.el
|
||||
|
||||
(autoload 'rmail-mime "rmailmm" "\
|
||||
Process the current Rmail message as a MIME message.
|
||||
This creates a temporary \"*RMAIL*\" buffer holding a decoded
|
||||
copy of the message. Inline content-types are handled according to
|
||||
Toggle displaying of a MIME message.
|
||||
|
||||
The actualy behavior depends on the value of `rmail-enable-mime'.
|
||||
|
||||
If `rmail-enable-mime' is t (default), this command change the
|
||||
displaying of a MIME message between decoded presentation form
|
||||
and raw data.
|
||||
|
||||
With ARG, toggle the displaying of the current MIME entity only.
|
||||
|
||||
If `rmail-enable-mime' is nil, this creates a temporary
|
||||
\"*RMAIL*\" buffer holding a decoded copy of the message. Inline
|
||||
content-types are handled according to
|
||||
`rmail-mime-media-type-handlers-alist'. By default, this
|
||||
displays text and multipart messages, and offers to download
|
||||
attachments as specfied by `rmail-mime-attachment-dirs-alist'.
|
||||
|
||||
\(fn)" t nil)
|
||||
\(fn &optional ARG)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue