X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=blobdiff_plain;f=lisp%2Fmm-archive.el;h=9c86c4ac4f3cd2479b4dbe3db2323aaecc682959;hp=43a951ee5797a56a9b3a5d7d4b653aa16dc7b02e;hb=b9d4597a71a404851e3180b476ffe6186131adac;hpb=4739da68738c1b99b0e7a58c9943539e824e2042 diff --git a/lisp/mm-archive.el b/lisp/mm-archive.el index 43a951ee5..9c86c4ac4 100644 --- a/lisp/mm-archive.el +++ b/lisp/mm-archive.el @@ -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 ;; This file is part of GNU Emacs. @@ -22,15 +22,21 @@ ;;; Code: +(require 'mm-decode) +(autoload 'gnus-recursive-directory-files "gnus-util") +(autoload 'mailcap-extension-to-mime "mailcap") + (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-archive-decoders () mm-archive-decoders) (defun mm-dissect-archive (handle) - (let ((decoder (cdr (assoc (car (mm-handle-type handle)) - mm-archive-decoders))) + (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))) (set-file-modes dir #o700) @@ -79,6 +85,22 @@ handles))) 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))) + (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) ;; mm-archive.el ends here