summaryrefslogtreecommitdiff
path: root/doc/lispref/files.texi
diff options
context:
space:
mode:
authorArthur Miller <arthur.miller@live.com>2020-11-02 12:38:27 +0100
committerMichael Albinus <michael.albinus@gmx.de>2020-11-02 12:38:27 +0100
commit0806075520939d120a47113f1c121e3d63b34770 (patch)
treee5d9dd2ba5bdea3e1f95fd6a10f1c87dac76cf44 /doc/lispref/files.texi
parentce1856ec09dd312667d8f7cf9ffc908b473d27b8 (diff)
downloademacs-0806075520939d120a47113f1c121e3d63b34770.tar.gz
emacs-0806075520939d120a47113f1c121e3d63b34770.tar.bz2
emacs-0806075520939d120a47113f1c121e3d63b34770.zip
Add directory-empty-p and new argument COUNT for directory-files-*
* doc/lispref/files.texi (Contents of Directories): Mention COUNT argument of directory-files. Add directory-empty-p. * etc/NEWS: Mention directory-empty-p and directory-files changes. * lisp/dired.el (directory-empty-p): New defun. * lisp/net/ange-ftp.el (ange-ftp-directory-files) (ange-ftp-directory-files-and-attributes): * lisp/net/tramp.el (tramp-handle-directory-files) (tramp-handle-directory-files-and-attributes): * lisp/net/tramp-adb.el (tramp-adb-handle-directory-files-and-attributes): * lisp/net/tramp-rclone.el (tramp-rclone-handle-directory-files): * lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes): * lisp/net/tramp-smb.el (tramp-smb-handle-directory-files): Add new COUNT argument. * src/dired.c (directory_files_internal): Implement new RETURN_COUNT argument. (Fdirectory_files, Fdirectory_files_and_attributes): Add new COUNT argument. * src/lisp.h (directory_files_internal): Add RETURN_COUNT to declaration. * src/sysdep.c (list_system_processes): Add Qnil to directory_files_internal call. * test/src/dired-tests.el (directory-files-and-attributes-tests): New file.
Diffstat (limited to 'doc/lispref/files.texi')
-rw-r--r--doc/lispref/files.texi20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index fc66d1c085d..f707fde88a8 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2937,6 +2937,10 @@ you want the utmost possible speed and don't care what order the files
are processed in. If the order of processing is visible to the user,
then the user will probably be happier if you do sort the names.
+If @var{count} is non-@code{nil}, the function will return names of
+first @var{count} number of files, or names of all files, whichever
+occurs first. @var{count} has to be an integer greater than zero.
+
@example
@group
(directory-files "~lewis")
@@ -2950,6 +2954,22 @@ An error is signaled if @var{directory} is not the name of a directory
that can be read.
@end defun
+@defun directory-empty-p filename
+This utility function returns t if given @var{filename} is an
+accessible directory and it does not contain any files, i.e. is an
+empty directory. It will ignore '.' and '..' on systems that returns
+them as files in a directory.
+
+As a special case, this function will also return t if
+FILENAME is the empty string (""). This quirk is due to Emacs
+interpreting the empty string (in some cases) as the current
+directory.
+
+Symbolic links to directories count as directories.
+See @var{file-symlink-p} to distinguish symlinks.
+
+@end defun
+
@cindex recursive traverse of directory tree
@defun directory-files-recursively directory regexp &optional include-directories predicate follow-symlinks
Return all files under @var{directory} whose names match @var{regexp}.