It seemed to be a boundary error. (point) was at the end of the
timestamp which doesn't hold the org-appt-warntime property.

foo.org illustrate what I have seen. Evaling the get-property sexp
returns nil.

The patch adds a function that goes at the beginning of the header to
get the property. As a bonus it turns the string into a number.

Please let me know if the patch is accepted or needs improvement.

diff --git a/emacs/org/org-agenda.el b/emacs/org/org-agenda.el
index 631c6d0..a826b26 100644
--- a/emacs/org/org-agenda.el
+++ b/emacs/org/org-agenda.el
@@ -5425,6 +5425,14 @@ the documentation of `org-diary'."
 	  (org-end-of-subtree 'invisible))))
     (nreverse ee)))
 
+(defun org-agenda-get-warntime ()
+  "Return warn time number when the property exists."
+  (save-excursion
+    (org-back-to-heading t)
+    (let ((warntime (get-text-property (point) 'org-appt-warntime)))
+      (when warntime
+        (string-to-number warntime)))))
+  
 (defun org-agenda-todo-custom-ignore-p (time n)
   "Check whether timestamp is farther away than n number of days.
 This function is invoked if `org-agenda-todo-ignore-deadlines',
@@ -5570,7 +5578,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
 	      clockp (and org-agenda-include-inactive-timestamps
 			  (or (string-match org-clock-string tmp)
 			      (string-match "]-+\\'" tmp)))
-	      warntime (get-text-property (point) 'org-appt-warntime)
+	      warntime (org-agenda-get-warntime)
 	      donep (member todo-state org-done-keywords))
 	(if (or scheduledp deadlinep closedp clockp
 		(and donep org-agenda-skip-timestamp-if-done))
@@ -5659,7 +5667,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
 			     (memq 'agenda org-agenda-use-tag-inheritance))))
 		tags (org-get-tags-at nil (not inherited-tags))
 		todo-state (org-get-todo-state)
-		warntime (get-text-property (point) 'org-appt-warntime)
+                warntime (org-agenda-get-warntime)
 		extra nil)
 
 	  (dolist (r (if (stringp result)
@@ -6059,7 +6067,7 @@ specification like [h]h:mm."
 			   (not (= diff 0))))
 		  (setq txt nil)
 		(setq category (org-get-category)
-		      warntime (get-text-property (point) 'org-appt-warntime)
+		      warntime (org-agenda-get-warntime)
 		      category-pos (get-text-property (point) 'org-category-position))
 		(if (not (re-search-backward "^\\*+[ \t]+" nil t))
 		    (throw :skip nil)
** TPIT with Jean-Philippe at San Francisco <2013-01-18 Fri 15:00 +1w>
   :PROPERTIES:
   :APPT_WARNTIME: 5
   :END:

(get-text-property 71 'org-appt-warntime)
(goto-char 71)

Reply via email to