emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ivan Kanis
Subject: [O] patch for warning time (first baby sted)
Date: Sun, 19 Feb 2012 12:21:12 +0100

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]