branch: externals/compat
commit 13b51c364fa5325036f3c461679ffd64f832ed28
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
compat-29: Rename file-parent-directory to file-name-parent-directory
---
compat-29.el | 5 ++++-
compat.texi | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/compat-29.el b/compat-29.el
index 3d16539290..0d2ec9c81c 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -480,16 +480,19 @@ The variable list SPEC is the same as in `if-let'."
;;;; Defined in files.el
-(compat-defun file-parent-directory (filename) ;; <UNTESTED>
+(compat-defun file-name-parent-directory (filename) ;; <UNTESTED>
"Return the directory name of the parent directory of FILENAME.
If FILENAME is at the root of the filesystem, return nil.
If FILENAME is relative, it is interpreted to be relative
+to `default-directory', and the result will also be relative."
to `default-directory', and the result will also be relative."
(let* ((expanded-filename (expand-file-name filename))
(parent (file-name-directory (directory-file-name
expanded-filename))))
(cond
;; filename is at top-level, therefore no parent
((or (null parent)
+ ;; `equal' is enough, we don't need to resolve symlinks here
+ ;; with `file-equal-p', also for performance
(equal parent expanded-filename))
nil)
;; filename is relative, return relative parent
diff --git a/compat.texi b/compat.texi
index 6ab8ab8043..4befe76fc5 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2309,7 +2309,7 @@ unmodified, effectively ignoring those changes.
@end defmac
@c copied from lispref/files.texi
-@defun file-parent-directory filename
+@defun file-name-parent-directory filename
This function returns the directory name of the parent directory of
@var{filename}. If @var{filename} is at the root directory of the
filesystem, it returns @code{nil}. A relative @var{filename} is