[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: completion on environment variables?
From: |
Drew Adams |
Subject: |
RE: completion on environment variables? |
Date: |
Mon, 21 Sep 2009 22:52:38 -0700 |
> >> When I type a file name, I get the benefits of file name
> >> completion. However, if my path starts with an environment
> >> variable, there's no completion on the environment variable name.
> >> Is there a way to get completion to work on environment variables?
> >
> > Upgrade to Emacs 23.
>
> I think that feature has been around for quite some time --
> it's definitely available in Emacs 22.
It depends what was meant.
In Emacs prior to 23 (and going way back, perhaps to the Big Gnubang), hitting
TAB will expand a complete env var to its value. For example, if I'm in
directory /toto/foo/ and I type $HOME, then TAB, and $HOME has value
/titi/tata/, then the minibuffer input changes to /titi/tata/.
(Actually, what happens is, at least conceptually, two steps: /toto/foo/$HOME ->
/toto/foo//titi/tata -> /titi/tata.)
But that's not really completion of an env var itself. It's expansion of a
complete env var to its value.
What I thought was meant was the following feature, added in Emacs 23:
With /toto/foo/ in the minibuffer, I type $H and hit TAB. My input is completed
to /toto/foo/$HOME (with /toto/foo/ dimmed). A minibuffer message says that this
input is complete but not unique.
A second TAB shows these possible completions, in buffer *Completions*: HOME,
HOMEDRIVE, HOMEPATH. I can complete to any of them. If I hit RET, then the input
sent is /toto/foo/$HOME, which after expansion (as before) is /titi/tata/. If
$HOMEPATH has value /baz/boom/, and I type P, then TAB, then RET, then the input
sent is /toto/foo/$HOMEPATH, which after expansion is /baz/boom/.
This is completion of the env var itself, that is, completion of an env var
prefix ($H) to a complete env var ($HOME), and then expansion to its value
(/titi/tata/). All that was available prior to Emacs 23 was expansion of a
complete env var ($HOME) to its value (/titi/tata/).