From: Ivan Kanis <banana@kanis.fr>
To: org mode <emacs-orgmode@gnu.org>
Subject: [PATCH] fix appointment warn time
Date: Fri, 26 Apr 2013 18:17:11 +0200 [thread overview]
Message-ID: <m0vc79l114.fsf@kanis.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: warntime.diff --]
[-- Type: text/x-patch, Size: 2005 bytes --]
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)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: foo.org --]
[-- Type: text/x-org, Size: 175 bytes --]
** 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)
next reply other threads:[~2013-04-26 16:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 16:17 Ivan Kanis [this message]
2013-04-26 17:01 ` [PATCH] fix appointment warn time Bastien
2013-04-27 8:34 ` Ivan Kanis
2013-04-27 12:02 ` Bastien
2013-04-28 8:48 ` Ivan Kanis
2013-04-28 8:59 ` Bastien
2013-04-28 19:57 ` Ivan Kanis
2013-05-14 8:36 ` Bastien
2013-05-14 11:46 ` Ivan Kanis
2013-05-14 11:49 ` Bastien
2013-05-14 12:10 ` Ivan Kanis
2013-05-14 13:20 ` Miguel Ruiz
2013-05-14 14:08 ` Bastien
2013-05-14 15:06 ` Ivan Kanis
2013-05-14 15:18 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m0vc79l114.fsf@kanis.fr \
--to=banana@kanis.fr \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).