From: Michael Albinus <Michael.Albinus@alcatel.de>
Cc: emacs-devel@gnu.org
Subject: Re: substitute-in-file-name and "$"
Date: Sun, 06 Jul 2003 16:30:11 +0200 [thread overview]
Message-ID: <nqllvbn2x8.fsf@alcatel.de> (raw)
In-Reply-To: <200307052358.h65NwLs06030@raven.dms.auburn.edu> (Luc Teirlinck's message of "Sat, 5 Jul 2003 18:58:21 -0500 (CDT)")
Luc Teirlinck <teirllm@dms.auburn.edu> 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.
next prev parent reply other threads:[~2003-07-06 14:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-05 16:44 substitute-in-file-name and "$" Michael Albinus
2003-07-05 18:29 ` Luc Teirlinck
2003-07-05 23:16 ` Michael Albinus
2003-07-05 23:58 ` Luc Teirlinck
2003-07-06 12:20 ` Kai Großjohann
2003-07-06 12:44 ` Miles Bader
2003-07-06 14:30 ` Michael Albinus [this message]
2003-07-06 16:24 ` Luc Teirlinck
2003-07-06 16:53 ` Kai Großjohann
2003-07-07 15:48 ` Michael Albinus
2003-07-06 0:07 ` Miles Bader
2003-07-06 12:07 ` Kim F. Storm
2003-07-06 14:37 ` Michael Albinus
2003-07-06 17:06 ` Stefan Monnier
2003-07-06 17:20 ` Stefan Monnier
2003-07-07 11:50 ` Michael Albinus
2003-07-07 14:34 ` Stefan Monnier
2003-07-07 16:10 ` Michael Albinus
2003-07-09 23:47 ` Richard Stallman
2003-07-07 3:39 ` Richard Stallman
2003-07-07 21:33 ` Kevin Rodgers
2003-07-08 20:02 ` Richard Stallman
2003-07-06 18:53 ` Richard Stallman
2003-07-06 23:46 ` Kim F. Storm
2003-07-06 21:55 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nqllvbn2x8.fsf@alcatel.de \
--to=michael.albinus@alcatel.de \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).