summaryrefslogtreecommitdiff
path: root/doc/lispref/files.texi
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-10 00:26:32 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-10 00:26:32 +0100
commit2e6ed253ce485698df649904bd9e5254a3f4bf94 (patch)
tree80d51ebb50d65eddd987b89e93d4d52499a48109 /doc/lispref/files.texi
parentfdc00b98361300861db6402e021d335025f6e8ce (diff)
downloademacs-2e6ed253ce485698df649904bd9e5254a3f4bf94.tar.gz
emacs-2e6ed253ce485698df649904bd9e5254a3f4bf94.tar.bz2
emacs-2e6ed253ce485698df649904bd9e5254a3f4bf94.zip
Add new function 'file-name-split'
* doc/lispref/files.texi (File Name Components): Document it. * lisp/files.el (file-name-split): New function (bug#50572). * lisp/emacs-lisp/shortdoc.el (file-name): Mention it.
Diffstat (limited to 'doc/lispref/files.texi')
-rw-r--r--doc/lispref/files.texi13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index ddc1d05c1ca..dd058b12158 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2244,6 +2244,19 @@ and @code{file-name-nondirectory}. For example,
@end example
@end defun
+@defun file-name-split filename
+This function splits a file name into its components, and can be
+thought of as the inverse of @code{string-joing} with the appropriate
+directory separator. For example,
+
+@example
+(file-name-split "/tmp/foo.txt")
+ @result{} ("" "tmp" "foo.txt")
+(string-join (file-name-split "/tmp/foo.txt") "/")
+ @result{} "/tmp/foo.txt"
+@end example
+@end defun
+
@node Relative File Names
@subsection Absolute and Relative File Names
@cindex absolute file name