emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Contextual tag auto-exclusion


From: John Wiegley
Subject: [Orgmode] Contextual tag auto-exclusion
Date: Sun, 18 Oct 2009 23:48:22 -0400

I've submitted a feature today which provide contextual auto-exclusion for tags in the Agenda view. For example, I use the following tags for TODOs:

  Net      Needs internet access
  Call     Needs a phone
  Errand   Done in town
  Home     Done at home

Now, it's quite easy for my computer to figure out which of these are possible, based on my location:

  Net      Can I ping mail.gnu.org?
  Call     Am I outside of normal calling hours?
  Errand   Am I outside of business hours?
  Home     Does my IP address begin with 192.168.9?

With the patch I've submitted, I can now define this function to auto- exclude based on this type of context information:

(defun org-my-auto-exclude-function (tag)
  (and (cond
        ((string= tag "Net")
         (/= 0 (call-process "/sbin/ping" nil nil nil
                             "-c1" "-q" "-t1" "mail.gnu.org")))
        ((string= tag "Home")
         (with-temp-buffer
           (call-process "/sbin/ifconfig" nil t nil "en0" "inet")
           (goto-char (point-min))
           (not (re-search-forward "inet 192\\.168\\.9\\." nil t))))
        ((or (string= tag "Errand") (string= tag "Call"))
         (let ((hour (nth 2 (decode-time))))
           (or (< hour 8) (> hour 21)))))
       (concat "-" tag)))

All I have to do is type `/ RET' in the agenda view now, and it excludes based on my machine's current temporal and physical context.

This feature will be described in the manual under the section "Commands in the agenda buffer".

John




reply via email to

[Prev in Thread] Current Thread [Next in Thread]