From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [appt] allow specifying warning time in diary Date: Wed, 08 Sep 2010 16:34:52 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1283956655 18002 80.91.229.12 (8 Sep 2010 14:37:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Sep 2010 14:37:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: Leo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 08 16:37:30 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 1OtLmC-00051F-Aa for ged-emacs-devel@m.gmane.org; Wed, 08 Sep 2010 16:37:28 +0200 Original-Received: from localhost ([127.0.0.1]:57302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtLmB-0007Q8-9V for ged-emacs-devel@m.gmane.org; Wed, 08 Sep 2010 10:37:27 -0400 Original-Received: from [140.186.70.92] (port=50507 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtLjl-0005Yc-S0 for emacs-devel@gnu.org; Wed, 08 Sep 2010 10:34:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtLjk-0001CQ-9U for emacs-devel@gnu.org; Wed, 08 Sep 2010 10:34:57 -0400 Original-Received: from impaqm1.telefonica.net ([213.4.138.1]:10181) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtLjk-0001C5-4F for emacs-devel@gnu.org; Wed, 08 Sep 2010 10:34:56 -0400 Original-Received: from IMPmailhost4.adm.correo ([10.20.102.125]) by IMPaqm1.telefonica.net with bizsmtp id 4BRW1f00j2iL0W201EauRl; Wed, 08 Sep 2010 16:34:54 +0200 Original-Received: from ceviche.home ([83.61.36.43]) by IMPmailhost4.adm.correo with BIZ IMP id 4Eas1f00Q0vquEj1kEatM2; Wed, 08 Sep 2010 16:34:54 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Original-Received: by ceviche.home (Postfix, from userid 20848) id CC883660D2; Wed, 8 Sep 2010 16:34:52 +0200 (CEST) In-Reply-To: (Leo's message of "Wed, 08 Sep 2010 09:54:31 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) 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:129782 Archived-At: > When I put an appointment in the diary, sometimes I also want to set an > alert time. For example, if I am meeting a friend in London, I need a > notice 3 hours before the appointment. > The attached patch allows inserting in the diary something like this: Looks good, thank you; can someone install it? Stefan > Saturday > 13:00 #180 Lunch with Theresa. > Is this feature useful? > Leo > Modified lisp/calendar/appt.el > diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el > index 15a9d54..e70644c 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 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,7 +585,8 @@ 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)) > ;; Find the end of this appointment > @@ -590,9 +597,20 @@ appointment package (if it is not already active)." > (match-end 0))) > ;; Get the whole string for this appointment. > (appt-time-string > - (substring time-string beg end)) > + (substring time-string time-beg end)) > + (warntime > + (when (and (string-match > + "[ \t]*#\\([-+]?[0-9]+\\)[ \t]*" > + appt-time-string time-end) > + (= (match-beginning 0) time-end)) > + (prog1 (string-to-number > + (match-string 1 appt-time-string)) > + (setq appt-time-string > + (replace-match " " nil nil > + appt-time-string))))) > (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))