emacs-devel
[Top][All Lists]
Advanced

[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 01:16:44 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/20.7 (hpux)

Luc Teirlinck <address@hidden> writes:

> Michael Albinus wrote:
>
>    There is no rule that substitute-in-file-name must be called only
>    once.
>
> Even if this rule is not stated explicitly, this just seems to be
> common sense.  It would appear that this is just a special case of the
> general rule that one should avoid bugs.

At least the examples in the Elisp manual give the feeling that
substitute-in-file-name could be called without special attention. The
trap with the "$" char isn't obvious.

>    For example, if you use partial-completion-mode, the filename in
>    the minibuffer will be passed through substitute-in-file-name by
>    PC-do-completion. Later file name operations which call internally
>    substitute-in-file-name will fail therefore.
>
> To me, it would seem obvious that this is a bug in `PC-do-completion'.
> It can not handle filenames containing a literal `$'.

It takes any file name you offer. But at least it should perform a
special handling for "$" (requoting), as Stefan mentioned already in
the original thread in gnu.emacs.help.

> You say "for example".  Are you aware of tons of similar bugs
> throughout the Emacs code or is `PC-do-completion' an isolated
> example?

At least I've done the same bug in tramp-smb.el (corrected). No, for
the time being that's the only case I know. But I fear that there are
other cases, because occasionally I get such reports for tramp-smb I
couldn't catch the origin. I'll investigate harder.

>    What I'ld like to know: Is it a general rule, that
>    substitute-in-file-name can be called only once for a given file name?
>    Then it should be documented in the Elisp manual, and it is a bug in
>    PC-do-completion. Or is it a more general design problem?
>
> It might actually be good to mention this potential trap in the Elisp
> manual.  However, this is a matter of avoiding bugs, not a matter of
> following some stylistic "rule".

Not only a stylistic "rule" but a design constraint. So it is worth a
note in the manual.

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?

> Sincerely,
>
> Luc.

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]