From: Katsumi Yamaoka Date: Thu, 31 Aug 2017 00:45:54 +0000 (+0000) Subject: Respect directory a user enters (bug#28299) X-Git-Tag: emacs-26.0.90~291 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a4f6b1097fb5d3f27d42b722b7f31fb35fe9da53;p=emacs.git Respect directory a user enters (bug#28299) * lisp/gnus/mm-decode.el (mm-save-part): Respect directory a user enters (bug#28299). --- diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index c6a0be36c40..9b77dadddb1 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1363,7 +1363,7 @@ PROMPT overrides the default one used to ask user for a file name." (mm-handle-disposition handle) 'filename) (mail-content-type-get (mm-handle-type handle) 'name))) - file) + file directory) (when filename (setq filename (gnus-map-function mm-file-name-rewrite-functions (file-name-nondirectory filename)))) @@ -1372,16 +1372,20 @@ PROMPT overrides the default one used to ask user for a file name." (setq file (read-file-name (or prompt - (format "Save MIME part to (default %s): " - (or filename ""))) - (or mm-default-directory default-directory) - (expand-file-name (or filename "") - (or mm-default-directory default-directory)))) + (format "Save MIME part to%s: " + (if filename + (format " (default %s)" filename) + ""))) + (or directory mm-default-directory default-directory) + (expand-file-name + (or filename "") + (or directory mm-default-directory default-directory)))) (cond ((or (not file) (equal file "")) (message "Please enter a file name") t) ((and (file-directory-p file) (not filename)) + (setq directory file) (message "Please enter a non-directory file name") t) (t nil)))