Commit 52080b57 authored by Stefan Monnier's avatar Stefan Monnier

* lisp/minibuffer.el (read-file-name-default): Fix bug#39057

parent e4cec1fd
Pipeline #4572 failed with stage
in 90 minutes and 1 second
......@@ -2737,8 +2737,13 @@ See `read-file-name' for the meaning of the arguments."
(unless dir (setq dir (or default-directory "~/")))
(unless (file-name-absolute-p dir) (setq dir (expand-file-name dir)))
(unless default-filename
(setq default-filename (if initial (expand-file-name initial dir)
(setq default-filename
((null initial) buffer-file-name)
;; Special-case "" because (expand-file-name "" "/tmp/") returns
;; "/tmp" rather than "/tmp/" (bug#39057).
((equal "" initial) dir)
(t (expand-file-name initial dir)))))
;; If dir starts with user's homedir, change that to ~.
(setq dir (abbreviate-file-name dir))
;; Likewise for default-filename.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment