Home » Questions » Computers [ Ask a new question ]

Can "~/" be re-bound to point somewhere else?

Can "~/" be re-bound to point somewhere else?

I'm using Emacs on Windows XP and whenever I type in "~/" it automatically replaces that with a directory, in my case its "C:/Documents and Settings//Application Data". Is there any way I can get that to point to another directory like, say, my projects directory on the Desktop? Every time I need to make a new file there I have to C-x C-f + the full path, and although tab completion makes it faster than it'd normally be, it'd be nice to have that one directory bound to something like "~/" for easy access. Is there any way that could be done?

Asked by: Guest | Views: 234
Total answers/comments: 2
Guest [Entry]

"All you need to do is to set the %HOME% environmental variable.
This can be done by going to:
start->settings->control panel->system
Click on the advanced tab. At the bottom is a button: ""Environmental Variables"".
Create a new variable called HOME and put the path you want in there.
Since most windows programs don't care about this variable, it is unlikely to affect anything else for you.

This can also be done by editing the registry entries for emacs. Here is some information on the registry variables: Ms Windows Registry."
Guest [Entry]

~ is a very old and well established synonym for 'the user's home directory' and that logic is probably buried deep inside emacs and unlikely to change unless you're willing to rebuild it from source after finding the appropriate code and changing it. On the other hand, you could probably set your shortcut to start emacs to start in your chosen directory, allowing you to save and load files without specifying a path. Probably.