changeset 51793:ccbf5ac3316d

(File Name Expansion): Warn about iterative use of substitute-in-file-name.
author Richard M. Stallman <rms@gnu.org>
date Mon, 07 Jul 2003 20:48:26 +0000
parents 8896f8091409
children 8a7816e7f5bd
files lispref/files.texi
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lispref/files.texi	Mon Jul 07 20:44:13 2003 +0000
+++ b/lispref/files.texi	Mon Jul 07 20:48:26 2003 +0000
@@ -1809,15 +1809,26 @@
 
 @defun substitute-in-file-name filename
 This function replaces environment variables references in
-@var{filename} with the environment variable values.  Following standard
-Unix shell syntax, @samp{$} is the prefix to substitute an environment
-variable value.
+@var{filename} with the environment variable values.  Following
+standard Unix shell syntax, @samp{$} is the prefix to substitute an
+environment variable value.  If the input contains @samp{$$}, that is
+converted to @samp{$}; this gives the user a way to ``quote'' a
+@samp{$}.
 
 The environment variable name is the series of alphanumeric characters
 (including underscores) that follow the @samp{$}.  If the character following
 the @samp{$} is a @samp{@{}, then the variable name is everything up to the
 matching @samp{@}}.
 
+Calling @code{substitute-in-file-name} on output produced by
+@code{substitute-in-file-name} tends to give incorrect results.  For
+instance, use of @samp{$$} to quote a single @samp{$} won't work
+properly, and @samp{$} in an environment variable's value could lead
+to repeated substitution.  Therefore, programs that call this function
+and put the output where it will be passed to this function need to
+double all @samp{$} characters to prevent subsequent incorrect
+results.
+
 @c Wordy to avoid overfull hbox.  --rjc 15mar92
 Here we assume that the environment variable @code{HOME}, which holds
 the user's home directory name, has value @samp{/xcssun/users/rms}.