mm-uu.el
authorKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 23 Jan 2006 09:47:41 +0000 (09:47 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 23 Jan 2006 09:47:41 +0000 (09:47 +0000)
lisp/ChangeLog
lisp/mm-uu.el

index 0a62aee..4d7dfad 100644 (file)
@@ -1,3 +1,11 @@
+2006-01-23  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-uu.el (mm-uu-buttonize-original-text-parts): New variable.
+       (mm-uu-dissect-text-parts): Buttonize original text parts.
+
+       * mm-decode.el (mm-handle-set-disposition): New macro.
+       (mm-handle-set-description): New macro.
+
 2006-01-23  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * mm-uu.el (mm-uu-dissect-text-parts): Decode content transfer
index 90627a3..67abcf8 100644 (file)
@@ -618,8 +618,17 @@ value of `mm-uu-text-plain-type'."
        (setq result (cons "multipart/mixed" (nreverse result))))
       result)))
 
+(defcustom mm-uu-buttonize-original-text-parts nil
+  "Non-nil means that the originals of dissected parts get buttons.
+This variable is overridden by `gnus-inhibit-mime-unbuttonizing'."
+  :type 'boolean
+  :version "23.0"
+  :group 'gnus-article-mime)
+
 (defun mm-uu-dissect-text-parts (handle)
-  "Dissect text parts and put uu handles into HANDLE."
+  "Dissect text parts and put uu handles into HANDLE.
+If `mm-uu-buttonize-original-text-parts' is non-nil, the part that HANDLE
+points will always get a button."
   (let ((buffer (mm-handle-buffer handle)))
     (cond ((stringp buffer)
           (mapc 'mm-uu-dissect-text-parts (cdr handle)))
@@ -642,10 +651,17 @@ value of `mm-uu-text-plain-type'."
                                   encoding type)
                                  (mm-uu-dissect t (mm-handle-type handle)))
                              (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))))
+              (if (or mm-uu-buttonize-original-text-parts
+                      (and (boundp 'gnus-inhibit-mime-unbuttonizing)
+                           (symbol-value 'gnus-inhibit-mime-unbuttonizing)))
+                  (let ((parent (copy-sequence handle)))
+                    (mm-handle-set-disposition parent '("attachment"))
+                    (mm-handle-set-description parent "The original part of")
+                    (setcdr handle (cons parent (cdr children))))
+                (kill-buffer buffer)
+                (setcdr handle (cdr children)))
+              (setcar handle (car children)) ;; "multipart/mixed"
+              (mapc 'mm-uu-dissect-text-parts (cdr children)))))
          (t
           (mapc 'mm-uu-dissect-text-parts handle)))))