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

* Re: Contextual tag auto-exclusion
  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
  0 siblings, 2 replies; 5+ messages in thread
From: Friedrich Delgado Friedrichs @ 2009-11-20 12:20 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I'm just trying to use this feature and I noticed, that it apparently
only works if org-tag-alist is explicitly set to a non-nil value.

I use dynamic tags (lots of them) and I wonder if it would be possible
to use those for auto-exclusion.

At least Org can do completion of dynamic tags, so there is probably
some function to get a list of the tags (or maybe just those in the
current agenda).

John Wiegley schrieb:
> 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:
---Zitatende---

Kind regards
     Friedel
-- 
        Friedrich Delgado Friedrichs <friedel@nomaden.org>
                             TauPan on Ircnet and Freenode ;)

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

* Re: Contextual tag auto-exclusion
  2009-11-20 12:20 ` Friedrich Delgado Friedrichs
@ 2009-11-20 12:24   ` Friedrich Delgado Friedrichs
  2009-11-20 22:19   ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Friedrich Delgado Friedrichs @ 2009-11-20 12:24 UTC (permalink / raw)
  To: emacs-orgmode

Hm.

It just occured to me that it might be sufficient (and maybe more
efficient) to only check the set of tags that I'm filtering for, so I
could maybe temporarily set org-tag-alist to the list of those tags?

> I'm just trying to use this feature and I noticed, that it apparently
> only works if org-tag-alist is explicitly set to a non-nil value.
> 
> I use dynamic tags (lots of them) and I wonder if it would be possible
> to use those for auto-exclusion.
> 
> At least Org can do completion of dynamic tags, so there is probably
> some function to get a list of the tags (or maybe just those in the
> current agenda).
> 
> John Wiegley schrieb:
> > 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:
---Zitatende---

-- 
        Friedrich Delgado Friedrichs <friedel@nomaden.org>
                             TauPan on Ircnet and Freenode ;)

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

* Re: Contextual tag auto-exclusion
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2009-11-20 22:19 UTC (permalink / raw)
  To: friedel; +Cc: org-mode list

Hi Friedrich,

I have fixed this now, all tags that are represented in the
current agenda will be passed into the auto-exclusion function.

- Carsten

On Nov 20, 2009, at 1:20 PM, Friedrich Delgado Friedrichs wrote:

> Hi!
>
> I'm just trying to use this feature and I noticed, that it apparently
> only works if org-tag-alist is explicitly set to a non-nil value.
>
> I use dynamic tags (lots of them) and I wonder if it would be possible
> to use those for auto-exclusion.
>
> At least Org can do completion of dynamic tags, so there is probably
> some function to get a list of the tags (or maybe just those in the
> current agenda).
>
> John Wiegley schrieb:
>> 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:
> ---Zitatende---
>
> Kind regards
>     Friedel
> -- 
>        Friedrich Delgado Friedrichs <friedel@nomaden.org>
>                             TauPan on Ircnet and Freenode ;)
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: Contextual tag auto-exclusion
  2009-11-20 22:19   ` Carsten Dominik
@ 2009-11-21  0:13     ` Friedrich Delgado Friedrichs
  0 siblings, 0 replies; 5+ messages in thread
From: Friedrich Delgado Friedrichs @ 2009-11-21  0:13 UTC (permalink / raw)
  To: org-mode list

Thanks! \o/

Carsten Dominik schrieb:
> I have fixed this now, all tags that are represented in the
> current agenda will be passed into the auto-exclusion function.


-- 
        Friedrich Delgado Friedrichs <friedel@nomaden.org>
                             TauPan on Ircnet and Freenode ;)

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