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: agenda appt warn time (baby step part 2)
Date: Thu, 23 Feb 2012 12:24:52 +0100	[thread overview]
Message-ID: <87vcmxkd17.fsf@kanis.fr> (raw)

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

             reply	other threads:[~2012-02-23 11:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 11:24 Ivan Kanis [this message]
2012-04-20 12:28 ` agenda appt warn time (baby step part 2) Bastien
  -- strict thread matches above, loose matches on Subject: below --
2012-04-25  5:39 Ivan Kanis

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=87vcmxkd17.fsf@kanis.fr \
    --to=ivan.kanis@googlemail.com \
    --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).