mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 19:29:37 +00:00
; Improve documentation of 'file-in-directory-p'
* lisp/files.el (file-in-directory-p): Clarify doc string. * doc/lispref/files.texi (Truenames): Move the documentation of 'file-in-directory-p' from here... (Contents of Directories): ...to here. Add index entries. (Bug#58364)
This commit is contained in:
parent
cfb1e21844
commit
32ef7550ed
2 changed files with 15 additions and 11 deletions
|
@ -1250,14 +1250,6 @@ the @samp{smb} method. For all other connection methods, runtime
|
||||||
tests are performed.
|
tests are performed.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@defun file-in-directory-p file dir
|
|
||||||
This function returns @code{t} if @var{file} is a file in directory
|
|
||||||
@var{dir}, or in a subdirectory of @var{dir}. It also returns
|
|
||||||
@code{t} if @var{file} and @var{dir} are the same directory. It
|
|
||||||
compares the truenames of the two directories. If @var{dir} does not
|
|
||||||
name an existing directory, the return value is @code{nil}.
|
|
||||||
@end defun
|
|
||||||
|
|
||||||
@defun vc-responsible-backend file
|
@defun vc-responsible-backend file
|
||||||
This function determines the responsible VC backend of the given
|
This function determines the responsible VC backend of the given
|
||||||
@var{file}. For example, if @file{emacs.c} is a file tracked by Git,
|
@var{file}. For example, if @file{emacs.c} is a file tracked by Git,
|
||||||
|
@ -3052,6 +3044,17 @@ is called with one argument (the file or directory) and should return
|
||||||
non-@code{nil} if that directory is the one it is looking for.
|
non-@code{nil} if that directory is the one it is looking for.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
|
@cindex parent directory of file
|
||||||
|
@cindex ancestor directory of file
|
||||||
|
@cindex file, ancestor directory of
|
||||||
|
@defun file-in-directory-p file dir
|
||||||
|
This function returns @code{t} if @var{file} is a file in directory
|
||||||
|
@var{dir}, or in a subdirectory of @var{dir}. It also returns
|
||||||
|
@code{t} if @var{file} and @var{dir} are the same directory. It
|
||||||
|
compares the truenames of the two directories. If @var{dir} does not
|
||||||
|
name an existing directory, the return value is @code{nil}.
|
||||||
|
@end defun
|
||||||
|
|
||||||
@defun directory-files-and-attributes directory &optional full-name match-regexp nosort id-format count
|
@defun directory-files-and-attributes directory &optional full-name match-regexp nosort id-format count
|
||||||
This is similar to @code{directory-files} in deciding which files
|
This is similar to @code{directory-files} in deciding which files
|
||||||
to report on and how to report their names. However, instead
|
to report on and how to report their names. However, instead
|
||||||
|
|
|
@ -6166,9 +6166,10 @@ If FILE1 or FILE2 does not exist, the return value is unspecified."
|
||||||
(equal f1-attr f2-attr))))))
|
(equal f1-attr f2-attr))))))
|
||||||
|
|
||||||
(defun file-in-directory-p (file dir)
|
(defun file-in-directory-p (file dir)
|
||||||
"Return non-nil if FILE is in DIR or a subdirectory of DIR.
|
"Return non-nil if DIR is a parent directory of FILE.
|
||||||
A directory is considered to be \"in\" itself.
|
Value is non-nil if FILE is inside DIR or inside a subdirectory of DIR.
|
||||||
Return nil if DIR is not an existing directory."
|
A directory is considered to be a \"parent\" of itself.
|
||||||
|
DIR must be an existing directory, otherwise the function returns nil."
|
||||||
(let ((handler (or (find-file-name-handler file 'file-in-directory-p)
|
(let ((handler (or (find-file-name-handler file 'file-in-directory-p)
|
||||||
(find-file-name-handler dir 'file-in-directory-p))))
|
(find-file-name-handler dir 'file-in-directory-p))))
|
||||||
(if handler
|
(if handler
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue