From 627e7e0243d6df73b7cc93fb7a106a61c944b3bf Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 17 Dec 2022 22:14:40 +0200 Subject: [PATCH] Improve documentation of 'file-exists-p' * doc/lispref/files.texi (Testing Accessibility): Document better how to test for existing dangling symlinks. (Bug#60146) --- doc/lispref/files.texi | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 4b45d89f9d0..e2c3eb33418 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -895,10 +895,14 @@ permissions of the file itself.) If the file does not exist, or if there was trouble determining whether the file exists, this function returns @code{nil}. -Directories are files, so @code{file-exists-p} can return @code{t} when -given a directory. However, because @code{file-exists-p} follows -symbolic links, it returns @code{t} for a symbolic link -name only if the target file exists. +@cindex dangling symlinks, testing for existence +Directories are files, so @code{file-exists-p} can return @code{t} +when given a directory. However, because @code{file-exists-p} follows +symbolic links, it returns @code{t} for a symbolic link name only if +the target of the link exists; if your Lisp program needs to consider +@dfn{dangling symlinks} whose target doesn't exist as existing files, +use @code{file-attributes} (@pxref{File Attributes}) instead of +@code{file-exists-p}. @end defun @defun file-readable-p filename -- 2.39.5