changeset 68380:e1843613ecb8

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
author Miles Bader <miles@gnu.org>
date Wed, 25 Jan 2006 06:47:24 +0000
parents 311328d6ca44
children 2ed18bf835e1 5b7d410e31f9
files lisp/gnus/ChangeLog lisp/gnus/gnus-art.el lisp/gnus/mailcap.el lisp/gnus/mm-uu.el lisp/gnus/mm-view.el lisp/gnus/mml.el
diffstat 6 files changed, 150 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Wed Jan 25 04:11:05 2006 +0000
+++ b/lisp/gnus/ChangeLog	Wed Jan 25 06:47:24 2006 +0000
@@ -1,3 +1,41 @@
+2006-01-25  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* 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  <user42@zip.com.au>
+
+	* 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  <yamaoka@jpl.org>
+
+	* mm-uu.el (mm-uu-dissect-text-parts): Reduce the number of
+	recursive calls.
+
+2006-01-24  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* 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  <yamaoka@jpl.org>
+
+	* mm-uu.el (mm-uu-dissect-text-parts): Decode content transfer
+	encoding.
+
+2006-01-20  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* mml.el (mml-attach-file): Describe `description' in doc string.
+	(mml-menu): Add Emacs MIME manual and PGG manual.
+
 2006-01-19  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* spam.el (spam-group-ham-mark-p, spam-group-spam-mark-p)
--- a/lisp/gnus/gnus-art.el	Wed Jan 25 04:11:05 2006 +0000
+++ b/lisp/gnus/gnus-art.el	Wed Jan 25 06:47:24 2006 +0000
@@ -2541,15 +2541,18 @@
 
 (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.
--- a/lisp/gnus/mailcap.el	Wed Jan 25 04:11:05 2006 +0000
+++ b/lisp/gnus/mailcap.el	Wed Jan 25 06:47:24 2006 +0000
@@ -528,7 +528,12 @@
 		    (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)))
 
--- a/lisp/gnus/mm-uu.el	Wed Jan 25 04:11:05 2006 +0000
+++ b/lisp/gnus/mm-uu.el	Wed Jan 25 06:47:24 2006 +0000
@@ -511,25 +511,40 @@
 
 (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))))))
--- a/lisp/gnus/mm-view.el	Wed Jan 25 04:11:05 2006 +0000
+++ b/lisp/gnus/mm-view.el	Wed Jan 25 06:47:24 2006 +0000
@@ -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
--- a/lisp/gnus/mml.el	Wed Jan 25 04:11:05 2006 +0000
+++ b/lisp/gnus/mml.el	Wed Jan 25 06:47:24 2006 +0000
@@ -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 @@
     ;;["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 @@
 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))