Topic “agenda”

Emacs Org-mode: Custom agenda that filters by date AND tag

I started using Org-mode for Emacs a few weeks ago, in an attempt to get a better grip on the endless stream of TODOs, events, notes, and projects that come into my life, both personally and professionally.

So far, it’s been amazing, because it provides a single point to manage data that tends to get split up across multiple applications (Calendars, ToDo list managers, et cetera) and once you get in the habit of logging every new thing that comes across your radar, it’s all right there. Agenda views let you slice and dice all of that data to keep it from becoming overwhelming. Most often I find myself just using a basic 1-day agenda view that shows me all items with the current date, plus any overdue items and any upcoming deadlines. It’s a nice “at a glance” look at my life for the day, and what’s on the horizon for the next couple of weeks.

Sometimes, though, you want to get really specific. There are plenty of interactive commands in Agenda mode to facilitate this purpose, but as I contemplated the day’s chores (Dutifully entered into my org file with the tag :chores:) I decided I wanted to set up a custom agenda command that would do the following:

  • Show items with today’s date
  • Hide all previously scheduled items, and upcoming deadlines
  • Filter by the tag “chores”

I’m still an org-mode newbie and my grasp of EMacs LISP is almost non-existent, so this wound up taking me the better part of a Sunday morning to figure out - but I finally did, and wanted to share my solution with anyone else who may be trying to solve the same problem.

Figuring out how to filter by today only and hide previously scheduled and upcoming deadline items was easy; there are numerous examples floating around. What had me stumped was how to then further filter that list by a tag. I never found a working example of this specific problem, but I was able to sleuth my way to the org-agenda-filter-preset command, which turned out to be the special sauce I needed. org-agenda-filter-preset is mentioned in a footnote on the Org Manual Agenda Commands page, but I totally overlooked it.

You define custom agenda views in your .emacs file - here’s what I set up for my quick list of items dated today (minus previous scheduled, and upcoming deadlines) and tagged “chores”:

(setq org-agenda-custom-commands
      `(("c" agenda "Chores"
     ((org-agenda-ndays 1)
      (org-scheduled-past-days 0)
      (org-deadline-warning-days 0)
      (org-agenda-filter-preset '("+chores"))
      )
     )))

Syndicate content
Syndicate content

Twitter

  • Darn parakeet. 5 years 26 weeks ago
  • Go to google.com, type in 'Why Won't' and see what autosuggest comes back with. (Via http://is.gd/4TsSV) #fb 5 years 26 weeks ago
  • I take that back. Possible to sort by one Vocab in #Drupal Views 2: http://is.gd/4Tl6y My brain hurts. 5 years 26 weeks ago
  • Huh. Really not possible to sort by specific taxonomy vocab in Views: http://drupal.org/node/150896 5 years 26 weeks ago
  • RE: Views2 Live Preview, never mind. Appears to have just been Views Caching 5 years 26 weeks ago

Older

Contact

Andy Chase
(978) 297-6402
andychase [at] gmail.com
GPG/PGP Public Key