From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ivan Kanis Subject: [PATCH] fix appointment warn time Date: Fri, 26 Apr 2013 18:17:11 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVlKq-0000on-3m for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 12:17:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVlKn-0003oH-C4 for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 12:17:20 -0400 Received: from [46.19.35.252] (port=59913 helo=srv2.kanis.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVlKm-0003oA-Vf for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 12:17:17 -0400 Received: from smtp.comencini.fr ([164.138.25.8]) by smtp.comencini.fr with esmtpsa (TLS1.1:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80.1) (envelope-from ) id 1UVlKl-0000ZP-0Q for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 18:17:15 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org mode --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=warntime.diff 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) --=-=-= Content-Type: text/x-org Content-Disposition: attachment; filename=foo.org ** 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) --=-=-=--