Re: [O] patch for warning time (first baby sted)

2012-02-22 Thread Peter Münster
On Sun, Feb 19 2012, Ivan Kanis wrote:

 This patch implements warn time for org appt. It only works on emacs bzr
 (the variable appt-warning-time-regexp appears in it). You need to add
 the warntime in the text of the entry, like so :

 * doctor warntime 10
   2012-02-19 10:00

If you change it to

* TODO doctor
  DEADLINE: 2012-02-19 10:00

you can also use the org-notify module:
http://pmrb.free.fr/work/OS/org-notify.el

-- 
   Peter




[O] patch for warning time (first baby sted)

2012-02-19 Thread Ivan Kanis
Hi,

This patch implements warn time for org appt. It only works on emacs bzr
(the variable appt-warning-time-regexp appears in it). You need to add
the warntime in the text of the entry, like so :

* doctor warntime 10
  2012-02-19 10:00

or 

* doctor warntime 10 2012-02-19 10:00

The patch is not fit to be included in org. I am submitting it in case
it interests others to have the functionality.

diff --git a/emacs/org/org-agenda.el b/emacs/org/org-agenda.el
index 780794e..78194b1 100644
--- a/emacs/org/org-agenda.el
+++ b/emacs/org/org-agenda.el
@@ -8518,6 +8518,11 @@ details and examples.
(let* ((evt (org-trim (or (get-text-property 1 'txt x) )))
  (cat (get-text-property 1 'org-category x))
  (tod (get-text-property 1 'time-of-day x))
+  (warn-match (string-match appt-warning-time-regexp evt))
+  (warntime
+   (when warn-match
+   (string-to-number (match-string 1 evt))
+   (setq evt (substring literal 0 warn-match
  (ok (or (null filter)
  (and (stringp filter) (string-match filter evt))
  (and (functionp filter) (funcall filter x))
@@ -8536,7 +8541,9 @@ details and examples.
\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)\\' tod)
   (concat (match-string 1 tod) :
   (match-string 2 tod
-  (appt-add tod evt)
+   (if warntime
+   (appt-add tod evt warntime)
+ (appt-add tod evt))
   (setq cnt (1+ cnt) entries)
 (org-release-buffers org-agenda-new-buffers)
 (if (eq cnt 0)