From: hayashi Date: Wed, 10 Nov 1999 04:04:21 +0000 (+0000) Subject: * mime-play.el: (mime-save-directory): New variable. X-Git-Tag: emy-1_13_0~6 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=a26aba40550ce4665716ea613f6a74b53cc65dc2;p=elisp%2Fsemi.git * mime-play.el: (mime-save-directory): New variable. (mime-save-content): Don't force filename parameter to be used. --- diff --git a/ChangeLog b/ChangeLog index 7862f59..c31a283 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +1999-11-10 Yoshiki Hayashi + + * mime-play.el: (mime-save-directory): New variable. + (mime-save-content): Don't force filename parameter to be used. + 1999-11-01 Tanaka Akira * mime-view.el (mime-display-application/x-postpet): New function. (mime-preview-condition): Set up for diff --git a/mime-play.el b/mime-play.el index b4a03a2..b98ccea 100644 --- a/mime-play.el +++ b/mime-play.el @@ -36,6 +36,13 @@ (error (defvar bbdb-buffer-name nil))) ) +(defcustom mime-save-directory "~/" + "*Name of the directory where MIME entity will be saved in. +If t, it means current directory." + :group 'mime-view + :type '(choice (const :tag "Current directory" t) + (directory))) + (defvar mime-acting-situation-example-list nil) (defvar mime-acting-situation-example-list-max-size 16) @@ -459,26 +466,25 @@ window.") ;;; (defun mime-save-content (entity situation) - (let* ((name (mime-entity-safe-filename entity)) - (filename (if (and name (not (string-equal name ""))) - (expand-file-name name - (save-window-excursion - (call-interactively - (function - (lambda (dir) - (interactive "DDirectory: ") - dir))))) - (save-window-excursion - (call-interactively - (function - (lambda (file) - (interactive "FFilename: ") - (expand-file-name file))))))) - ) + (let ((name (or (mime-entity-safe-filename entity) + (format "%s" (mime-entity-media-type entity)))) + (dir (if (eq t mime-save-directory) + default-directory + mime-save-directory)) + filename) + (setq filename (read-file-name + (concat "File name: (default " + (file-name-nondirectory name) ") ") + dir + (concat (file-name-as-directory dir) + (file-name-nondirectory name)))) + (if (file-directory-p filename) + (setq filename (concat (file-name-as-directory filename) + (file-name-nondirectory name)))) (if (file-exists-p filename) (or (yes-or-no-p (format "File %s exists. Save anyway? " filename)) (error ""))) - (mime-write-entity-content entity filename) + (mime-write-entity-content entity (expand-file-name filename)) ))