changeset 46861:0d5d941c3b3e

(appt-make-list): Correct the parsing of each appointment from time-string.
author Richard M. Stallman <rms@gnu.org>
date Mon, 12 Aug 2002 17:21:06 +0000
parents 8b7ade57211d
children 72170b70dd7a
files lisp/calendar/appt.el
diffstat 1 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/appt.el	Mon Aug 12 04:33:59 2002 +0000
+++ b/lisp/calendar/appt.el	Mon Aug 12 17:21:06 2002 +0000
@@ -516,26 +516,30 @@
 					       (cadr (car entry-list))) 1 -1)))
 
 		  (while (string-match
-			  "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?\\(.*\n\\)*.*"
+			  "\\([0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?\\).*"
 			  time-string)
-		    (let* ((appt-time-string (match-string 0 time-string)))
-
-		      (if (< (match-end 0) (length time-string))
-			  (setq new-time-string (substring time-string 
-							   (+ (match-end 0) 1)
-							   nil))
-			(setq new-time-string ""))
+		    (let* ((beg (match-beginning 0))
+			   ;; Get just the time for this appointment.
+			   (only-time (match-string 1 time-string))
+			   ;; 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\\)?"
+				 time-string
+				 (match-end 0)))
+			   ;; Get the whole string for this appointment.
+			   (appt-time-string
+			    (substring time-string beg (if end (1- end)))))
 
-		      (string-match "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?"
-				    time-string)
+		      ;; Add this appointment to appt-time-msg-list.
+		      (let* ((appt-time (list (appt-convert-time only-time)))
+			     (time-msg (list appt-time appt-time-string)))
+			(setq appt-time-msg-list
+			      (nconc appt-time-msg-list (list time-msg))))
 
-		      (let* ((appt-time (list (appt-convert-time 
-					       (match-string 0 time-string))))
-			     (time-msg (cons appt-time
-					     (list appt-time-string))))
-			(setq time-string new-time-string)
-			(setq appt-time-msg-list (nconc appt-time-msg-list
-							(list time-msg)))))))
+		      ;; Discard this appointment from the string.
+		      (setq time-string
+			    (if end (substring time-string end) "")))))
 		(setq entry-list (cdr entry-list)))))
 	(setq appt-time-msg-list (appt-sort-list appt-time-msg-list))