emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ivan Kanis <ivan.kanis@googlemail.com>
To: org mode <emacs-orgmode@gnu.org>
Subject: patch for warning time (first baby sted)
Date: Sun, 19 Feb 2012 12:21:12 +0100	[thread overview]
Message-ID: <877gzj83x3.fsf@googlemail.com> (raw)


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>


* 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	other threads:[~2012-02-19 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-19 11:21 Ivan Kanis [this message]
2012-02-22 23:35 ` patch for warning time (first baby sted) Peter Münster

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:

  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=877gzj83x3.fsf@googlemail.com \
    --to=ivan.kanis@googlemail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).