# HG changeset patch # User Richard M. Stallman # Date 1029172866 0 # Node ID 0d5d941c3b3e8e2125c88742bd1d6a448f5bc6cb # Parent 8b7ade57211d4422cba6a8300fb93ff8a6185f10 (appt-make-list): Correct the parsing of each appointment from time-string. diff -r 8b7ade57211d -r 0d5d941c3b3e lisp/calendar/appt.el --- 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))