emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Wiegley <jwiegley@gmail.com>
To: Org-mode Mode <emacs-orgmode@gnu.org>
Subject: Contextual tag auto-exclusion
Date: Sun, 18 Oct 2009 23:48:22 -0400	[thread overview]
Message-ID: <34D54B2A-D7AD-4534-B95A-7C1C9EA7FBAF@gmail.com> (raw)

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	other threads:[~2009-10-19  3:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19  3:48 John Wiegley [this message]
2009-11-20 12:20 ` Contextual tag auto-exclusion Friedrich Delgado Friedrichs
2009-11-20 12:24   ` Friedrich Delgado Friedrichs
2009-11-20 22:19   ` Carsten Dominik
2009-11-21  0:13     ` Friedrich Delgado Friedrichs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34D54B2A-D7AD-4534-B95A-7C1C9EA7FBAF@gmail.com \
    --to=jwiegley@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).