[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 61946d9 2/5: Make write-file act like copy-file etc
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 61946d9 2/5: Make write-file act like copy-file etc. |
Date: |
Mon, 11 Sep 2017 01:31:30 -0400 (EDT) |
branch: master
commit 61946d991b663c9d35a50b758d0108c3cbf8027b
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
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.
---
etc/NEWS | 3 ++-
lisp/files.el | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 136d458..4da4c37 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1286,7 +1286,8 @@ call like (rename-file C D) that used the old,
undocumented behavior
can be written as (rename-file C (file-name-as-directory D)), a
formulation portable to both older and newer versions of Emacs.
Affected functions include add-name-to-file, copy-directory,
-copy-file, make-symbolic-link, and rename-file.
+copy-file, format-write-file, make-symbolic-link, rename-file, and
+write-file.
* Lisp Changes in Emacs 26.1
diff --git a/lisp/files.el b/lisp/files.el
index 7ab6f76..611a4c5 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