[gnus git] branch master updated: m0-11-93-gfd81b4c =1= Refactored out gnus-article-mime-handles

Lars <[email protected]> Tue, 09 Dec 2014 21:29:16 +0100
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  fd81b4c575bfb4ae5293835ac3f1f49b57654fc7 (commit)
      from  a3471237bc16b5f69407c8b04f6115836788cd7b (commit)


- Log -----------------------------------------------------------------
commit fd81b4c575bfb4ae5293835ac3f1f49b57654fc7
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Tue Dec 9 21:29:04 2014 +0100

    Refactored out gnus-article-mime-handles
    
    * gnus-art.el (gnus-article-mime-handles): Refactored out into own
    function for reuse.
    (gnus-mime-buttonize-attachments-in-header): Adjusted.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5ea5e55..1624443 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-09  Lars Magne Ingebrigtsen  <[email protected]>
+
+	* gnus-art.el (gnus-article-mime-handles): Refactored out into own
+	function for reuse.
+	(gnus-mime-buttonize-attachments-in-header): Adjusted.
+
 2014-12-07  Lars Magne Ingebrigtsen  <[email protected]>
 
 	* message.el (message-change-subject): Really check whether the subject
diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el
index bfc8c63..15f6ffc 100644
--- a/lisp/gnus-art.el
+++ b/lisp/gnus-art.el
@@ -6336,26 +6336,15 @@ Provided for backwards compatibility."
     (when image
       (gnus-add-image 'shr image))))
 
-(defun gnus-mime-buttonize-attachments-in-header (&optional interactive)
-  "Show attachments as buttons in the end of the header of an article.
-This function toggles the display when called interactively.  Note that
-buttons to be added to the header are only the ones that aren't inlined
-in the body.  Use `gnus-header-face-alist' to highlight buttons."
-  (interactive (list t))
-  (gnus-with-article-buffer
-    (gmm-labels
-	;; Function that returns a flattened version of
-	;; `gnus-article-mime-handle-alist'.
-	((flattened-alist
-	  (&optional alist id all)
+(defun gnus-article-mime-handles (&optional alist id all)
   (if alist
       (let ((i 1) newid flat)
 	(dolist (handle alist flat)
 	  (setq newid (append id (list i))
 		i (1+ i))
 	  (if (stringp (car handle))
-		      (setq flat (nconc flat (flattened-alist (cdr handle)
-							      newid all)))
+	      (setq flat (nconc flat (gnus-article-mime-handles
+				      (cdr handle) newid all)))
 	    (delq (rassq handle all) all)
 	    (setq flat (nconc flat (list (cons newid handle)))))))
     (let ((flat (list nil)))
@@ -6364,9 +6353,8 @@ in the body.  Use `gnus-header-face-alist' to highlight buttons."
       ;; in each element are in the increasing order.
       (dolist (handle (reverse gnus-article-mime-handle-alist))
 	(if (stringp (cadr handle))
-		    (setq flat (nconc flat (flattened-alist (cddr handle)
-							    (list (car handle))
-							    flat)))
+	    (setq flat (nconc flat (gnus-article-mime-handles
+				    (cddr handle) (list (car handle)) flat)))
 	  (delq (rassq (cdr handle) flat) flat)
 	  (setq flat (nconc flat (list (cons (list (car handle))
 					     (cdr handle)))))))
@@ -6380,7 +6368,15 @@ in the body.  Use `gnus-header-face-alist' to highlight buttons."
 		    (push handle gnus-article-mime-handle-alist))
 		(setcar handle (caar handle))))
 	    flat)
-	      flat))))
+      flat)))
+
+(defun gnus-mime-buttonize-attachments-in-header (&optional interactive)
+  "Show attachments as buttons in the end of the header of an article.
+This function toggles the display when called interactively.  Note that
+buttons to be added to the header are only the ones that aren't inlined
+in the body.  Use `gnus-header-face-alist' to highlight buttons."
+  (interactive (list t))
+  (gnus-with-article-buffer
     (let ((case-fold-search t) buttons handle type st)
       (save-excursion
 	(save-restriction
@@ -6401,7 +6397,7 @@ in the body.  Use `gnus-header-face-alist' to highlight buttons."
 	  (unless (and interactive buttons)
 	    ;; Find buttons.
 	    (setq buttons nil)
-	      (dolist (button (flattened-alist))
+	    (dolist (button (gnus-article-mime-handles))
 	      (setq handle (cdr button)
 		    type (mm-handle-media-type handle))
 	      (when (or (and (if (gnus-buffer-live-p gnus-summary-buffer)
@@ -6444,7 +6440,7 @@ in the body.  Use `gnus-header-face-alist' to highlight buttons."
 	      (let ((gnus-treatment-function-alist
 		     '((gnus-treat-highlight-headers
 			gnus-article-highlight-headers))))
-		  (gnus-treat-article 'head))))))))))
+		(gnus-treat-article 'head)))))))))
 
 ;;; Article savers.
 

-----------------------------------------------------------------------
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   |    6 ++
 lisp/gnus-art.el |  198 ++++++++++++++++++++++++++----------------------------
 2 files changed, 103 insertions(+), 101 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