unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* appt: allowing hh.mm for time
@ 2003-12-04 15:00 D Goel
  2003-12-05 20:44 ` Glenn Morris
  0 siblings, 1 reply; 7+ messages in thread
From: D Goel @ 2003-12-04 15:00 UTC (permalink / 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)))

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-12-08 15:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-04 15:00 appt: allowing hh.mm for time D Goel
2003-12-05 20:44 ` 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

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