From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ivan Kanis Subject: agenda appt warn time (baby step part 2) Date: Thu, 23 Feb 2012 12:24:52 +0100 Message-ID: <87vcmxkd17.fsf@kanis.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:47802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0WnL-0004Hw-HM for emacs-orgmode@gnu.org; Thu, 23 Feb 2012 06:25:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0WnD-000294-RU for emacs-orgmode@gnu.org; Thu, 23 Feb 2012 06:25:05 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:49638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0WnD-00028p-K1 for emacs-orgmode@gnu.org; Thu, 23 Feb 2012 06:24:59 -0500 Received: by wibhj13 with SMTP id hj13so889401wib.0 for ; Thu, 23 Feb 2012 03:24:58 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org mode --=-=-= Content-Type: text/plain 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... --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=agenda-warn-time.patch 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) --=-=-=--