Merge from gnus--rel--5.10

Patches applied:

 * gnus--rel--5.10  (patch 216)

   - Update from CVS

2007-04-19  Katsumi Yamaoka  <yamaoka@jpl.org>

   * lisp/gnus/gnus-art.el (gnus-mime-strip-charset-parameters): New function.
   (gnus-mime-view-part-as-charset): Use it; redisplay subpart currently
   displayed of multipart/alternative part if it is invoked from summary
   buffer.
   (gnus-article-part-wrapper): Select article window.

   * lisp/gnus/mm-view.el (mm-inline-text-html-render-with-w3m)
   (mm-inline-text-html-render-with-w3m-standalone)
   (mm-inline-render-with-function): Use mail-parse-charset by default.

Revision: emacs@sv.gnu.org/emacs--devo--0--patch-706
This commit is contained in:
Miles Bader 2007-04-19 12:08:53 +00:00
parent 5a21998376
commit 6b554e8869
3 changed files with 69 additions and 22 deletions

View file

@ -1,3 +1,15 @@
2007-04-19 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (gnus-mime-strip-charset-parameters): New function.
(gnus-mime-view-part-as-charset): Use it; redisplay subpart currently
displayed of multipart/alternative part if it is invoked from summary
buffer.
(gnus-article-part-wrapper): Select article window.
* mm-view.el (mm-inline-text-html-render-with-w3m)
(mm-inline-text-html-render-with-w3m-standalone)
(mm-inline-render-with-function): Use mail-parse-charset by default.
2007-04-10 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-msg.el (gnus-inews-yank-articles): Use

View file

@ -4606,6 +4606,21 @@ are decompressed."
(mm-string-to-multibyte contents)))
(goto-char b)))))
(defun gnus-mime-strip-charset-parameters (handle)
"Strip charset parameters from HANDLE."
(if (stringp (car handle))
(mapc #'gnus-mime-strip-charset-parameters (cdr handle))
(let* ((type (mm-handle-type (if (equal (mm-handle-media-type handle)
"message/external-body")
(progn
(unless (mm-handle-cache handle)
(mm-extern-cache-contents handle))
(mm-handle-cache handle))
handle)))
(charset (assq 'charset (cdr type))))
(when charset
(delq charset type)))))
(defun gnus-mime-view-part-as-charset (&optional handle arg)
"Insert the MIME part under point into the current buffer using the
specified charset."
@ -4614,7 +4629,7 @@ specified charset."
(let ((handle (or handle (get-text-property (point) 'gnus-data)))
(fun (get-text-property (point) 'gnus-callback))
(gnus-newsgroup-ignored-charsets 'gnus-all)
gnus-newsgroup-charset type charset)
gnus-newsgroup-charset form preferred parts)
(when handle
(if (mm-handle-undisplayer handle)
(mm-remove-part handle))
@ -4622,17 +4637,24 @@ specified charset."
(setq gnus-newsgroup-charset
(or (cdr (assq arg gnus-summary-show-article-charset-alist))
(mm-read-coding-system "Charset: ")))
;; Strip the charset parameter from `handle'.
(setq type (mm-handle-type
(if (equal (mm-handle-media-type handle)
"message/external-body")
(progn
(unless (mm-handle-cache handle)
(mm-extern-cache-contents handle))
(mm-handle-cache handle))
handle))
charset (assq 'charset (cdr type)))
(delq charset type)
(gnus-mime-strip-charset-parameters handle)
(when (and (consp (setq form (cdr-safe fun)))
(setq form (ignore-errors
(assq 'gnus-mime-display-alternative form)))
(setq preferred (caddr form))
(progn
(when (eq (car preferred) 'quote)
(setq preferred (cadr preferred)))
(not (equal preferred
(get-text-property (point) 'gnus-data))))
(setq parts (get-text-property (point) 'gnus-part))
(setq parts (cdr (assq parts
gnus-article-mime-handle-alist)))
(equal (mm-handle-media-type parts) "multipart/alternative")
(setq parts (reverse (cdr parts))))
(setcar (cddr form)
(list 'quote (or (cadr (member preferred parts))
(car parts)))))
(funcall fun handle)))))
(defun gnus-mime-view-part-externally (&optional handle)
@ -4688,13 +4710,22 @@ If no internal viewer is available, use an external viewer."
(funcall (cdr action-pair)))))
(defun gnus-article-part-wrapper (n function)
(save-current-buffer
(set-buffer gnus-article-buffer)
(when (> n (length gnus-article-mime-handle-alist))
(error "No such part"))
(gnus-article-goto-part n)
(let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
(funcall function handle))))
(let ((window (get-buffer-window gnus-article-buffer 'visible))
frame)
(when window
;; It is necessary to select the article window so that
;; `gnus-article-goto-part' may really move the point.
(setq frame (selected-frame))
(gnus-select-frame-set-input-focus (window-frame window))
(unwind-protect
(save-window-excursion
(select-window window)
(when (> n (length gnus-article-mime-handle-alist))
(error "No such part"))
(gnus-article-goto-part n)
(let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
(funcall function handle)))
(gnus-select-frame-set-input-focus frame)))))
(defun gnus-article-pipe-part (n)
"Pipe MIME part N, which is the numerical prefix."

View file

@ -238,7 +238,8 @@
(mm-setup-w3m)
(let ((text (mm-get-part handle))
(b (point))
(charset (mail-content-type-get (mm-handle-type handle) 'charset)))
(charset (or (mail-content-type-get (mm-handle-type handle) 'charset)
mail-parse-charset)))
(save-excursion
(insert (if charset (mm-decode-string text charset) text))
(save-restriction
@ -302,7 +303,9 @@
"Render a text/html part using w3m."
(if (mm-w3m-standalone-supports-m17n-p)
(let ((source (mm-get-part handle))
(charset (mail-content-type-get (mm-handle-type handle) 'charset))
(charset (or (mail-content-type-get (mm-handle-type handle)
'charset)
(symbol-name mail-parse-charset)))
cs)
(unless (and charset
(setq cs (mm-charset-to-coding-system charset))
@ -368,7 +371,8 @@
(defun mm-inline-render-with-function (handle func &rest args)
(let ((source (mm-get-part handle))
(charset (mail-content-type-get (mm-handle-type handle) 'charset)))
(charset (or (mail-content-type-get (mm-handle-type handle) 'charset)
mail-parse-charset)))
(mm-insert-inline
handle
(mm-with-multibyte-buffer