Sopoforic Agents in Childhood

Just another WordPress.com weblog

750 Words to org-mode converter

Posted by Tracy Poff on June 18, 2011

The past few days, I’ve been using a site called 750 Words. The concept is simple: each day (preferably in the morning), write at least 750 words (preferably all at once). It’s just a simple writing exercise, but it’s really a nice way to start the day–750 words is enough to force you to think of some things to write; you can’t just write 750 words about your morning coffee, at least not without working at it. Coming up with and writing down some ideas at a burst in the morning helps to get you started making progress on your mental tasks, and helps you get your thoughts organized, too.

Now, writing my 750 words on the site is nice and all, and I appreciate the push to actually do it that the site provides, but I like to have all my writings kept locally, too. I usually use emacs org-mode to keep track of… basically, everything. I’m a big fan of it. So, I wrote a little python script to take the exported files containing a month’s writing that you can get from 750 Words and convert them into a simple structured org-mode file. It creates files that look like this:

* 2011
** 2011-06 June
*** 2011-06-14 Tuesday
:PROPERTIES:
:WORD_COUNT: 771
:MINUTES: 13.3774
:END:
Today I've been looking...
*** 2011-06-15 Wednesday
:PROPERTIES:
...

It currently just appends whatever entries are in the file ‘750’ to the file ‘750.org’, so you’ll want to process the export files in order. It’ll create the year heading if it’s processing a January dump, or if the file ‘750.org’ doesn’t yet exist. Otherwise, it just makes a new month heading and populates it with the entries in the file, with one entry per day.  I have only tested it against my own exports, of course, so I can’t guarantee it’ll work in all cases. In particular, if 750 Words sticks metadata lines at the top of entries like it does with the word count and time, then my script won’t insert those into the properties drawer like it does with the other two. It will probably just ignore them and proceed as though they didn’t exist, though. I’ll have to try using some metadata in an entry and see how (and if) it affects the export file, but for now, caveat emptor.

If this sounds useful to you, you can get it from the bitbucket repository. I’d be happy to hear any comments, suggestions, or bug reports.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: