From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: Re: [appt] allow specifying warning time in diary Date: Wed, 08 Sep 2010 21:38:58 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1283978361 22754 80.91.229.12 (8 Sep 2010 20:39:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Sep 2010 20:39:21 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 08 22:39:20 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OtRQN-0000fa-OU for ged-emacs-devel@m.gmane.org; Wed, 08 Sep 2010 22:39:20 +0200 Original-Received: from localhost ([127.0.0.1]:53440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtRQN-0003Nb-79 for ged-emacs-devel@m.gmane.org; Wed, 08 Sep 2010 16:39:19 -0400 Original-Received: from [140.186.70.92] (port=40153 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtRQH-0003NW-A8 for emacs-devel@gnu.org; Wed, 08 Sep 2010 16:39:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtRQG-0007bl-9g for emacs-devel@gnu.org; Wed, 08 Sep 2010 16:39:13 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:45409) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtRQF-0007ba-EV for emacs-devel@gnu.org; Wed, 08 Sep 2010 16:39:12 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OtRQA-0000ZU-C8 for emacs-devel@gnu.org; Wed, 08 Sep 2010 22:39:06 +0200 Original-Received: from cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com ([86.9.122.85]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Sep 2010 22:39:06 +0200 Original-Received: from sdl.web by cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Sep 2010 22:39:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 76 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAElBMVEUAAAAAAP+LRRP0pGC+ vr7///+7mT1iAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMO DhglKe4AAAEsSURBVCjPbZNBboQwDEV/Cd4X9QJRThApmn0XYW+Jyf2v0m+HhqDBgiAe9rcTG7QH w/1Vn2Ar8gBb/ocywSN3qK9T3z4eFDB4eApocBpeBs1RSykoJd8gQcm8pGmHXFso3ajnmsqV0TnY DQkOfXUfN5NwaI7AWTVOyEhcu1aHmdWItHddUVUcUgUBCkitu8V6ditHVOVdqzl2EQ1ZVGTbdK0V 7cqn8vWzoU5Q/bF9Y/Y0cRU1xwkys5dJ+Dt6pBDWifcNQml8Gh2JVmPSoQzo7en0grswkxrUGYJ7 0hSxxAGr7ZMwYcHIzprpi7TENEE1xtiYxixRlCfPBsUUrwHD7uGIwATrbnODJcVrPpVn3hxiGloe m/S+z3CtuzUSMo83N4DPH+F0evwR3P4A2k+75838OKQAAAAASUVORK5CYII= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.4) Cancel-Lock: sha1:P781X3AtOilIemKB+Iy8/2THPB8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:129800 Archived-At: On 2010-09-08 15:55 +0100, Leo wrote: > Thanks for the interest. The previous patch doesn't take into account of > non-zero time-beg. This one fixes it and is simpler. Sorry, found two bugs (one is typo). So I made a test diary file as follows: 8 Sep 2010 23:00 test1 (no) 8 Sep 2010 23:00 #20 test2 (yes) 8 Sep 2010 23:00 # xyz1 (no) 23:00#20 xyz2 (yes) 23:00 #1.2 xyz3 (no) 23:59 #-1 xyz4 (yes) no = warntime is not set yes = warntime is set The renewed patch works with the test file. Modified lisp/calendar/appt.el diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index fd15093..b590290 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -273,6 +273,12 @@ for a warning to be issued. The format of the time can be either Thursday 11:45am Lunch meeting. +Optionally you can specify a warning time (in minutes) for an +entry following the time, for example: + + Thursday + 11:45am #20 Lunch meeting. + Appointments are checked every `appt-display-interval' minutes. The following variables control appointment notification: @@ -579,20 +585,30 @@ appointment package (if it is not already active)." (calendar-current-date) (caar entry-list))) (setq time-string (cadr (car entry-list))) (while (string-match appt-time-regexp time-string) - (let* ((beg (match-beginning 0)) + (let* ((time-beg (match-beginning 0)) + (time-end (match-end 0)) ;; Get just the time for this appointment. (only-time (match-string 0 time-string)) + (warntime + (when (eq time-end + (string-match + "[ \t]*#\\([-+]?[0-9]+\\)[ \t]+" + time-string time-end)) + (prog1 (string-to-number + (match-string 1 time-string)) + (setq time-string (replace-match + " " nil nil time-string))))) ;; Find the end of this appointment ;; (the start of the next). (end (string-match (concat "\n[ \t]*" appt-time-regexp) - time-string - (match-end 0))) + time-string time-end)) ;; Get the whole string for this appointment. (appt-time-string - (substring time-string beg end)) + (substring time-string time-beg end)) (appt-time (list (appt-convert-time only-time))) - (time-msg (list appt-time appt-time-string))) + (time-msg (list appt-time appt-time-string + nil warntime))) ;; Add this appointment to appt-time-msg-list. (setq appt-time-msg-list (nconc appt-time-msg-list (list time-msg))