Portable Emacs-onna-Stick – USB Geekiness
Update: Moving this to a new platform, as it still gets a few clicks, and hopefully still works. Removing links to the site I got the method from, as it seems to have gone.
I’m back with Emacs now, and trying to use PlannerMode for basic ‘GTD stuff’. If I can’t take my lists to work with me, though, it’s a bit less convenient. It’s much easier to have access to the lists there than to have to email stuff to work that I need to do there, or to home that I need to do there.
Today, though, I found what seems like the answer. I already tend to carry a USB stick drive thing around with me. Now, I can run Emacs from there, with all its data stored on a ‘home’ folder on there too. I got the idea of how to do it from this (gone!) blog post from clmemo@aka. It relates to doing the same thing with a version of Emacs set up for AUCTeX, but it works just the same with standard GNU Emacs.
What you need to do is…
- Copy an emacs folder to the USB stick, just as if you were installing it – just an unzipping of the Gnu Emacs for Windows distribution (sorry – no idea if any of this works with XEmacs).
- Under the emacs folder, there should already be a site-lisp folder. In it, create a file called site-start.el, which will be run every time Emacs starts, before your .emacs.
- Add this code to site-start.el…
(defvar usb-drive-letter (substring data-directory 0 3)) (defvar usb-home-dir (concat usb-drive-letter "home/")) (setenv "HOME" usb-home-dir)
- Create yourself a home folder in the root of the USB drive. Copy all your usual Emacs home stuff to there – your elisp folders, your .emacs, Plans folder if you’re using PlannerMode, etc.
- If all this works as it should, when you run runemacs from the USB drive, you should find that the home path (~) is remapped to the USB drive within Emacs. For me, ~ in emacs is now ‘F:\home\’. All my Plans files, my .emacs, and all my elisp stuff can go to work and back in my pocket.
This solves a bit of a problem for me, and I’m sure I can’t be the only one with that problem – thank to clmemo@aka for showing me the answer.