From 7347faa822b5ea177df5b2ed7a2b7d79194f0bcc Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Wed, 25 Jan 2006 06:47:24 +0000 Subject: [PATCH] Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14 Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 4-7) - Update from CVS --- lisp/gnus/ChangeLog | 38 +++++++++++++++++++++++ lisp/gnus/gnus-art.el | 21 +++++++------ lisp/gnus/mailcap.el | 7 ++++- lisp/gnus/mm-uu.el | 45 ++++++++++++++++++---------- lisp/gnus/mm-view.el | 70 ++++++++++++++++++++++++++++++------------- lisp/gnus/mml.el | 19 +++++++++--- 6 files changed, 150 insertions(+), 50 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index fb99c71c9c8..fbbf7281b69 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,41 @@ +2006-01-25 Katsumi Yamaoka + + * mm-uu.el (mm-uu-dissect-text-parts): Ignore it if a given part + is dissected into a single part of which the type is the same as + the given one. + +2006-01-21 Kevin Ryde + + * mailcap.el (mailcap-parse-mailcap-extras): "test" key must go + into alists as symbol not string, since that's what + mailcap-viewer-passes-test and mailcap-mailcap-entry-passes-test + look for. + +2006-01-24 Katsumi Yamaoka + + * mm-uu.el (mm-uu-dissect-text-parts): Reduce the number of + recursive calls. + +2006-01-24 Katsumi Yamaoka + + * mm-view.el (mm-w3m-standalone-supports-m17n-p): New variable. + (mm-w3m-standalone-supports-m17n-p): New function. + (mm-inline-text-html-render-with-w3m-standalone): Use it to alter + w3m usage. + + * gnus-art.el (gnus-article-wash-html-with-w3m-standalone): Use + mm-w3m-standalone-supports-m17n-p to alter w3m usage. + +2006-01-23 Katsumi Yamaoka + + * mm-uu.el (mm-uu-dissect-text-parts): Decode content transfer + encoding. + +2006-01-20 Reiner Steib + + * mml.el (mml-attach-file): Describe `description' in doc string. + (mml-menu): Add Emacs MIME manual and PGG manual. + 2006-01-19 Reiner Steib * spam.el (spam-group-ham-mark-p, spam-group-spam-mark-p) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 92a4f09ded3..b51ceff29a9 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2541,15 +2541,18 @@ charset defined in `gnus-summary-show-article-charset-alist' is used." (defun gnus-article-wash-html-with-w3m-standalone () "Wash the current buffer with w3m." - (unless (mm-coding-system-p charset) - ;; The default. - (setq charset 'iso-8859-1)) - (let ((coding-system-for-write charset) - (coding-system-for-read charset)) - (call-process-region - (point-min) (point-max) - "w3m" t t nil "-dump" "-T" "text/html" - "-I" (symbol-name charset) "-O" (symbol-name charset)))) + (if (mm-w3m-standalone-supports-m17n-p) + (progn + (unless (mm-coding-system-p charset) ;; Bound by `article-wash-html'. + ;; The default. + (setq charset 'iso-8859-1)) + (let ((coding-system-for-write charset) + (coding-system-for-read charset)) + (call-process-region + (point-min) (point-max) + "w3m" t t nil "-dump" "-T" "text/html" + "-I" (symbol-name charset) "-O" (symbol-name charset)))) + (mm-inline-wash-with-stdin nil "w3m" "-dump" "-T" "text/html"))) (defun article-hide-list-identifiers () "Remove list identifies from the Subject header. diff --git a/lisp/gnus/mailcap.el b/lisp/gnus/mailcap.el index 166edb60f7a..80153645819 100644 --- a/lisp/gnus/mailcap.el +++ b/lisp/gnus/mailcap.el @@ -528,7 +528,12 @@ MAILCAPS if set; otherwise (on Unix) use the path from RFC 1524, plus (skip-chars-forward ";")) (setq done t)))) (setq value (buffer-substring val-pos (point)))) - (setq results (cons (cons name value) results)) + ;; `test' as symbol, others like "copiousoutput" and "needsx11" as + ;; strings + (setq results (cons (cons (if (string-equal name "test") + 'test + name) + value) results)) (skip-chars-forward " \";\n\t")) results))) diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el index 2bebede4bfc..fa36582af01 100644 --- a/lisp/gnus/mm-uu.el +++ b/lisp/gnus/mm-uu.el @@ -511,25 +511,40 @@ value of `mm-uu-text-plain-type'." (defun mm-uu-dissect-text-parts (handle) "Dissect text parts and put uu handles into HANDLE." - (let ((buffer (mm-handle-buffer handle)) - (case-fold-search t) - type children) + (let ((buffer (mm-handle-buffer handle))) (cond ((stringp buffer) (dolist (elem (cdr handle)) (mm-uu-dissect-text-parts elem))) ((bufferp buffer) - (when (and (setq type (mm-handle-media-type handle)) - (stringp type) - ;; Mutt still uses application/pgp even though - ;; it has already been withdrawn. - (string-match "\\`text/\\|\\`application/pgp\\'" type) - (with-current-buffer buffer - (setq children - (mm-uu-dissect t (mm-handle-type handle))))) - (kill-buffer buffer) - (setcar handle (car children)) - (setcdr handle (cdr children)) - (mm-uu-dissect-text-parts handle))) + (let ((type (mm-handle-media-type handle)) + (case-fold-search t) ;; string-match + encoding children) + (when (and + (stringp type) + ;; Mutt still uses application/pgp even though + ;; it has already been withdrawn. + (string-match "\\`text/\\|\\`application/pgp\\'" type) + (setq children + (with-current-buffer buffer + (if (setq encoding (mm-handle-encoding handle)) + ;; Inherit the multibyteness of the `buffer'. + (with-temp-buffer + (insert-buffer-substring buffer) + (mm-decode-content-transfer-encoding + encoding type) + (mm-uu-dissect t (mm-handle-type handle))) + (mm-uu-dissect t (mm-handle-type handle)))))) + ;; Ignore it if a given part is dissected into a single + ;; part of which the type is the same as the given one. + (if (and (<= (length children) 2) + (string-equal (mm-handle-media-type (cadr children)) + type)) + (kill-buffer (mm-handle-buffer (cadr children))) + (kill-buffer buffer) + (setcdr handle (cdr children)) + (setcar handle (car children)) ;; "multipart/mixed" + (dolist (elem (cdr children)) + (mm-uu-dissect-text-parts elem)))))) (t (dolist (elem handle) (mm-uu-dissect-text-parts elem)))))) diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index 645e960b535..73cab0a5676 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -262,29 +262,57 @@ (delete-region ,(point-min-marker) ,(point-max-marker))))))))) +(defvar mm-w3m-standalone-supports-m17n-p (if (featurep 'mule) 'undecided) + "*T means the w3m command supports the m17n feature.") + +(defun mm-w3m-standalone-supports-m17n-p () + "Say whether the w3m command supports the m17n feature." + (cond ((eq mm-w3m-standalone-supports-m17n-p t) t) + ((eq mm-w3m-standalone-supports-m17n-p nil) nil) + ((not (featurep 'mule)) (setq mm-w3m-standalone-supports-m17n-p nil)) + ((condition-case nil + (let ((coding-system-for-write 'iso-2022-jp) + (coding-system-for-read 'iso-2022-jp) + (str (mm-decode-coding-string "\ +\e$B#D#o#e#s!!#w#3#m!!#s#u#p#p#o#r#t#s!!#m#1#7#n!)\e(B" 'iso-2022-jp))) + (mm-with-multibyte-buffer + (insert str) + (call-process-region + (point-min) (point-max) "w3m" t t nil "-dump" + "-T" "text/html" "-I" "iso-2022-jp" "-O" "iso-2022-jp") + (goto-char (point-min)) + (search-forward str nil t))) + (error nil)) + (setq mm-w3m-standalone-supports-m17n-p t)) + (t + ;;(message "You had better upgrade your w3m command") + (setq mm-w3m-standalone-supports-m17n-p nil)))) + (defun mm-inline-text-html-render-with-w3m-standalone (handle) "Render a text/html part using w3m." - (let ((source (mm-get-part handle)) - (charset (mail-content-type-get (mm-handle-type handle) 'charset)) - cs) - (unless (and charset - (setq cs (mm-charset-to-coding-system charset)) - (not (eq cs 'ascii))) - ;; The default. - (setq charset "iso-8859-1" - cs 'iso-8859-1)) - (mm-insert-inline - handle - (mm-with-unibyte-buffer - (insert source) - (mm-enable-multibyte) - (let ((coding-system-for-write 'binary) - (coding-system-for-read cs)) - (call-process-region - (point-min) (point-max) - "w3m" t t nil "-dump" "-T" "text/html" - "-I" charset "-O" charset)) - (buffer-string))))) + (if (mm-w3m-standalone-supports-m17n-p) + (let ((source (mm-get-part handle)) + (charset (mail-content-type-get (mm-handle-type handle) 'charset)) + cs) + (unless (and charset + (setq cs (mm-charset-to-coding-system charset)) + (not (eq cs 'ascii))) + ;; The default. + (setq charset "iso-8859-1" + cs 'iso-8859-1)) + (mm-insert-inline + handle + (mm-with-unibyte-buffer + (insert source) + (mm-enable-multibyte) + (let ((coding-system-for-write 'binary) + (coding-system-for-read cs)) + (call-process-region + (point-min) (point-max) + "w3m" t t nil "-dump" "-T" "text/html" + "-I" charset "-O" charset)) + (buffer-string)))) + (mm-inline-render-with-stdin handle nil "w3m" "-dump" "-T" "text/html"))) (defun mm-links-remove-leading-blank () ;; Delete the annoying three spaces preceding each line of links diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 8b00313fb92..90f7c5f09dd 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -38,6 +38,7 @@ (autoload 'gnus-add-minor-mode "gnus-ems") (autoload 'gnus-make-local-hook "gnus-util") (autoload 'message-fetch-field "message") + (autoload 'message-info "message") (autoload 'fill-flowed-encode "flow-fill") (autoload 'message-posting-charset "message")) @@ -917,7 +918,14 @@ If HANDLES is non-nil, use it instead reparsing the buffer." ;;["Narrow" mml-narrow-to-part t] ["Quote MML" mml-quote-region t] ["Validate MML" mml-validate t] - ["Preview" mml-preview t])) + ["Preview" mml-preview t] + "----" + ["Emacs MIME manual" (lambda () (interactive) (message-info 4)) + ,@(if (featurep 'xemacs) '(t) + '(:help "Display the Emacs MIME manual"))] + ["PGG manual" (lambda () (interactive) (message-info 16)) + ,@(if (featurep 'xemacs) '(t) + '(:help "Display the PGG manual"))])) (defvar mml-mode nil "Minor mode for editing MML.") @@ -1036,9 +1044,12 @@ See Info node `(emacs-mime)Composing'. The file is not inserted or encoded until you send the message with `\\[message-send-and-exit]' or `\\[message-send]'. -FILE is the name of the file to attach. TYPE is its content-type, a -string of the form \"type/subtype\". DESCRIPTION is a one-line -description of the attachment." +FILE is the name of the file to attach. TYPE is its +content-type, a string of the form \"type/subtype\". DESCRIPTION +is a one-line description of the attachment. The DISPOSITION +specifies how the attachment is intended to be displayed. It can +be either \"inline\" (displayed automatically within the message +body) or \"attachment\" (separate from the body)." (interactive (let* ((file (mml-minibuffer-read-file "Attach file: ")) (type (mml-minibuffer-read-type file)) -- 2.39.2