emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* agenda appt warn time (baby step part 2)
@ 2012-02-23 11:24 Ivan Kanis
  2012-04-20 12:28 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Kanis @ 2012-02-23 11:24 UTC (permalink / raw)
  To: org mode

[-- Attachment #1: Type: text/plain, Size: 164 bytes --]

Hi,

The previous patch I sent was completely buggy. This one works but
doesn't fulfill my RFC. I think the warn time should be somewhere within
the time stamp...


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: agenda-warn-time.patch --]
[-- Type: text/x-diff, Size: 1546 bytes --]

diff --git a/emacs/org/org-agenda.el b/emacs/org/org-agenda.el
index 780794e..2a8e926 100644
--- a/emacs/org/org-agenda.el
+++ b/emacs/org/org-agenda.el
@@ -8490,6 +8490,7 @@ By default `org-agenda-to-appt' will use :deadline, :scheduled
 and :timestamp entries.  See the docstring of `org-diary' for
 details and examples."
   (interactive "P")
+  (require 'appt)
   (if refresh (setq appt-time-msg-list nil))
   (if (eq filter t)
       (setq filter (read-from-minibuffer "Regexp filter: ")))
@@ -8518,6 +8519,12 @@ 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
+                 (prog1
+                   (string-to-number (match-string 1 evt))
+                   (setq evt (substring evt 0 warn-match)))))
 	      (ok (or (null filter)
 		      (and (stringp filter) (string-match filter evt))
 		      (and (functionp filter) (funcall filter x))
@@ -8536,7 +8543,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] 3+ messages in thread
* Re: agenda appt warn time (baby step part 2)
@ 2012-04-25  5:39 Ivan Kanis
  0 siblings, 0 replies; 3+ messages in thread
From: Ivan Kanis @ 2012-04-25  5:39 UTC (permalink / raw)
  To: org mode

Hi Bastien,

FYI I sent an e-mail to bzg@altern.org and it bounced.

Bastien <bzg@altern.org> wrote:

> Inserting warntime in the headline looks hackish.  

Yeah it's an ugly hack. It would belong in the time stamp. Adding
something there is beyond my skill.

> Maybe have a look at contrib/lisp/org-notify.el by Peter?

Someone suggested that on the mailing list. It's on my todo list.
-- 
Ivan Kanis
http://ivan.kanis.fr

Art washes from the soul the dust of everyday life.
    -- Pablo Picasso

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

end of thread, other threads:[~2012-04-25  5:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-23 11:24 agenda appt warn time (baby step part 2) Ivan Kanis
2012-04-20 12:28 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2012-04-25  5:39 Ivan Kanis

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