This was originally made for EmacsPortable.App. EmacsPortable.App
runs emacs off a usb or removable drive. When running an application
off the USB drive, the directories will change based on the system
running. For example, the usb may be on /Volumes/USB/
or
/mnt/hda1/
or e:/
. To make things consistent between platforms,
this package creates abbreviated file names that should be consistent
between every platform. In each case, this would be abbreviated to
~usb/
.
After using this for some time, I found the abbreviations useful for many directories, and thought that others may also like the directory shortcuts.
When using EmacsPortable.App, the following directories aliaes are setup:
Alias | True Directory | Directory Purpose |
---|---|---|
~ahk/ | Other/source/ahk | AHK Sources Directory |
~app/ | App/ | EmacsPortable.App Application Files |
~ep/ | . | EmacsPortable.App Directory |
~ini/ | Data/ini | EmacsPortable.App ini files |
~nsi/ | Other/source/nsi | NSIS Sources Directory |
~pa/ | USB Drive:/PortableApps | Portable Apps |
~shared/ | Data/start/shared | Shared Customizations |
~site-lisp/ | App/site-lisp | Site Lisp Directory |
~src/ | Data/src | EmacsPortable.App lisp source files |
~start/ | Data/start | EmacsPortable.App Customizations |
~system/ | Data/start/system | System-based Customizations |
~usb/ | USB Drive | USB Drive |
~user/ | Data/start/user | User-based Customizations |
~h/ | System Home Directory | System Home Directory |
In addition to these aliases, the following aliases are also defined:
- All the directories in
~src/
are expanded into abbreviations. For example, if you haddir-alias
in~src/
, the overall alias would be~dir-alias/
With or without EmacsPortable.App, the following aliases are added:
Alias | True Directory | Directory Purpose |
---|---|---|
~ed/ | ~/.emacs.d/ | Emacs Settings Directory |
~doc/ | ~/Documents | User Documents directory |
~el-get/ | el-get package directory | Main el-get package directory |
~snip/ | main yasnippet directory | Root directory of user-defined yasnippets |
~git/ | ~/git or ~/github directory | Repository of git files |
~org/ | ~/org directory | ~org root |
Aliases can be created from environmental variables, or specifying them in your startup
You can setup variable aliases easily by just specifying them in
dir-alias-env
. For example, dir-alias
sets up the following aliaeses.
(dir-alias-env "mydoc"
"temp"
"ProgramData"
'("pd" "ProgramData")
"ProgramFiles"
'("pf" "ProgramFiles")
"userprofile"
'("up" "userprofile")
"appdata"
;; "homepath"
"systemroot"
'("win" "systemroot")
"localappdata"
'("h" "ohome"))
For all specified environmental variables as strings, like “mydoc” or “temp”:
- dir-alias makes sure the environmental variable specifies a directory
- If the environmental variable specifies a directory, setup an alias
for the environmental variable based on its name. For example
“mydoc” would be aliased to
~mydoc/
.
When the argument is a list instead, the first string represents the
alias, and the second string represents the file environmental
variable. For example =’(“h” “ohome”)= says that if there is an
enviromental variable OHOME
that has a directory that exists, setup
the alias ~h/
to access that directory.
Whenever an alias already exists, ignore the new alias when using
dir-alias-env
. If you wish to overwrite any alias, you need to use
dir-alias-env-force
.
Note that these alias are setup at the time dir-alias
is loaded. If
these environmental variables change, they are not updated in dir-alias
.
Write me…