Miscellaneous Org Mode Tips & Tricks
2017-10-20 in emacs
Org mode is one of the main culprits for My Great Switch to Emacs of 2016. I've been very fond of the idea of my life in plain text; I've seen it in action a few times, and it always felt like magic in a very portable file format.
I'm still a rather noobish user of Emacs: as a former Vim user, I'm very happy with my Spacemacs setup, yet it's very unamusing. But, I think I've collected a few interesting org mode tips & tricks that people have shown some interest in:
Export to Google Calendar
I'm a big fan of the agenda view, but I'm also a heavy Google Calendar user. I never really wanted a true two-way integration between the two, but some sort of a setup where my org mode schedule would show up in my calendar sounded good.
Org mode supports exporting your agenda to iCal, so it's just a matter of:
- running this command periodically,
- making sure the resulting .ics file is available over the internet, and
- importing the .ics file into Google Calendar as a new calendar.
The solution to #1 is a ridiculously simple timer I have in my
(defun export-org-agenda () (if (eq major-mode 'org-mode) (org-icalendar-combine-agenda-files))) (with-eval-after-load 'org (setq org-ics-autosave (run-at-time "1 min" 3600 'export-org-agenda)))
The only "smart" thing about the function above is that it'll run only if you have an org buffer open anywhere in Emacs. I vaguely remember having some issues with
org-icalendar-combine-agenda-files when it would run in a non-org buffer.
I have outsourced hosting this file to Dropbox. You can configure the path to the resulting iCal file with
(setq org-icalendar-combined-agenda-file "~/Dropbox/cal.ics")
Dropbox can generate a publicly-accessible URL for this file, and you can then import it to Google Calendar, solving #3. Alternatively, a few more lines of Elisp can be added to the timer to copy the file to a remote server.
Project Management & Gantt Charts in Org Mode
There has to be a way of creating Gantt charts from org mode files! -- me, mid-2017
Org mode has some support for creating
.tjp files from org mode outlines. It barely scratches the surface of what TaskJuggler can do, but it supports the basics (assignments, dependencies), and generates decent reports out of the box, including nifty Gantt charts.
The docs linked above are slightly outdated, i.e. they cover an old version of TaskJuggler that used Qt. The new version of TaskJuggler has no UI, but rather just a CLI tool that spits out HTML files that can be viewed in the browser.
One property that I found quite useful is
start: TaskJuggler will try to automatically allocate time for the tasks based on your assignment and dependencies, but often you'll have a set start time for your task. Slap
:start: 2017-10-18 to your task and it will start on October 18th; this will also take this fact into consideration while automatically scheduling the rest.
If you're working in a larger team, the automatic resource allocation feature is a lifesaver. For anyone doing any sort of project management, I strongly suggest looking into this.
Spacemacs: Org Agenda Transient State
I stumbled on this by accident while fat-fingering the spacebar and Alt keys, but the transient state for the org mode agenda is a well-documented feature.
In the agenda view, hit
meta + Space (usually
Alt + Space), and you'll get a nifty minibuffer with a bunch of options.
Since I have my agenda open at all times on a separate workspace, the one I use the most is
ft (filter by tag) — I usually display only my work tasks when I get to work in the morning, and then switch to my personal tasks in the afternoon.
fd deletes all active filters.