Hi,

The previous patch I sent was completely buggy. This one works but
doesn't fulfill my RFC. I think the warn time should be somewhere within
the time stamp...

diff --git a/emacs/org/org-agenda.el b/emacs/org/org-agenda.el
index 780794e..2a8e926 100644
--- a/emacs/org/org-agenda.el
+++ b/emacs/org/org-agenda.el
@@ -8490,6 +8490,7 @@ By default `org-agenda-to-appt' will use :deadline, :scheduled
 and :timestamp entries.  See the docstring of `org-diary' for
 details and examples."
   (interactive "P")
+  (require 'appt)
   (if refresh (setq appt-time-msg-list nil))
   (if (eq filter t)
       (setq filter (read-from-minibuffer "Regexp filter: ")))
@@ -8518,6 +8519,12 @@ 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
+                 (prog1
+                   (string-to-number (match-string 1 evt))
+                   (setq evt (substring evt 0 warn-match)))))
 	      (ok (or (null filter)
 		      (and (stringp filter) (string-match filter evt))
 		      (and (functionp filter) (funcall filter x))
@@ -8536,7 +8543,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