all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Drew Adams <drew.adams@oracle.com>
Cc: bug-gnu-emacs@gnu.org, 4708@emacsbugs.donarmstrong.com
Subject: bug#4708: 23.1; completion-try-completion adds an extra $:  $$HOMj
Date: Tue, 13 Oct 2009 16:13:25 -0400	[thread overview]
Message-ID: <jwvljjfcb3e.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <E891DD6303114FE184F1FA4D2517DF4A@us.oracle.com> (Drew Adams's message of "Mon, 12 Oct 2009 12:05:32 -0700")

>>>>> "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	other threads:[~2009-10-13 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jwvhbu262yq.fsf-monnier+emacsbugreports@gnu.org>
2009-10-12 19:05 ` bug#4708: 23.1; completion-try-completion adds an extra $: $$HOMj Drew Adams
2009-10-13 20:13   ` Stefan Monnier [this message]
2009-10-13 22:20     ` Drew Adams
2009-10-14  2:40       ` Stefan Monnier
2009-10-14  3:36         ` Drew Adams
2009-10-14  4:10   ` bug#4708: marked as done (23.1; completion-try-completion adds an extra $: $$HOMj) Emacs bug Tracking System

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvljjfcb3e.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=4708@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=drew.adams@oracle.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.