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