2 ;;; tm-file.el --- tm-view internal method for file extraction
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; modified by KOBAYASHI Shuhei <shuhei@cmpt01.phys.tohoku.ac.jp>
10 ;;; $Id: tm-file.el,v 7.4 1996/03/25 12:48:13 morioka Exp $
11 ;;; Keywords: mail, news, MIME, multimedia
13 ;;; This file is part of tm (Tools for MIME).
15 ;;; This program is free software; you can redistribute it and/or
16 ;;; modify it under the terms of the GNU General Public License as
17 ;;; published by the Free Software Foundation; either version 2, or
18 ;;; (at your option) any later version.
20 ;;; This program is distributed in the hope that it will be useful,
21 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 ;;; General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with This program. If not, write to the Free Software
27 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
33 (defun mime-article/extract-file (beg end cal)
37 (narrow-to-region beg end)
38 (mime-article/get-filename cal)
40 (encoding (cdr (assq 'encoding cal)))
42 (if (and name (not (string-equal name "")))
43 (expand-file-name name
47 (interactive "DDirectory: ")
52 (interactive "FFilename: ")
53 (expand-file-name file))))))
54 (the-buf (current-buffer))
55 (tmp-buf (generate-new-buffer (file-name-nondirectory filename)))
57 (if (file-exists-p filename)
58 (or (yes-or-no-p (format "File %s exists. Save anyway? " filename))
60 (re-search-forward "\n\n")
61 (append-to-buffer tmp-buf (match-end 0) end)
64 (mime/decode-region encoding (point-min)(point-max))
65 (let ((mc-flag nil) ; for Mule
67 (if (featurep 'mule) *noconv*))
68 kanji-flag ; for NEmacs
69 (emx-binary-mode t) ; for OS/2
70 jka-compr-compression-info-list ; for jka-compr
71 jam-zcat-filename-list ; for jam-zcat
72 require-final-newline)
82 (set-atype 'mime/content-decoding-condition
84 (method . mime-article/extract-file)
87 (set-atype 'mime/content-decoding-condition
88 '((type . "application/octet-stream")
89 (method . mime-article/extract-file)