[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: substitute-in-file-name and "$"
From: |
Michael Albinus |
Subject: |
Re: substitute-in-file-name and "$" |
Date: |
Sun, 06 Jul 2003 16:30:11 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/20.7 (hpux) |
Luc Teirlinck <address@hidden> writes:
> None of the examples in the Elisp manual, (elisp)File Name Expansion,
> involves Elisp variables. Even when working with variables, it would
> seem that you can call (substitute-in-file-name filename) 1001 times
That's right.
> without danger (it has no side effects). Danger arises from stuff
> like:
>
> 1. (setq filename (substitute-in-file-name filename))
>
> or
>
> 2. (my-favorite-file-function (substitute-in-file-name filename))
>
> The Elisp manual could point out that (1) should only be done if the
> user really knows what he is doing. Usually, using the return value
> of (substitute-in-file-name filename) only at the time it is actually
> needed (and _not_ changing filename itself at that time) or doing:
>
> (1b) (setq substituted-filename (substitute-in-file-name filename))
>
> will be safer.
That's right, too.
> In as far as (2) is concerned, the documentation string of
> `my-favorite-file-function' should clearly point out what operations
> it is going to perform on filename. If not, that is a bug in the
> documentation string. In that case, the Elisp user could try to
> figure it out by experimentation and file a bug report. If
> `my-favorite-file-function' is going to pass filename on to other
> functions it calls, it should exercise a similar care itself.
That wouldn't be possible. You know what `my-favorite-file-function'
is doing the default case. You don't know what's going on with an
alternative implementation within another file name handler. Would you
like to say for every file name operation "substitute-in file-name is
called" (or not)? And even if you do it, you cannot control, because
it could be called indirectly, within another file name function you
use.
> And, btw, if substitute-in-file-name can be called only once, how do I
> know it where to perform this call? And what shall the others do, if
> they would like to perform substitute-in-file-name? Requote "$"? Or
> apply an optional parameter (to be introduced), which forces this?
>
> Do you have examples where there is a real need to do (1) instead of
> (1b)? I have a hard time thinking of examples in the abstract, let
> alone of examples occurring in actual situations. Unquoting and then
> requoting seems like a senseless circular operation to me.
`PC-do-completion' must do it, because the result is shown in the
minibuffer.
Or a file name like this: "$NEXT_HOP:/share$$", where $NEXT_HOP has
the value "/smb:next.hop.com". At least case (2) would be needed,
because Tramp file name handler could be activated only after applying
substitute-in-file-name to that file name.
> Sincerely,
>
> Luc.
Best regards, Michael.
- substitute-in-file-name and "$", Michael Albinus, 2003/07/05
- Re: substitute-in-file-name and "$", Miles Bader, 2003/07/05
- Re: substitute-in-file-name and "$", Kim F. Storm, 2003/07/06
- Re: substitute-in-file-name and "$", Michael Albinus, 2003/07/06
- Re: substitute-in-file-name and "$", Stefan Monnier, 2003/07/06
- Re: substitute-in-file-name and "$", Stefan Monnier, 2003/07/06
- Re: substitute-in-file-name and "$", Michael Albinus, 2003/07/07
- Re: substitute-in-file-name and "$", Stefan Monnier, 2003/07/07