I use Emacs and ESS for R programming and usually I work in a few specific folders. Due to the configuration of my working environment, the folders that I work on is usually "very deep" in each folder structure, i.e., I need to specify several subfolders before reaching the directory that I work in:
/Desktop/SUB1/SUB2/SUB3/SUB4...
It's tedious and I have to repeatedly use CTR+X
CTR+F
to find the files, even I only need to work in a few places. I am wondering, is there any possibility that allow me to define a few variables that stores the common locations that I work on, and when I need to find any script, I only need to invoke something like:
$SHORTCUT/Script.R
This would be a function like a bookmark in the Linux window manager. I understand there is a global setting environment that allows you to set the default directory. However, that will only make the work a bit easier for one folder. It's an improvement, but still not good enough if I am working on several projects simultaneously.
Any suggestions?
Here you have a few options. I have 2 in store for you bookmarks and file-registers if you execute the following command
(set-register ?a '(file . "~/.emacs"))
Then execute C-x r j a
or M-x jump-to-register a
you will jump to your .emacs file. I encourage you to read the docs on registers they are quite handy.
The second one is bookmark. You can bookmark files or directory by using C-x r m
in the buffer on interest. Don't forget to save the bookmarks or they will disappear next time you restart emacs. M-x bookmark save
update A third option would be the use of keychords package which you can find on melpa
(defun open-this ()
(interactive)
(find-file "~/.emacs") )
(require 'key-chord)
(key-chord-mode 1)
(key-chord-define-global "=-" 'open-this)
then by pressing =-
simultaneously or fast enough you would go to the .emacs file. A nice feature is that you could use local mode as well so the same key-chord would do different things depending on your mode.