diff options
| author | Eli Zaretskii | 2025-02-06 10:42:04 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2025-02-06 10:42:04 +0200 |
| commit | 143f1096daa686841f1409bd63835167bb7e8aca (patch) | |
| tree | 9586895d1cbdac79b26fe83bcf26d7b1c1fc6552 | |
| parent | 5c36b4126533764bb8b90413f274d766e1a6f0d6 (diff) | |
| download | emacs-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.texi | 8 | ||||
| -rw-r--r-- | src/fileio.c | 4 |
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. | |||
| 2459 | This is almost the same as using @code{concat}, but @var{dirname} (and | 2459 | This is almost the same as using @code{concat}, but @var{dirname} (and |
| 2460 | the non-final components) may or may not end with slash characters, | 2460 | the non-final components) may or may not end with slash characters, |
| 2461 | and this function will not double those characters. | 2461 | and this function will not double those characters. |
| 2462 | |||
| 2463 | In most cases, one or more calls to @code{expand-file-name} (@pxref{File | ||
| 2464 | Name Expansion} are better suited for the job of generating file names | ||
| 2465 | with leading directories than this function. Use this function only if | ||
| 2466 | some of the special features of @code{expand-file-name} get in the way | ||
| 2467 | of 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}, | ||
| 2469 | or 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. | |||
| 847 | DIRECTORY or the non-final elements in COMPONENTS may or may not end | 847 | DIRECTORY or the non-final elements in COMPONENTS may or may not end |
| 848 | with a slash -- if they don't end with a slash, a slash will be | 848 | with a slash -- if they don't end with a slash, a slash will be |
| 849 | inserted before concatenating. | 849 | inserted before concatenating. |
| 850 | In most cases, one or more calls to `expand-file-name' are better | ||
| 851 | suited for the job than this function. Use this function only if | ||
| 852 | some of the special expansions done by `expand-file-name' get in | ||
| 853 | the way of what your program needs to do. | ||
| 850 | usage: (file-name-concat DIRECTORY &rest COMPONENTS) */) | 854 | usage: (file-name-concat DIRECTORY &rest COMPONENTS) */) |
| 851 | (ptrdiff_t nargs, Lisp_Object *args) | 855 | (ptrdiff_t nargs, Lisp_Object *args) |
| 852 | { | 856 | { |