[gnus git] branch master updated: n0-15-7-g6c37a90 =1= mm: add mm-handle-filename

Julien Danjou <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  6c37a908184a6cc014ba7ee895faab615acbadc0 (commit)
      from  3544579e8e89935b7f4b641010803b1f0a5c3fd3 (commit)


- Log -----------------------------------------------------------------
commit 6c37a908184a6cc014ba7ee895faab615acbadc0
Author: Julien Danjou <[email protected]>
Date:   Mon Mar 21 17:43:04 2011 +0100

    mm: add mm-handle-filename
    
    Signed-off-by: Julien Danjou <[email protected]>

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f18a7b4..8f52c49 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
+2011-03-21  Julien Danjou  <[email protected]>
+
+	* mm-view.el (mm-display-inline-fontify):
+	* gnus-sum.el (gnus-summary-save-parts-1):
+	* gnus-art.el (gnus-article-browse-html-save-cid-content)
+	(gnus-article-browse-html-parts, gnus-mime-delete-part)
+	(gnus-mime-copy-part, gnus-mime-inline-part, gnus-insert-mime-button):
+	Use `mm-handle-filename'.
+
+	* mm-util.el (mm-handle-filename): New function, return the filename of
+	an handle.
+
 2011-03-18  Julien Danjou  <[email protected]>
 
 	* gnus-util.el (gnus-buffer-live-p): Simplify gnus-buffer-live-p.
diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el
index 7c7e053..9767798 100644
--- a/lisp/gnus-art.el
+++ b/lisp/gnus-art.el
@@ -2811,13 +2811,10 @@ Return file name."
 	   ((equal (concat "<" cid ">") (mm-handle-id handle))
 	    (setq file
 		  (expand-file-name
-		   (or (mail-content-type-get
-			(mm-handle-disposition handle) 'filename)
-		       (mail-content-type-get
-			(setq type (mm-handle-type handle)) 'name)
+                   (or (mm-handle-filename handle)
 		       (concat
 			(make-temp-name "cid")
-			(car (rassoc (car type) mailcap-mime-extensions))))
+                        (car (rassoc (car (mm-handle-type handle)) mailcap-mime-extensions))))
 		   directory))
 	    (mm-save-part-to-file handle file)
 	    (throw 'found file))))))))
@@ -2835,10 +2832,7 @@ message header will be added to the bodies of the \"text/html\" parts."
 	    ((or (equal (car (setq type (mm-handle-type handle))) "text/html")
 		 (and (equal (car type) "message/external-body")
 		      (or header
-			  (setq file (or (mail-content-type-get type 'name)
-					 (mail-content-type-get
-					  (mm-handle-disposition handle)
-					  'filename))))
+			  (setq file (mm-handle-filename handle)))
 		      (or (mm-handle-cache handle)
 			  (condition-case code
 			      (progn (mm-extern-cache-contents handle) t)
@@ -5043,14 +5037,11 @@ Deleting parts may malfunction or destroy the article; continue? "))
     (let* ((data (get-text-property (point) 'gnus-data))
 	   (id (get-text-property (point) 'gnus-part))
 	   (handles gnus-article-mime-handles)
-	   (none "(none)")
 	   (description
 	    (let ((desc (mm-handle-description data)))
 	      (when desc
 		(mail-decode-encoded-word-string desc))))
-	   (filename
-	    (or (mail-content-type-get (mm-handle-disposition data) 'filename)
-		none))
+	   (filename (or (mm-handle-filename (mm-handle-disposition data)) "(none)"))
 	   (type (mm-handle-media-type data)))
       (unless data
 	(error "No MIME part under point"))
@@ -5168,10 +5159,7 @@ are decompressed."
   (unless handle
     (setq handle (get-text-property (point) 'gnus-data)))
   (when handle
-    (let ((filename (or (mail-content-type-get (mm-handle-type handle)
-					       'name)
-			(mail-content-type-get (mm-handle-disposition handle)
-					       'filename)))
+    (let ((filename (mm-handle-filename handle))
 	  contents dont-decode charset coding-system)
       (mm-with-unibyte-buffer
 	(mm-insert-part handle)
@@ -5261,12 +5249,7 @@ Compressed files like .gz and .bz2 are decompressed."
 	(mm-with-unibyte-buffer
 	  (mm-insert-part handle)
 	  (setq contents
-		(or (mm-decompress-buffer
-		     (or (mail-content-type-get (mm-handle-type handle)
-						'name)
-			 (mail-content-type-get (mm-handle-disposition handle)
-						'filename))
-		     nil t)
+		(or (mm-decompress-buffer (mm-handle-filename handle) nil t)
 		    (buffer-string))))
 	(cond
 	 ((not arg)
@@ -5671,8 +5654,7 @@ all parts."
 
 (defun gnus-insert-mime-button (handle gnus-tmp-id &optional displayed)
   (let ((gnus-tmp-name
-	 (or (mail-content-type-get (mm-handle-type handle) 'name)
-	     (mail-content-type-get (mm-handle-disposition handle) 'filename)
+	 (or (mm-handle-filename handle)
 	     (mail-content-type-get (mm-handle-type handle) 'url)
 	     ""))
 	(gnus-tmp-type (mm-handle-media-type handle))
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 29a98b7..9b22bbe 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -12142,10 +12142,7 @@ If REVERSE, save parts that do not match TYPE."
 		    mm-file-name-rewrite-functions
 		    (file-name-nondirectory
 		     (or
-		      (mail-content-type-get
-		       (mm-handle-disposition handle) 'filename)
-		      (mail-content-type-get
-		       (mm-handle-type handle) 'name)
+                      (mm-handle-filename handle)
 		      (format "%s.%d.%d" gnus-newsgroup-name
 			      (cdr gnus-article-current)
 			      gnus-summary-save-parts-counter))))
diff --git a/lisp/mm-util.el b/lisp/mm-util.el
index 435c3bb..d53784e 100644
--- a/lisp/mm-util.el
+++ b/lisp/mm-util.el
@@ -1667,6 +1667,13 @@ gzip, bzip2, etc. are allowed."
 	(when decomp
 	  (kill-buffer (current-buffer)))))))
 
+(defun mm-handle-filename (handle)
+  "Return filename of HANDLE if any."
+  (or (mail-content-type-get (mm-handle-type handle)
+                             'name)
+      (mail-content-type-get (mm-handle-disposition handle)
+                             'filename)))
+
 (provide 'mm-util)
 
 ;;; mm-util.el ends here
diff --git a/lisp/mm-view.el b/lisp/mm-view.el
index d63d202..e8282ed 100644
--- a/lisp/mm-view.el
+++ b/lisp/mm-view.el
@@ -572,8 +572,7 @@
       (mm-with-unibyte-buffer
 	(mm-insert-part handle)
 	(mm-decompress-buffer
-	 (or (mail-content-type-get (mm-handle-disposition handle) 'name)
-	     (mail-content-type-get (mm-handle-disposition handle) 'filename))
+         (mm-handle-filename handle)
 	 t t)
 	(unless charset
 	  (setq coding-system (mm-find-buffer-file-coding-system)))

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog   |   12 ++++++++++++
 lisp/gnus-art.el |   38 ++++++++++----------------------------
 lisp/gnus-sum.el |    5 +----
 lisp/mm-util.el  |    7 +++++++
 lisp/mm-view.el  |    3 +--
 5 files changed, 31 insertions(+), 34 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.