From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: D Goel Newsgroups: gmane.emacs.devel Subject: appt: allowing hh.mm for time Date: Thu, 04 Dec 2003 10:00:08 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87wu9ciq6f.fsf@gnufans.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1070551176 29887 80.91.224.253 (4 Dec 2003 15:19:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 4 Dec 2003 15:19:36 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Dec 04 16:19:32 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ARvGO-0005pG-00 for ; Thu, 04 Dec 2003 16:19:32 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1ARvGN-0000k5-00 for ; Thu, 04 Dec 2003 16:19:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ARwAi-0004Ss-TZ for emacs-devel@quimby.gnus.org; Thu, 04 Dec 2003 11:17:44 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ARw6v-0003HR-KN for emacs-devel@gnu.org; Thu, 04 Dec 2003 11:13:49 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ARw4v-0002Wk-Ro for emacs-devel@gnu.org; Thu, 04 Dec 2003 11:12:18 -0500 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ARw4u-0002Vy-8d for emacs-devel@gnu.org; Thu, 04 Dec 2003 11:11:44 -0500 Original-Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1ARv7R-0008Dp-00 for ; Thu, 04 Dec 2003 16:10:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ARuxc-00087b-00 for ; Thu, 04 Dec 2003 16:00:08 +0100 Original-Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1ARuxc-000713-00 for ; Thu, 04 Dec 2003 16:00:08 +0100 Original-Lines: 84 Original-X-Complaints-To: usenet@sea.gmane.org X-Face: #5@=vrmx5t3mZaPY8(mR.n+V#:%4NW7j5A&^}@lGp2rK; CQ4%iH1v'gh/^A)w5*6c&R2(P' 4+seYDq8OK'LPI/C(C^A*w|f*t+8, 'T8b#_0~h3!A7GoVroE[cr0Fb'A0%SdU|Lk@gBV&1vA User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:kweoBSZ8GHyBYlGsKo1Uch6HGqk= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:18370 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18370 hi Thoguh diary does have interactive functions for adding appointments, I like to hand-edit my diary file. I often add entries like 2/3/2003: 11.00 dentist. however, i often miss those appointments because appt.el doesn't remind me because the correct format should have been 2/3/2003: 11:00 dentist. The patch below generalizes the time-format to allow 11.00 as well, (and even makes it customizable.) I would like to apply it to appt.el, may I? DG http://gnufans.net/ -- --- appt-original.el Thu Dec 4 09:54:45 2003 +++ appt.el Thu Dec 4 09:54:08 2003 @@ -165,6 +165,17 @@ :type 'integer :group 'appt) + +(defcustom appt-time-separator "\\(?::\\|\\.\\)" + " Time is of the form hh(appt-time-separator)mm. + +A regex which is either a character, like : or . or or-ed characters. +The orring should begin with \\(?: so as not to consume match-string + expressions. The default is : or . " + :type 'string) + + + (defvar appt-buffer-name " *appt-buf*" "Name of the appointments buffer.") @@ -519,7 +530,9 @@ (calendar-current-date) (car (car entry-list)))) (let ((time-string (cadr (car entry-list)))) (while (string-match - "\\([0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?\\).*" + (concat "\\([0-9]?[0-9]" + appt-time-separator + "[0-9][0-9]\\(am\\|pm\\)?\\).*") time-string) (let* ((beg (match-beginning 0)) ;; Get just the time for this appointment. @@ -527,7 +540,10 @@ ;; Find the end of this appointment ;; (the start of the next). (end (string-match - "^[ \t]*[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?" + (concat + "^[ \t]*[0-9]?[0-9]" + appt-time-separator + "[0-9][0-9]\\(am\\|pm\\)?") time-string (match-end 0))) ;; Get the whole string for this appointment. @@ -592,11 +608,13 @@ (hr 0) (min 0)) - (string-match ":\\([0-9][0-9]\\)" time2conv) + (string-match + (concat appt-time-separator "\\([0-9][0-9]\\)") + time2conv) (setq min (string-to-int (match-string 1 time2conv))) - (string-match "[0-9]?[0-9]:" time2conv) + (string-match (concat "[0-9]?[0-9]" appt-time-separator) time2conv) (setq hr (string-to-int (match-string 0 time2conv)))