From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Wiegley Subject: Contextual tag auto-exclusion Date: Sun, 18 Oct 2009 23:48:22 -0400 Message-ID: <34D54B2A-D7AD-4534-B95A-7C1C9EA7FBAF@gmail.com> Mime-Version: 1.0 (Apple Message framework v1075.2) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MzjEW-0006yg-Rq for emacs-orgmode@gnu.org; Sun, 18 Oct 2009 23:48:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MzjES-0006u5-CG for emacs-orgmode@gnu.org; Sun, 18 Oct 2009 23:48:32 -0400 Received: from [199.232.76.173] (port=44365 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MzjES-0006tq-2Z for emacs-orgmode@gnu.org; Sun, 18 Oct 2009 23:48:28 -0400 Received: from mail-yx0-f191.google.com ([209.85.210.191]:46156) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MzjER-0000OJ-My for emacs-orgmode@gnu.org; Sun, 18 Oct 2009 23:48:27 -0400 Received: by yxe29 with SMTP id 29so990232yxe.14 for ; Sun, 18 Oct 2009 20:48:26 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org-mode Mode 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