schussman.com logo

Using Alfred to manage tasks

Recent updates to Alfred (my earlier post here) have greatly enhanced its capabilities to run local scripts and extensions. I’ve long used the Journal Tasks TextMate bundle in conjunction with geektool to manage and display a small to-do list in one corner of my OS X desktop, and now with Alfred I can instantly add items to that list. Quite slick.

Here’s the task list viewed in TextMate: Simple and no frills.

quick list textmate

And geektool displays it on the desktop using a bit of awk:

awk '!/@done/' ~/DropBox/SimpleText/Quick\ List.taskpaper

quick list desktop

I’ve set up an Alfred extension to add to the list using the “do” command:

alfred quicklist

The command in Alfred looks like this:

perl -p -i -e 's/^Quick List:\n/Quick List:\n\n- {query}/' ~/Dropbox/SimpleText/Quick\ List.taskpaper; growlnotify -m "Added item to quicklist"

It finds the header for the appropriate part of the list, and inserts the query passed to it at the top of the list. (Update paths as appropriate; I keep my quick list file in my DropBox folder.)

Growl provides a nice visual confirmation that the item has been added. I still have to open the file in TextMate to mark items as @done and periodically expunge completed items, but it’s great to be able to effortlessly add to the list.

The entire Alfred extension is at github.

Tasks + Journal in TextMate

A couple of years ago (whoa now, three and a half years ago?!) I commented on using the TextMate Journal Bundle to keep a snippets log. I still use that same snippets file for some references and a handful of things that don’t quite fit in 1password.

When 2010 rolled around, I started up a new journal file to use for a little bit more writing, and quickly found that I wanted to mix content within that file — specifically, I wanted to add tasks and treat them more functionally than straight markdown list items. Henrik Nyh’s TextMate Tasks bundle handles to-do lists quite well, so I cobbled together a combination of the two bundles. A screenshot of some of these integrated journal+tasks lists is below:

JournalTasks bundle screenshot

Combined, I get the nice markdown-compatible writing of the journal bundle, plus its keywords, search, and folding capability, along with the nested list feature of Tasks.

Use the journal bundle’s dts and dtsp tab triggers to start new entries complete with date stamps (and clipboard contents in the case of dtsp). You can write text into any entry, and intersperse lists at any point by starting a line with - (indent with one or more spaces to create sub-lists; Tasks will love it). Toggle list items to complete with cmd-D, and cmd-E will remove expired items.

I like just being able to put lists into markdown-enabled writing, but there’s a nice Getting Things Done application here, as well: Since the folding in the journal bundle is so easy, you can make @context entries, fill them with actions, and fold them to get out-of-scope contexts out of the way. Drop the name of the scope into a keyword, and the Find in Bundle command will produce a nice list of the first entry in a given context that matches a search. It’s simple but workable for GTD, if you’re into that sort of thing.

A variation that’s even more direct GTD-style tasking is to use @context tags anywhere in your entries and then employing the “find tasks” command to display only the desired matches. Use either or both find commands to fit your style and workflow!

Note that the Tasks bundle is inspired by the very good TaskPaper app. If you’re interesting in something a bit more full-on for lists (and GTD) that also has a bunch of extensions and related projects, do check it out. (Since TaskPaper works with text, you can even load files from Tasks+Journal or Tasks right into it and maintain some (but not all) functionality. I’ve done a little bit of further tweaking to maintain that compatibility in my bundle, like change Henrik’s check-mark back to the “@done” syntax that TaskPaper users (and update the bundle’s commands accordingly), which lets me switch back and forth pretty smoothly.

The JournalTasks bundle is available at github.

Replacing Edit in TextMate with QuickCursor

After upgrading to Snow Leopard on my MacBook, I found that the Edit in TextMate hook wasn’t working. There were a few threads about re-enabling it, but nothing definitive, and the support page suggests either running any target applications (those in which you want to use Edit in TextMate) in 32-bit mode, or perhaps trying some uninstall-reinstall voodoo. Since neither of these were ideal, I thought I’d try the “last-resort” suggestion, QuickCursor.

After a few minutes of use, QuickCursor seems to me to be a great improvement over Edit in TextMate — far from an “if everything fails” option, I prefer it for most of my uses.

  1. Installation is easy. Download, copy to Applications folder, and run it.
  2. Configure: I set it to load on bootup, and it automatically found TextMate as one of my editor options. I assigned TextMate the same keyboard shortcut that Edit in TextMate once occupied (cmd-ctrl-E).
  3. Use! From a Safari field, hit the shortcut and up pops a TextMate window; edit away, save, and your text appears in the Safari field. So far, just like Edit in TextMate, with the added bonus of being uncomplicated and functional in Snow Leopard. But here’s where it improves on the original: Edit in TextMate required the “target” window to be in focus in the target application; that is, when using Safari with multiple tabs open, the tab with the target “edit in” field had to be the active tab. This meant that if you opened an “edit in” TextMate window, then flipped through a few tabs to find something, you would have to relocate the target tab before being able to save from the TextMate window. QuickCursor doesn’t have this limitation: You can open multiple editing windows from multiple tabs, edit any/all of them, and save your edits without worrying about which application or tab is in the foreground. Bingo!

There are a couple of important caveats to QuickCursor that may make it not an ideal solution for some users (my bolds):

QuickCursor depends on two technolgies. For reading/writing data from the original application is uses the accessibility api. The nice thing about that API is that it’s not a hack, it’s a supported API. But unfortunatly not all views support the accessibility api (at least not read/write of the text content). And in particular webkit views don’t support it. And that means that tools that use webkit as their editor (such as Mail.app) won’t work with QuickCursor.

That means that Firefox doesn’t work with QuickCursor, either, since it doesn’t use the accessibility API. Since I’m a Safari user, and never much used Edit in TextMate for Mail, QuickCursor is pretty spot-on ideal for me.

Text editors have more fun

When was the last time Microsoft Office gave you a holiday treat? TextMate gets all dressed up for Halloween.

textmate's halloween icon

More photos at flickr.

Sweave and complex projects

A thread on R-Help recently discussed using Sweave/LaTeX for complicated projects. Two really useful tips were highlighted in that conversation—I use the first of them regularly: In the beginning of a Rnw/Snw file, use the prefix.string option to set the location of an includes directory: \SweaveOpts{prefix.string=/Path/to/directory}

This is really useful for organizing all the files that built by your project. (Mine are all directed to an includes directory that lives beneath my main manuscript directory.)

The second tip is to use a makefile to build a project that consists of multiple Sweave files. I like makefiles as much as the next guy, but here is my TextMate-specific solution for the same dilemma: Within the TM project, use the TM_SWEAVE_MASTER variable to name a master file, and in this file, simply plug in a single Sweave section that invokes source (for R-only files) or Sweave for your project’s various files. When you want to build the whole project (for example when you begin work for the day and need to load up all your data) all you do is open up the project and invoke the Sweave -> Sweave Project in R command.

For example, my dissertation project sets TM_SWEAVE_MASTER to “diss-master.Snw,” and that file looks like this:


<<echo=false,results=hide>>=
source(file="˜/data/diss/R/clean-summary.R")
source(file="˜/data/diss/R/tables.R")
source(file="˜/data/diss/R/figures.R")
source(file="˜/data/diss/R/citystats.R")
Sweave(file="˜/docs/diss/manuscript/data-collection.Snw")
Sweave(file="˜/docs/diss/manuscript/longevity.Snw")
@

The several R files do a little bit of data tweaking and build some tables/figures. Once all that data is loaded up, the two Sweave files can be built. I do this once per work session, using the Sweave Project in R command, which makes sure everything in the project is up to date. Subsequently, I can simply Sweave any individual Snw file (using the corresponding TextMate command), without having to recompile the entire project. (This all of course integrates well with using TM_LATEX_MASTER, also set at the project level, to order LaTeX to typeset the overall document.) I have found it to be a really nice and functional workflow.

R console in TextMate

A neat new bit of functionality for TextMate came through the svn pipe today, thanks to Haris:

Log for r5298

Added Console functionality to R. To use it, you need to have R.app up and running. Open a new document and set its language to “R Console”. Start by typing ”> ”. From now on, pretend you are in the R.app’s console.

Cool.

Sweave Bundle update

Note (mostly) to self: I made a few small updates to the Sweave Bundle for TextMate. Interested parties, you know what to do.

TextMate GTD

2010 update: Ever ready to tinker with organization schemes, I’ve done some adaptation of the Journal and Tasks bundles for TextMate to produce another, very very lightweight way to implement a Getting Things Done routine in Textmate. Check out the JournalTasks bundle if you’re so inclined.

—-

Haris Skiadas, who has made massive contributions to writing in LaTeX with TextMate (see for example his screencasts of good use of the LaTeX bundle), has put together a super TextMate GTD bundle. Haris has been hacking on it nearly-continously for several days — I confess to having harassed him significantly throughout development so far — and the bundle is a fully-capable GTD system: You can work with a single document, or as many as you want, can easily move projects around, add tasks, and add and modify contexts. The bundle has a number of commands to generate Next Actions lists, and it will archive completed tasks/projects to a separate log file.

Up until now, I’ve been using the Kinkless GTD system. Lately, however, that software began to feel a little cumbersome, a little too cognitively heavy and opaque. Since it lives in TextMate, Haris’s GTD bundle works with pure text, making highly extensible, and it works great (it even knows how to convert your Kinkless document to its own format). Today Haris capped it off with a script that filters an inbox (fed via Quicksilver) into your GTD documents. Seriously cool. I highly recommend giving it a try if you’re using either TextMate or GTD (or need an excuse to give either one a test drive).

TextMate: Modified find in journal command

I’ve been using BSAG’s Journal bundle (itself a markdown extension) for a little while now, to keep a sort of snippet log, and I’ve put together a quick command to search entries by keywords (I hacked up the “Find in Document” command of the TM bundle). Keywords are marked by brackets: [key1,key2,etc]. The command just finds given text and shows the first line or so of the actual snippet entry, to give it some context. It’s very simple, but I’ve found it useful to quickly find entries by keyword, so I thought I’d share it. Here’s a screenshot:

TextMate: Find in keywords command

You can download the command here. To install it, just click on the .tmCommand file, and TextMate should take care of the rest. (You’ll also, of course, need to be using TextMate and BSAG’s Journal bundle.)

Jumping Ship: Moving from emacs to TextMate

Update: Not quite ready to give up all the nice authoring features of emacs, I built, with some tinkering, a reftex-style citation command for the TextMate/LaTeX bundle. It has since been incorporated into the main LaTeX bundle.

Update: The Sweave bundle is updated as of Oct 5 2006. Thanks to Haris for the contributions and improvements.


Yesterday I linked to a screencast that shows off some the neat things that one can do with the math bundle in TextMate. TextMate continues to get better, and it has become my primary editor on OSX. Kieran posted a comment about TextMate’s relative lack of functionality with regard to LaTeX and R:

I was looking into TextMate but its latex and R support is still fairly basic — there’s no real equivalent to auctex/reftex’s functionality, and the R bundle is rudimentary. This is a pity, as it seems like a really powerful environment, and for some time I’ve been looking for a way to escape from Emacs and use an OS X native, modern editor/IDE. Maybe soon.

Kieran is right in part: Auctex and Reftex are excellent additions to emacs and TextMate can’t yet match them. But it does offer some nice advantages over emacs, so I thought I’d write up a few thoughts on my transition to TextMate and the ways I’ve found to compensate for no longer having access to my beloved C-c C-c RET.

Why switch

OS X is a pleasant working environment, and even builds of emacs that are meant to fit nicely in that environment still don’t feel native. Aquamacs is one such attempt. For brand new users of emacs, Aquamacs may be a good tool, but for those of us with pre-existing byzantine .emacs files, Aquamcs adds a whole additional level of confusion by changing keybindings and introducing a whole new set of configuration options. Despite all the attempts to make it more modern, setting one’s typeface in the editor remains a frustrating exercise. My machine is relatively modern and speedy, and emacs still takes a good long time to load fully, even after pruning unnecessary cruft from my config file. And once loaded, there are just enough interface differences to be jarring: scroll bars, for example, are something that most emacs builds have never really sorted out. It’s 2006; can I please get a scroll bar that works the same way as every other scroll bar on my machine?

It’s not about bling, however. As projects such as my dissertation grew in size — multiple data, LaTeX, R, and Sweave files spread around the place — the organization of all that material started to occupy an increasing chunk of my cognitive space. “Where’s file goober, and how is it related to file data?” Although emacs handles lots of files just brilliantly, and switching between them is a snap if you’ve loaded the right iswitch-b package, it doesn’t help much with the organization end of things. That was my real original incentive to switch: I wanted my software to take a little of the load off of my brain, and perhaps to do it a little more quickly.

Finally, switching is a nice opportunity to review the way I get work done and think conscientiously about how to improve. On the flip side, it’s also a nice way to structurally procrastinate.

Why not switch?

Emacs is powerful. It can read email, browse the web, make a fully-functional wiki right on your desktop, and, on those occasions when appropriate, it can edit text files with championship ability. It is a mature working environment with brilliant integration with LaTeX, BibTeX, and R. Just using it can make one feel like a ninja, albeit a meek, deskbound one with rapidly deteriorating vision and nascent repetetive stress disorder in the wrists. As Kieran commented, nothing quite approaches the combination of AucTeX and RefTeX. I’m still reaching for those key-bindings that, alas, don’t work in TextMate no matter how many times I C-c [ them.

Built-in magic

TextMate immediately addressed my core reason to switch with its handling of projects. It has a project drawer into which you can simply drag files and folders, create separators, and arbitrarily organize them all. It seems like a small thing, but the ability to see all the files that comprise a project, and then navigate them easily, is something that’s a) really important in order to have a clear sense of what I’m working on, and b) remarkably difficult in emacs.

 


click-enlarge

 

Navigating those files is easy, as well: You can find and click in the project list, switch tabs with the keyboard, or hit cmd-T to bring up a file browser that finds files as you type: “cmt-T cl” narrows the list to those files that match the pattern “cl.” It pretty nicely approximates the autocompletion of switching buffers in emacs.

 

Many pieces loosely joined

TextMate is, like emacs, extensible almost to the point of absurdity. The architect of this extensibility built TextMate to hook into virtually any programming language, shell command, and external application. TextMate comes with built-in support for LaTeX and BibTeX compilation, as well as completing citations and labels within LaTeX documents. The latter function isn’t nearly as slick as using RefTeX, but it works fairly well. There are a few useful screencast demonstrations of those features. Haris, the author of those screencasts, has contributed tremendously to cite key and label completion — they work pretty well, thanks much to him.

I’ve made what I think are a few improvements to existing bundles in order to faciliate my own work: I’ve modified the LaTeX compile command to switch to xelatex if necessary, for example.

More in depth, but still fairly simple, is my rudimentary Sweave bundle for TextMate.1 TextMate allows one to set environment variables at the global or project level, so, for instance, I can assign a “master document” variable to my dissertation. This allows me to generate LaTeX output from a single in-process Sweave file, or, with an alternate command, to re-run the entire Sweave project through R and then begin LaTeX compilation. With the bundle TextMate (mostly; it’s still a work in progress) correctly parses Sweave files, allowing for context-sensitive actions depending on the position of the caret in a file: Within a Sweave document, I can generate LaTeX, compile that associated LaTeX file, send selected code to R, or build the entire master document. It works pretty slick now that it’s set up. Whereas in Emacs, the ties between various files was frequently opaque, I’ve found that keeping track of those relationships and compiling documents is more transparent and much easier.

Is it worth it?

For me, it has been worth it. The tinker to work ratio starts out pretty high, but that’s not unusual. Breaking emacs habits is tougher, even after four months, and I’d love a citation mode that works more akin to that found in RefTeX — the ability to invoke the command and then choose citation types, for example — and I still miss some of the enhancements from AucTeX; it trained me too well to C-c C-s to insert a section, for example. The ease with which one can build bundles and interface with external applications suggests that it won’t be long before someone may start building equivalent tools, and that will be a happy day.

In the meantime, TextMate is fast, allows me to visualize my projects, and works well enough with the other applications I use, as well as within my workflow, to justify the switch. It’s a good app, and it has improved my work.

Revise and extend (ie, updated)

I forgot to mention another issue about switching. Up until now, my tools have been almost entirely cross-platform for the past five or six years. TextMate is OS X-specific, so I can’t smoothly use the same set of tools on the Windows laptop like I could with emacs. This gives me some pause: It’s nice to have a mostly universal workflow, in which I could sit down at a PC, Mac, or linux machine, sync some files, and work. But over the past year with the iMac, I’ve picked up a few other non cross-platform tools: BibDesk is a great BibTeX manager, and I’ve been doing a ton of stuff using OmniOutliner Pro in the past handful of months, so switching away from emacs on one platform isn’t as much of a transition on that front as it might have been a year ago. Besides, the Mac is a nice platform to work on. And, hey, one of these days I’ll be able to trade up the Toshiba for a shiny new *Book of some kind.


1 The SWeave bundle is now distributed as a regular TextMate Bundle via the subversion bundle repository. [ return to text ]


About, the short version

I’m a sociologist-errant. This site is powered by Textpattern, Kaizen Garden and the sociological imagination. For more about me and this site, see the long version.

Copyright and so forth: Commenters own their own posts, and linked or excerpted material is subject to whatever copyright covers the original. Everything else here is mine, rights reserved.

RSS feed