emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* patch for warning time (first baby sted)
@ 2012-02-19 11:21 Ivan Kanis
  2012-02-22 23:35 ` Peter Münster
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Kanis @ 2012-02-19 11:21 UTC (permalink / raw)
  To: org mode

Hi,

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>

or 

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: patch for warning time (first baby sted)
  2012-02-19 11:21 patch for warning time (first baby sted) Ivan Kanis
@ 2012-02-22 23:35 ` Peter Münster
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Münster @ 2012-02-22 23:35 UTC (permalink / raw)
  To: emacs-orgmode

On Sun, Feb 19 2012, Ivan Kanis wrote:

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

If you change it to

* TODO doctor
  DEADLINE: <2012-02-19 10:00>

you can also use the org-notify module:
http://pmrb.free.fr/work/OS/org-notify.el

-- 
           Peter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-22 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-19 11:21 patch for warning time (first baby sted) Ivan Kanis
2012-02-22 23:35 ` Peter Münster

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