Portable Emacs-onna-Stick – USB Geekiness

I had quite a phase of using Emacs a while ago. One problem I hit was that I’d find a great trick for using it for PHP and JavaScript stuff at work, then forget to copy the stuff to home. Then, I found a nice code-folding trick at home, and forgot to copy that to work. Once I realised, I had to fiddle about working out what bits I needed to copy between the two installations to make everything work the same.

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 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.

Filesystem GTD

I’ve done GTD in an assortment of different ways over the years, and one idea I’ve kept coming back to, but never quite used for long is running the whole system in the computer’s filesystem. The idea is that GTD is just a matter of lists, and the list of files and subfolders in a folder is a list, so the one could represent the other. Most of the stuff I actually work with is in some sort of computer file, so it would seem like a sensible way to do it.

I’ve tried it out, and it does work. I’ve got a PDA again now, though, which makes a pretty convincing argument for keeping everything in Outlook tasks, so I didn’t stick with it for long. In the time I’d been trying it out, though, BigNosedUglyGuy had been asking about it, so I put some notes together to let him know what I’d been doing. That also means I’m halfway through writing it up – might as well finish the job and post it…

The Basics

We need a folder to keep everything in, with a few subfolders. The whole set of folders can live anywhere, really. In a Unix system, you’d probably make a folder under your home ‘~’ folder. In Windows, My Documents may well be a good place. You could also consider keeping the whole thing on a card or USB ‘thumb’ drive, so it’s portable.

Under this folder, we’ll have a few subfolders.

Subfolders

!!Inbox

‘!!Inbox’ folder (!! keeps it at the top of the lists), where you can chuck anything new. This just acts like a virtual version of the in tray from standard GTD.

Active

An ‘Active’ folder for all active tasks and projects.

A task that doesn’t belong to a project is just a file dropped in here. So that we can find all these actions later, we need to give them standard names – I decided to use names in the format ‘@@Context@ Thing to do.txt’. These files can be any file type – plain text is good if it doesn’t need to be anything else – and if the only content is the fact that you have to do the thing, it can even be an empty file. The name is what we’ll search for to create the ‘context’ lists.

Journal files are good on my tablet PC, as you can just scribble away at ideas in them. If it’s something to do online, it could be a .url file in Windows – so the file is also a bookmark to the page you’ll need.

Contexts

With a standard GTD system, you have several context lists to keep your next actions in. Instead of that, we ‘label’ the files, then use a search to find all the ones with that ‘label’.

Anything that needs to be done at home, for example, would be a file, with the filename starting with “@@Home@”. If you need to replace the light bulb in the bathroom, you might have a file in the ‘Active’ folder called “@@Home@ Bathroom- Replace light bulb.txt”. In this case, there’s nothing you’re likely to need to refer to about it, so it’s just an empty text file.

If you need to visit PigPog for some papercraft project ideas, you might have a file called “@@Computer-Online@ Visit PigPog for papercraft ideas.url” – this one is a .url file – a shortcut to PigPog, so you can just double-click it and be on your way.

Active – Subfolders – Projects

Under the ‘Active’ folder are also subfolders, one for each project you have on the go. They can contain files and other subfolders if needed, related to the project, so all your notes can go in there, and if the result is going to be a document or blog post, the actual work can be in there too. Next actions are files with ‘@@Context@…’ names again, but left in the folder for the project.

Next Actions – Context Lists

To see the next actions associated with a project, you just look in the project folder, and they should all be up near the top becuase of the ‘@@’ at the start of the filename. To see the next actions in a particular context, search for files named ‘@@Context@’. When you complete an action, either delete the file, or rename it and move it. On the Mac, you can use search folders to do the work for you, and in Windows XP you can save searches and run them again by double-clicking them. The only problem with this is that the location to search in can only be saved if it’s one of the locations in the drop-down list. You can save a search for a specific drive, but not on a specific folder. If you keep the folder on a drive, that’s not a problem, but it it’s under My Documents, you might find that searches take a long time. I’m sure there’s other ways of doing the search that could get around this, though.

Most desktop seach programs build an index rather than actually searching, so they’d probably be pretty quick still. The only problems is that they might be out of date with files that change often.

If you have lists for ‘@@Computer@’, and for ‘@@Computer-Online@’, you can get either one by searching for them, or you can get both by searching for ‘@@Computer’ without the trailling ‘@’. Keep this in mind when you decide what contexts to use, and you’ll be able to combine them a bit. That way, when you’re at your computer and it’s online, you can bring up a single list of actions at the computer – both on- and off-line.

Completing Actions

When an action is complete, either delete the file, or if the contents of the file are still useful, just rename it to something else. Once it doesn’t start with “@@Context@ ” any more, it won’t be found by your searches.

Good Points

  • You can keep any files at all in there, and keep all the stuff relating to a project right where you need it.
  • Easy to capture stuff when it arrives as a file of any sort, by just dumping it in the !!Inbox folder.
  • Could be made cross-platform. If you need to work on Windows at work, and Mac at home, you could use the same set of files on a USB ‘thumb’ drive, and just use saved searches in Windows and Search Folders on the Mac. I don’t think there’s anything built into most Linux systems for saving these searches, but it could be made very smooth and easy from the command line with some simple scripting, I’m sure.

Bad points

  • Not so easy to sync to a mobile device, compared to using Outlook.
  • Never found a really quick way of capturing new stuff that wasn’t in files. Journal isn’t bad on the tablet, but on a normal PC, creating new files isn’t that quick and easy.
  • Didn’t feel natural to me – definitely not using something designed for the job.

Conclusion

Well, it wasn’t for me. Might work well for someone else, though. If you don’t use a PDA, and need to access the same data on different systems at home and work, it might be a decent enough method. I’m guessing someone with a bit of scripting skillz could do some good stuff with this under Unix.

Alternatively, you could skip all this playing with your system, and just get things done instead.

Don’t worry, I’ll keep fiddling with new systems for you.