emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Contextual tag auto-exclusion
@ 2009-10-19  3:48 John Wiegley
  2009-11-20 12:20 ` Friedrich Delgado Friedrichs
  0 siblings, 1 reply; 5+ messages in thread
From: John Wiegley @ 2009-10-19  3:48 UTC (permalink / raw)
  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-21  0:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-19  3:48 Contextual tag auto-exclusion John Wiegley
2009-11-20 12:20 ` 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

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).