diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-09-10 22:19:01 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-09-10 22:31:23 -0700 |
commit | 61946d991b663c9d35a50b758d0108c3cbf8027b (patch) | |
tree | 159011fddda46d1af5d680c3906bdeadb4132bfe /lisp/files.el | |
parent | e22794867d878d53675fcc91d2ef1ad2494a2ff2 (diff) | |
download | emacs-61946d991b663c9d35a50b758d0108c3cbf8027b.tar.gz |
Make write-file act like copy-file etc.
Change write-file to be consistent with the new behavior
of copy-file, etc.
* etc/NEWS: Mention this.
* lisp/files.el (write-file): Treat the destination as special
only if it is a directory name.
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el index 7ab6f769a8f..611a4c5a6fc 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4212,10 +4212,10 @@ Interactively, confirmation is required unless you supply a prefix argument." (not current-prefix-arg))) (or (null filename) (string-equal filename "") (progn - ;; If arg is just a directory, + ;; If arg is a directory name, ;; use the default file name, but in that directory. - (if (file-directory-p filename) - (setq filename (concat (file-name-as-directory filename) + (if (directory-name-p filename) + (setq filename (concat filename (file-name-nondirectory (or buffer-file-name (buffer-name)))))) (and confirm |