From the archive — written 12 years ago. About old posts.

org-mode and iOS (again)

After Sunday’s jaunt into converting my Things todos into an org-mode file, I re-fixated on MobileOrg.

Here’s the thing about MobileOrg:

It thinks about your org-mode stuff pretty much the way Emacs does, which is to say that it’s pretty firmly rooted in the notion of plain text files. If you’re hoping you’ll just get a list of all your todos when you start it up, it’s going to disappoint.

Here’s another thing about MobileOrg:

It wants you to use either WebDAV or Dropbox to sync, but not in the way you might have naively thought, which would be “if I put my org mode files up on Dropbox, I’m golden.” Instead, it uses Dropbox or WebDAV to maintain a staging area that the iOS client and Emacs can push into and pull out of using sync functions on either client end. It’s a little cantankerous about this, and if you try to set things up without grokking the way it wants to work, you’ll have problems and there will be sadness.

So, I’ve got it working and I will use it as a way to consult the status of projects now and then when I’m not near my computer and I’ve remembered to push my desktop content into the Dropbox staging area. It’s not earth-shattering.

One sort of useful thing that I started playing around with, though, was an iOS app called Drafts. On its face, Drafts is a ridiculously simple text editor. When you start it up – which it does very quickly – it just sits there staring at you. You type stuff in it, maybe switch away from the app, and come back to see that your stuff has been archived and there’s another blank screen staring at you.

Drafts sort of isn’t really about plain text the way a notes app typically is. It’s actually about creating text-based workflows that shuttle your text off to other services for processing. It comes with a default set of actions that make its mission clear. Given a few lines of text in a Drafts buffer, you can:

  • Tweet it
  • Send it to Facebook
  • Add it to a journal note in Evernote
  • Send it as a text message
  • Save it as a file in Google Drive
  • Append it to a file in Dropbox
  • Turn it into an email message
  • Render it as Markdown into HTML then turn it into a rich text email message

Drafts is extensible, so that’s just what it does out of the box. There are hundreds of workflows for all sorts of things based around sending things to web services or processing them in-app via JavaScript, and you can write your own in-app. All your workflows sync via iCloud, and you can customize the action menus to suit what you need to do. Drafts also includes a basic templating system, so when you write actions, simple placeholders like [[date]] expand to the current date, [[clipboard]] expands to the current system clipboard, and [[date|%Y-%m-%d]] does what you’d expect if you know how strftime works.

If you have no patience for setting up MobileOrg, or don’t think you’d really want it, you can use Drafts to append stuff to your org files stored in Dropbox way more quickly than if you were to use the Dropbox app to navigate to them and edit them. I made an action that takes the text in a Drafts buffer and appends it to my inbox.org file as a timestamped todo. Using the templating placeholders for lightweight guardrails makes it easier to not screw up org mode’s simple but special-character-laden syntax. Here’s the one I set up:

 * TODO: [[title]]  
 [[body]]  
 <[[date|%Y-%m-%d %a]]]]><![CDATA[>

That will append a well-formed org-mode todo to the end of my inbox.org file. The [[title]] placeholder uses the first line of the Drafts buffer. The [[body]] placeholder uses all the lines after the first. There are positional placeholders, too, e.g. [[line|n]] for the _n_th line of the buffer. So this:

Correct that bad link on the RBAC intro page
Make sure you check the other links, too

Becomes:

* TODO: Correct that bad link on the RBAC intro page
Make sure you check the other links, too
<2014-11-18 Tue>

… in my inbox.org file, which gets org-mode’s syntax highlighting treatment in the Emacs buffer when I get to it there (along with all the handy text folding, archiving and agenda generation stuff):

That’s pretty simple, but it solves the thing that’s always vexed me about org-mode in the mobile world, which is how fiddly task capture can be. This reduces it to opening Drafts, typing a line or two of text, then tapping the Send to org-mode inbox action button. That’s as simple as OmniFocus or Things, and Drafts opens more quickly than either of those.

#emacs #org-mode

Drop a line about this.