1 ;;; mime-file.el --- mime-view internal method for file extraction
3 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; modified by Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
7 ;; Version: $Id: mime-file.el,v 0.2 1997-05-12 12:28:38 morioka Exp $
8 ;; Keywords: file, extract, MIME, multimedia, mail, news
10 ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
17 ;; This program is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
31 (defun mime-article/extract-file (beg end cal)
35 (narrow-to-region beg end)
36 (mime-article/get-filename cal)
38 (encoding (cdr (assq 'encoding cal)))
40 (if (and name (not (string-equal name "")))
41 (expand-file-name name
45 (interactive "DDirectory: ")
50 (interactive "FFilename: ")
51 (expand-file-name file))))))
52 (tmp-buf (generate-new-buffer (file-name-nondirectory filename)))
54 (if (file-exists-p filename)
55 (or (yes-or-no-p (format "File %s exists. Save anyway? " filename))
57 (re-search-forward "\n\n")
58 (append-to-buffer tmp-buf (match-end 0) end)
61 (mime-decode-region (point-min)(point-max) encoding)
62 (let ((coding-system-for-write 'no-conversion)
63 jka-compr-compression-info-list ; for jka-compr
64 jam-zcat-filename-list ; for jam-zcat
65 require-final-newline)
75 (set-atype 'mime-acting-condition
76 '((type . "application/octet-stream")
77 (method . mime-article/extract-file)
82 (set-atype 'mime-acting-condition
84 (method . mime-article/extract-file)
87 '((method "mime-file" nil 'file 'type 'encoding 'mode 'name)
97 ;;; end of mime-file.el