GNU bug report logs -
#4708
23.1; completion-try-completion adds an extra $: $$HOMj
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Mon, 12 Oct 2009 19:10:06 UTC
Severity: normal
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
>>>>> "Drew" == Drew Adams <drew.adams <at> 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
This bug report was last modified 15 years and 284 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.