Skip to content

mattfidler/dir-alias

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dir-alias: Create emacs specific directory shortcuts

Package motivation

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.

EmacsPortable.App specific shortcuts

When using EmacsPortable.App, the following directories aliaes are setup:

AliasTrue DirectoryDirectory Purpose
~ahk/Other/source/ahkAHK Sources Directory
~app/App/EmacsPortable.App Application Files
~ep/.EmacsPortable.App Directory
~ini/Data/iniEmacsPortable.App ini files
~nsi/Other/source/nsiNSIS Sources Directory
~pa/USB Drive:/PortableAppsPortable Apps
~shared/Data/start/sharedShared Customizations
~site-lisp/App/site-lispSite Lisp Directory
~src/Data/srcEmacsPortable.App lisp source files
~start/Data/startEmacsPortable.App Customizations
~system/Data/start/systemSystem-based Customizations
~usb/USB DriveUSB Drive
~user/Data/start/userUser-based Customizations
~h/System Home DirectorySystem 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 had dir-alias in ~src/, the overall alias would be ~dir-alias/

General shortcuts

With or without EmacsPortable.App, the following aliases are added:

AliasTrue DirectoryDirectory Purpose
~ed/~/.emacs.d/Emacs Settings Directory
~doc/~/DocumentsUser Documents directory
~el-get/el-get package directoryMain el-get package directory
~snip/main yasnippet directoryRoot directory of user-defined yasnippets
~git/~/git or ~/github directoryRepository of git files
~org/~/org directory~org root

Creating your own aliases

Aliases can be created from environmental variables, or specifying them in your startup

Environmental variable aliases

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.

Manual aliases

Write me…

About

Create Emacs Specific directory aliases

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published