[gnus git] branch master updated: m0-1-111-g47acfc5 =2= (mm-archive-dissect-and-inline): Fix up the undisplayer. ; Don't unpack zip/tar files automatically, but allow RET-ing them

Lars Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  47acfc52c676312c7b3f1df5ad04078cc3157d69 (commit)
       via  28e11fa1d500b0086e45152f65258edb2ba42ae8 (commit)
      from  87e2f61d051414fdc3fb4235570411b89785e9cf (commit)


- Log -----------------------------------------------------------------
commit 47acfc52c676312c7b3f1df5ad04078cc3157d69
Author: Lars Ingebrigtsen <[email protected]>
Date:   Thu Feb 9 23:01:02 2012 +0100

    (mm-archive-dissect-and-inline): Fix up the undisplayer.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 905e6f5..2e3721c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,7 @@
 2012-02-09  Lars Ingebrigtsen  <[email protected]>
 
 	* mm-archive.el (mm-archive-dissect-and-inline): New function.
+	(mm-archive-dissect-and-inline): Fix up the undisplayer.
 
 	* gnus-compat.el: Define `timer-set-function'.
 
diff --git a/lisp/mm-archive.el b/lisp/mm-archive.el
index 3f01735..5ca6616 100644
--- a/lisp/mm-archive.el
+++ b/lisp/mm-archive.el
@@ -80,8 +80,20 @@
     handles))
 
 (defun mm-archive-dissect-and-inline (handle)
+  (let ((start (point-marker)))
+    (save-restriction
+      (narrow-to-region (point) (point))
   (dolist (handle (cddr (mm-dissect-archive handle)))
-    (mm-display-inline handle)))
+	(goto-char (point-max))
+	(mm-display-inline handle))
+      (goto-char (point-max))
+      (mm-handle-set-undisplayer
+       handle
+       `(lambda ()
+	  (let ((inhibit-read-only t)
+		(end ,(point-marker)))
+	    (remove-images ,start end)
+	    (delete-region ,start end)))))))
 
 (provide 'mm-archive)
 

commit 28e11fa1d500b0086e45152f65258edb2ba42ae8
Author: Lars Ingebrigtsen <[email protected]>
Date:   Thu Feb 9 22:54:26 2012 +0100

    Don't unpack zip/tar files automatically, but allow RET-ing them

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6cf2f0c..905e6f5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
 2012-02-09  Lars Ingebrigtsen  <[email protected]>
 
+	* mm-archive.el (mm-archive-dissect-and-inline): New function.
+
 	* gnus-compat.el: Define `timer-set-function'.
 
 	* mm-decode.el (mm-display-external): Output the text from the command
diff --git a/lisp/mm-archive.el b/lisp/mm-archive.el
index 43a951e..3f01735 100644
--- a/lisp/mm-archive.el
+++ b/lisp/mm-archive.el
@@ -23,13 +23,13 @@
 ;;; Code:
 
 (defvar mm-archive-decoders
-  '(("application/ms-tnef" "tnef" "-f" "-" "-C")
-    ("application/zip" "unzip" "-j" "-x" "%f" "-d")
-    ("application/x-gtar-compressed" "tar" "xzf" "-" "-C")
-    ("application/x-tar" "tar" "xf" "-" "-C")))
+  '(("application/ms-tnef" t "tnef" "-f" "-" "-C")
+    ("application/zip" nil "unzip" "-j" "-x" "%f" "-d")
+    ("application/x-gtar-compressed" nil "tar" "xzf" "-" "-C")
+    ("application/x-tar" nil "tar" "xf" "-" "-C")))
 
 (defun mm-dissect-archive (handle)
-  (let ((decoder (cdr (assoc (car (mm-handle-type handle))
+  (let ((decoder (cddr (assoc (car (mm-handle-type handle))
 			     mm-archive-decoders)))
 	(dir (mm-make-temp-file
 	      (expand-file-name "emm." mm-tmp-directory) 'dir)))
@@ -79,6 +79,10 @@
 	 handles)))
     handles))
 
+(defun mm-archive-dissect-and-inline (handle)
+  (dolist (handle (cddr (mm-dissect-archive handle)))
+    (mm-display-inline handle)))
+
 (provide 'mm-archive)
 
 ;; mm-archive.el ends here
diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el
index 6ec226f..03bcaa1 100644
--- a/lisp/mm-decode.el
+++ b/lisp/mm-decode.el
@@ -249,6 +249,8 @@ before the external MIME handler is invoked."
     ("message/partial" mm-inline-partial identity)
     ("message/external-body" mm-inline-external-body identity)
     ("text/.*" mm-inline-text identity)
+    ("application/x-.?tar\\(-.*\\)?" mm-archive-dissect-and-inline identity)
+    ("application/zip" mm-archive-dissect-and-inline identity)
     ("audio/wav" mm-inline-audio
      (lambda (handle)
        (and (or (featurep 'nas-sound) (featurep 'native-sound))
@@ -298,6 +300,9 @@ before the external MIME handler is invoked."
     "application/pgp-signature" "application/x-pkcs7-signature"
     "application/pkcs7-signature" "application/x-pkcs7-mime"
     "application/pkcs7-mime"
+    "application/x-gtar-compressed"
+    "application/x-tar"
+    "application/zip"
     ;; Mutt still uses this even though it has already been withdrawn.
     "application/pgp")
   "List of media types that are to be displayed inline.
@@ -659,7 +664,9 @@ Postpone undisplaying of viewers for types in
 	    (mm-copy-to-buffer) ctl cte nil cdl description nil id))
 	  (decoder (assoc (car ctl) mm-archive-decoders)))
       (if (and decoder
-	       (executable-find (cadr decoder)))
+	       ;; Do automatic decoding
+	       (cadr decoder)
+	       (executable-find (caddr decoder)))
 	  (mm-dissect-archive handle)
 	handle))))
 

-----------------------------------------------------------------------
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     |    3 +++
 lisp/mm-archive.el |   28 ++++++++++++++++++++++------
 lisp/mm-decode.el  |    9 ++++++++-
 3 files changed, 33 insertions(+), 7 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.