>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)xemacs.org> writes:
Hrvoje> Adrian Aichner <adrian(a)xemacs.org> writes:
>>>>>> "bobchan" == bobchan
<bobchan(a)webone.com.au> writes:
>
bobchan>
================================================================
bobchan> Dear Bug Team!
>
bobchan> Try this experiment:
>
bobchan> echo "This is from /tmp" >
/tmp/~somefile
bobchan> echo "This is from ~/" > ~/~somefile
>
bobchan> In (X)Emacs:
>
bobchan> C-x C-f /tmp/<C-q>~somefile
>
bobchan> Output:
>
bobchan> "This is from ~/"
>
bobchan> Now, why is that?
>
>> Hi bobchan, what you are experiencing is
electricity.
Hrvoje> Note that "electricity" is when what are normally
Hrvoje> self-insert keys behave specially, e.g. "/" and "~" in
Hrvoje> minibuffers. But he is *not* experiencing that because he
Hrvoje> used <C-q> explicitly.
I first saw that C-q, but forgot about it while searching for
documentation references.
The only thing I found is that
minibuffer-electric-file-name-behavior
does not seem to be documented anywhere outside its docstring.
Hrvoje> It sounds like a (mis)feature in the read-file-name
Hrvoje> designed to deal with electricity *not* being available,
Hrvoje> probably inherited from FSF. Without electricity, you
Hrvoje> *have* to handle "/tmp/~/x" as "~/x", otherwise people
Hrvoje> would have to use `C-a C-k' every time.
Hrvoje> The culprit is `substitute-in-file-name', called by
Hrvoje> `read-file-name-2'. Note that expand-file-name was fixed
Hrvoje> some time ago (probably during my synch with FSF 19.34) to
Hrvoje> not mangle "/.../~foo", but substitute-in-file-name
Hrvoje> wasn't. Therefore:
Hrvoje> (expand-file-name "/tmp/~blah")
-> "/tmp/~blah"
Hrvoje> (substitute-in-file-name "/tmp/~blah")
-> "~blah" ; WRONG!
Hrvoje> FSF has the same bug.
But the example you comment as WRONG is exactly the behavior
documented in the substitute-in-file-name docstring in 21.5-b16:
If `/~' appears, all of FILENAME through that `/' is discarded.
Are you sure this is wrong?
expand-file-name explicitely refers to substitute-in-file-name.
I am not sure what we are seing is a bug unless the docstring is alos
a bug.
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/