;;; ;;; tm-file.el --- tm-view internal method for file extraction ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. ;;; Copyright (C) 1995 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: ;;; $Id: tm-file.el,v 2.0 1995/11/06 16:05:29 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia ;;; ;;; This file is part of tm (Tools for MIME). ;;; (require 'tm-view) (defun mime-article/extract-file (beg end cal) (let* ((name (or (cdr (assoc "name" cal)) (cdr (assoc "x-name" cal)) (make-temp-name "tm"))) (encoding (cdr (assq 'encoding cal))) (dir (call-interactively (function (lambda (dir) (interactive "Ddirictory: ") dir)))) (file-coding-system *noconv*) (filename (expand-file-name name dir)) (the-buf (current-buffer)) (tmp-buf (generate-new-buffer name)) ) (goto-char beg) (re-search-forward "\n\n") (append-to-buffer tmp-buf (match-end 0) end) (save-excursion (set-buffer tmp-buf) (mime/decode-region encoding (point-min)(point-max)) (let ((file-coding-system *noconv*) jka-compr-compression-info-list jam-zcat-filename-list) (write-file filename) ) (kill-buffer tmp-buf) ))) ;;; @ setup ;;; (set-atype 'mime/content-decoding-condition '((mode . "extract") (method . mime-article/extract-file) )) (set-atype 'mime/content-decoding-condition '((type . "application/octet-stream") (method . mime-article/extract-file) )) ;;; @ end ;;; (provide 'tm-file)