lisp/ChangeLog: Fix date
[gnus] / lisp / mm-archive.el
index 3f01735..9c86c4a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mm-archive.el --- Functions for parsing archive files as MIME
 
-;; Copyright (C) 2012  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
 
 ;;; Code:
 
+(require 'mm-decode)
+(autoload 'gnus-recursive-directory-files "gnus-util")
+(autoload 'mailcap-extension-to-mime "mailcap")
+
 (defvar mm-archive-decoders
   '(("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-archive-decoders () mm-archive-decoders)
+
 (defun mm-dissect-archive (handle)
   (let ((decoder (cddr (assoc (car (mm-handle-type handle))
                              mm-archive-decoders)))
     handles))
 
 (defun mm-archive-dissect-and-inline (handle)
-  (dolist (handle (cddr (mm-dissect-archive handle)))
-    (mm-display-inline handle)))
+  (let ((start (point-marker)))
+    (save-restriction
+      (narrow-to-region (point) (point))
+      (dolist (handle (cddr (mm-dissect-archive 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)