bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4708: 23.1; completion-try-completion adds an extra $: $$HOMj


From: Stefan Monnier
Subject: bug#4708: 23.1; completion-try-completion adds an extra $: $$HOMj
Date: Tue, 13 Oct 2009 16:13:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>>>>> "Drew" == Drew Adams <drew.adams@oracle.com> writes:

> emacs -Q
> M-: (completion-try-completion "c:/some-dir/$HOMj" nil 16)
 
> correctly returns: (c:/some-dir/$HOMEj" . 17)
 
> M-: (completion-try-completion "c:/some-dir/$HOMj" nil 17)
 
> returns: ("c:/some-dir/$$HOMj" . 18)
 
> That doesn't seem correct. Is it correct to have $$ here? If so, can
> you please explain it a bit (why)?

File name entry assigns a special meaning to $ for envvars, but in order
to be able to refer to the file "$HOME", it offers an escape system
where you write "$$HOME".  Since Emacs-21 or so, I've made this escape
unnecessary in the case where the $ is used unambiguously (because
there is no envvar of this name), so if you enter "$HOMj", Emacs know
you don't refer to the file name contained in the envvar `HOMj', but to
the file named $HOMj.

The completion code need to do such unescape/reescaping in order to work
properly and it currently re-escapes in a conservative way (i.e. it
re-escapes $HOMj into $$HOMj even tho it's not strictly necessary).

File name completion is designed to result a string appropriate for
substitute-in-file-name, and indeed

   (substitute-in-file-name "c:/some-dir/$$HOMj")
   ->
   "c:/some-dir/$HOMj"

> Also, if this is correct behavior, then please explain this in the doc
> string of `completion-try-completion'.

It can't be described there, because that function applies to any kind
of completion, whereas the above only applies to completions using
read-file-name-internal.


        Stefan





reply via email to

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