Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use environmental variables in find-file?

Tags:

emacs

emacs24

I'd like to use environmental variables in find-file command. Something like this:

C-x C-f $ENV_VAR/foo.txt

Does find-file have this functionality? What is the syntax?

like image 503
Vasiliy Avatar asked Oct 20 '22 03:10

Vasiliy


1 Answers

As Barmar said, it works as you say... as far as you are not using ido or similar.

Type C-h k C-x C-f to know if you are using any enhanced wrapper for find-file, like for instance ido.

If you are using ido, you can type C-f in the prompt to revert back temporarily to the old plain find-file prompt, where you can type for instance $HO <tab> (to complete to $HOME), then write something like /.pro <tab> to complete to $HOME/.profile, etc.

If you were using another, you should check the documentation because they probably have a fallback method to.

like image 180
juanleon Avatar answered Oct 24 '22 00:10

juanleon