; Fix documentation of 'file-parent-directory'

* doc/lispref/files.texi (Directory Names):
* lisp/files.el (file-parent-directory): Improve wording of the
documentation of 'file-parent-directory'.  (Bug#56355)
This commit is contained in:
Eli Zaretskii 2022-07-04 14:59:58 +03:00
parent 1ac383bcb6
commit 603de9a38e
2 changed files with 10 additions and 6 deletions

View file

@ -2446,9 +2446,12 @@ because it recognizes abbreviations even as part of the name.
@end defun
@defun file-parent-directory filename
This function returns the parent directory of @var{filename}. If
@var{filename} is at the top level, return @code{nil}. @var{filename}
can be relative to @code{default-directory}.
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
assumed to be relative to @code{default-directory}, and the return
value will also be relative in that case. If the return value is
non-@code{nil}, it ends in a slash.
@end defun
@node File Name Expansion

View file

@ -5146,9 +5146,10 @@ On most systems, this will be true:
components))
(defun file-parent-directory (filename)
"Return the parent directory of FILENAME.
If FILENAME is at the top level, return nil. FILENAME can be
relative to `default-directory'."
"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."
(let* ((expanded-filename (expand-file-name filename))
(parent (file-name-directory (directory-file-name expanded-filename))))
(cond