@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
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