From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: [appt] allow specifying warning time in diary Date: Wed, 08 Sep 2010 09:54:31 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1283936110 26687 80.91.229.12 (8 Sep 2010 08:55:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Sep 2010 08:55:10 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 08 10:55:07 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 1OtGQm-0002bJ-JO for ged-emacs-devel@m.gmane.org; Wed, 08 Sep 2010 10:55:00 +0200 Original-Received: from localhost ([127.0.0.1]:48788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtGQl-0002bY-LA for ged-emacs-devel@m.gmane.org; Wed, 08 Sep 2010 04:54:59 -0400 Original-Received: from [140.186.70.92] (port=60560 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtGQd-0002aO-0L for emacs-devel@gnu.org; Wed, 08 Sep 2010 04:54:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtGQb-0006SB-JM for emacs-devel@gnu.org; Wed, 08 Sep 2010 04:54:50 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:55382) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtGQb-0006S1-8u for emacs-devel@gnu.org; Wed, 08 Sep 2010 04:54:49 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OtGQW-0002Sg-5N for emacs-devel@gnu.org; Wed, 08 Sep 2010 10:54:44 +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 10:54:44 +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 10:54:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 67 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAgMAAADxkFD+AAAADFBMVEUvT09qWs3/pQD///+J kUVcAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMLOd3veKQA AACuSURBVBjTldE9CgIxEAXgB+lEyFUC2wo5ikdZ8DSypxhMY7H9VuIVwlqkGRgnm59VsHGafIQ3 CZlAtmKIRaHETgYa12lqvEsPYKf8wXHsPGfqPaUM0g9aJPKFXkmNQmSDqwzz4Fpgpz+6WAPY2z5o uPJJpu0uypcl4nyCibMLQ8lCiVjayLoQvw5LsVKQuHPRR958HZbOcVsKeepcLxpByjycGvnKmY+c MBvrtyjfe0vmuLvdq/kAAAAASUVORK5CYII= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.4) Cancel-Lock: sha1:VoHDKejmqK8khINsrR7zyPLSwPs= 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:129770 Archived-At: Hello, 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: 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))