unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: D Goel <deego@gnufans.org>
Subject: appt: allowing hh.mm for time
Date: Thu, 04 Dec 2003 10:00:08 -0500	[thread overview]
Message-ID: <87wu9ciq6f.fsf@gnufans.net> (raw)

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)))

             reply	other threads:[~2003-12-04 15:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-04 15:00 D Goel [this message]
2003-12-05 20:44 ` appt: allowing hh.mm for time Glenn Morris
2003-12-05 21:18   ` D Goel
2003-12-05 23:05     ` Andreas Schwab
2003-12-06  0:58     ` Thien-Thi Nguyen
2003-12-06 21:54     ` Glenn Morris
2003-12-08 15:35       ` D. Goel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wu9ciq6f.fsf@gnufans.net \
    --to=deego@gnufans.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).