From a4f6b1097fb5d3f27d42b722b7f31fb35fe9da53 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Thu, 31 Aug 2017 00:45:54 +0000 Subject: [PATCH] Respect directory a user enters (bug#28299) * lisp/gnus/mm-decode.el (mm-save-part): Respect directory a user enters (bug#28299). --- lisp/gnus/mm-decode.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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))) -- 2.39.2