aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2025-02-06 10:42:04 +0200
committerEli Zaretskii2025-02-06 10:42:04 +0200
commit143f1096daa686841f1409bd63835167bb7e8aca (patch)
tree9586895d1cbdac79b26fe83bcf26d7b1c1fc6552
parent5c36b4126533764bb8b90413f274d766e1a6f0d6 (diff)
downloademacs-143f1096daa686841f1409bd63835167bb7e8aca.tar.gz
emacs-143f1096daa686841f1409bd63835167bb7e8aca.zip
Improve documentation of 'file-name-concat'
* doc/lispref/files.texi (Directory Names): * src/fileio.c (Ffile_name_concat): Advise not to use 'file-name-concat' unless necessary. (Bug#76023)
-rw-r--r--doc/lispref/files.texi8
-rw-r--r--src/fileio.c4
2 files changed, 12 insertions, 0 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 97ad7c6b7fa..c285cd1c683 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2459,6 +2459,14 @@ results in any way.
2459This is almost the same as using @code{concat}, but @var{dirname} (and 2459This is almost the same as using @code{concat}, but @var{dirname} (and
2460the non-final components) may or may not end with slash characters, 2460the non-final components) may or may not end with slash characters,
2461and this function will not double those characters. 2461and this function will not double those characters.
2462
2463In most cases, one or more calls to @code{expand-file-name} (@pxref{File
2464Name Expansion} are better suited for the job of generating file names
2465with leading directories than this function. Use this function only if
2466some of the special features of @code{expand-file-name} get in the way
2467of what your program needs to do. For example, the special handling by
2468@code{expand-file-name} of @file{~}, @file{~@var{user}}, and @code{nil},
2469or the removal of @file{.} and @file{..} might not be what you want.
2462@end defun 2470@end defun
2463 2471
2464 To convert a directory name to its abbreviation, use this 2472 To convert a directory name to its abbreviation, use this
diff --git a/src/fileio.c b/src/fileio.c
index 7042dbca258..66aef91d9e7 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -847,6 +847,10 @@ Each element in COMPONENTS must be a string or nil.
847DIRECTORY or the non-final elements in COMPONENTS may or may not end 847DIRECTORY or the non-final elements in COMPONENTS may or may not end
848with a slash -- if they don't end with a slash, a slash will be 848with a slash -- if they don't end with a slash, a slash will be
849inserted before concatenating. 849inserted before concatenating.
850In most cases, one or more calls to `expand-file-name' are better
851suited for the job than this function. Use this function only if
852some of the special expansions done by `expand-file-name' get in
853the way of what your program needs to do.
850usage: (file-name-concat DIRECTORY &rest COMPONENTS) */) 854usage: (file-name-concat DIRECTORY &rest COMPONENTS) */)
851 (ptrdiff_t nargs, Lisp_Object *args) 855 (ptrdiff_t nargs, Lisp_Object *args)
852{ 856{