emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f04f812: Rename directory-append to file-name-concat


From: Lars Ingebrigtsen
Subject: master f04f812: Rename directory-append to file-name-concat
Date: Sun, 25 Jul 2021 02:54:27 -0400 (EDT)

branch: master
commit f04f8126f016b43c45d432bf353ba2a0ac8f7d96
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Rename directory-append to file-name-concat
    
    * src/fileio.c (Ffile_name_concat):
    * lisp/files.el (move-file-to-trash):
    * lisp/emacs-lisp/shortdoc.el (file-name):
    * doc/lispref/files.texi (Directory Names): Rename
    `directory-append' to `file-name-concat'.
---
 doc/lispref/files.texi      |  4 ++--
 lisp/emacs-lisp/shortdoc.el | 10 +++++-----
 lisp/files.el               | 10 +++++-----
 src/fileio.c                |  4 ++--
 test/src/fileio-tests.el    | 34 +++++++++++++++++-----------------
 5 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index e7a0ad2..266501d 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2343,14 +2343,14 @@ entirely of directory separators.
 @end example
 @end defun
 
-@defun directory-append directory &rest components
+@defun file-name-concat directory &rest components
 Concatenate @var{components} to @var{directory}, inserting a slash
 before the components if @var{directory} or the preceding component
 didn't end with a slash.
 
 @example
 @group
-(directory-append "/tmp" "foo")
+(file-name-concat "/tmp" "foo")
      @result{} "/tmp/foo"
 @end group
 @end example
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index c507ad7..a74a5a4 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -273,11 +273,11 @@ There can be any number of :example/:result elements."
    :eval (file-relative-name "/tmp/foo" "/tmp"))
   (make-temp-name
    :eval (make-temp-name "/tmp/foo-"))
-  (directory-append
-   :eval (directory-append "/tmp/" "foo")
-   :eval (directory-append "/tmp" "foo")
-   :eval (directory-append "/tmp" "foo" "bar/" "zot")
-   :eval (directory-append "/tmp" "~"))
+  (file-name-concat
+   :eval (file-name-concat "/tmp/" "foo")
+   :eval (file-name-concat "/tmp" "foo")
+   :eval (file-name-concat "/tmp" "foo" "bar/" "zot")
+   :eval (file-name-concat "/tmp" "~"))
   (expand-file-name
    :eval (expand-file-name "foo" "/tmp/")
    :eval (expand-file-name "foo" "/tmp///")
diff --git a/lisp/files.el b/lisp/files.el
index 78b7659..6088822 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -8127,14 +8127,14 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
                  ;; exists, but the file name may exist in the trash
                  ;; directory even if there is no info file for it.
                  (when (file-exists-p
-                        (directory-append trash-files-dir files-base))
+                        (file-name-concat trash-files-dir files-base))
                    (setq overwrite t
                          files-base (file-name-nondirectory
                                      (make-temp-file
-                                      (directory-append
+                                      (file-name-concat
                                        trash-files-dir files-base)
                                       is-directory))))
-                (setq info-fn (directory-append
+                (setq info-fn (file-name-concat
                                trash-info-dir
                                 (concat files-base ".trashinfo")))
                  ;; Re-check the existence (sort of).
@@ -8145,14 +8145,14 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
                    ;; like Emacs-style backup file names.  E.g.:
                    ;; https://bugs.kde.org/170956
                    (setq info-fn (make-temp-file
-                                  (directory-append trash-info-dir files-base)
+                                  (file-name-concat trash-info-dir files-base)
                                   nil ".trashinfo"))
                    (setq files-base (substring (file-name-nondirectory info-fn)
                                                 0 (- (length ".trashinfo"))))
                    (write-region nil nil info-fn nil 'quiet info-fn)))
                 ;; Finally, try to move the file to the trashcan.
                 (let ((delete-by-moving-to-trash nil)
-                      (new-fn (directory-append trash-files-dir files-base)))
+                      (new-fn (file-name-concat trash-files-dir files-base)))
                   (rename-file fn new-fn overwrite)))))))))
 
 (defsubst file-attribute-type (attributes)
diff --git a/src/fileio.c b/src/fileio.c
index 3d8b082..13c99be 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -749,7 +749,7 @@ For that reason, you should normally use `make-temp-file' 
instead.  */)
                                   empty_unibyte_string, Qnil);
 }
 
-DEFUN ("directory-append", Fdirectory_append, Sdirectory_append, 1, MANY, 0,
+DEFUN ("file-name-concat", Ffile_name_concat, Sfile_name_concat, 1, MANY, 0,
        doc: /* Append COMPONENTS to DIRECTORY and return the resulting string.
 Elements in COMPONENTS must be a string or nil.
 DIRECTORY or the non-final elements in COMPONENTS may or may not end
@@ -6596,7 +6596,7 @@ This includes interactive calls to `delete-file' and
   defsubr (&Sdirectory_file_name);
   defsubr (&Smake_temp_file_internal);
   defsubr (&Smake_temp_name);
-  defsubr (&Sdirectory_append);
+  defsubr (&Sfile_name_concat);
   defsubr (&Sexpand_file_name);
   defsubr (&Ssubstitute_in_file_name);
   defsubr (&Scopy_file);
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el
index b1288f9..f4d123b 100644
--- a/test/src/fileio-tests.el
+++ b/test/src/fileio-tests.el
@@ -160,26 +160,26 @@ Also check that an encoding error can appear in a 
symlink."
   (should-error (file-exists-p "/foo\0bar")
                 :type 'wrong-type-argument))
 
-(ert-deftest fileio-tests/directory-append ()
-  (should (equal (directory-append "foo" "bar") "foo/bar"))
-  (should (equal (directory-append "foo" "bar") "foo/bar"))
-  (should (equal (directory-append "foo" "bar" "zot") "foo/bar/zot"))
-  (should (equal (directory-append "foo/" "bar") "foo/bar"))
-  (should (equal (directory-append "foo//" "bar") "foo//bar"))
-  (should (equal (directory-append "foo/" "bar/" "zot") "foo/bar/zot"))
-  (should (equal (directory-append "fóo" "bar") "fóo/bar"))
-  (should (equal (directory-append "foo" "bár") "foo/bár"))
-  (should (equal (directory-append "fóo" "bár") "fóo/bár"))
+(ert-deftest fileio-tests/file-name-concat ()
+  (should (equal (file-name-concat "foo" "bar") "foo/bar"))
+  (should (equal (file-name-concat "foo" "bar") "foo/bar"))
+  (should (equal (file-name-concat "foo" "bar" "zot") "foo/bar/zot"))
+  (should (equal (file-name-concat "foo/" "bar") "foo/bar"))
+  (should (equal (file-name-concat "foo//" "bar") "foo//bar"))
+  (should (equal (file-name-concat "foo/" "bar/" "zot") "foo/bar/zot"))
+  (should (equal (file-name-concat "fóo" "bar") "fóo/bar"))
+  (should (equal (file-name-concat "foo" "bár") "foo/bár"))
+  (should (equal (file-name-concat "fóo" "bár") "fóo/bár"))
   (let ((string (make-string 5 ?a)))
     (should (not (multibyte-string-p string)))
     (aset string 2 255)
     (should (not (multibyte-string-p string)))
-    (should (equal (directory-append "fóo" string) "fóo/aa\377aa")))
-  (should (equal (directory-append "foo") "foo"))
-  (should (equal (directory-append "foo/") "foo/"))
-  (should (equal (directory-append "foo" "") "foo"))
-  (should (equal (directory-append "foo" "" "" "" nil) "foo"))
-  (should (equal (directory-append "" "bar") "bar"))
-  (should (equal (directory-append "" "") "")))
+    (should (equal (file-name-concat "fóo" string) "fóo/aa\377aa")))
+  (should (equal (file-name-concat "foo") "foo"))
+  (should (equal (file-name-concat "foo/") "foo/"))
+  (should (equal (file-name-concat "foo" "") "foo"))
+  (should (equal (file-name-concat "foo" "" "" "" nil) "foo"))
+  (should (equal (file-name-concat "" "bar") "bar"))
+  (should (equal (file-name-concat "" "") "")))
 
 ;;; fileio-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]