comparison lisp/calendar/appt.el @ 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 426c8cf1a3df
children eb47511f3556
comparison
equal deleted inserted replaced
46860:8b7ade57211d 46861:0d5d941c3b3e
514 (calendar-current-date) (car (car entry-list)))) 514 (calendar-current-date) (car (car entry-list))))
515 (let ((time-string (substring (prin1-to-string 515 (let ((time-string (substring (prin1-to-string
516 (cadr (car entry-list))) 1 -1))) 516 (cadr (car entry-list))) 1 -1)))
517 517
518 (while (string-match 518 (while (string-match
519 "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?\\(.*\n\\)*.*" 519 "\\([0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?\\).*"
520 time-string) 520 time-string)
521 (let* ((appt-time-string (match-string 0 time-string))) 521 (let* ((beg (match-beginning 0))
522 522 ;; Get just the time for this appointment.
523 (if (< (match-end 0) (length time-string)) 523 (only-time (match-string 1 time-string))
524 (setq new-time-string (substring time-string 524 ;; Find the end of this appointment
525 (+ (match-end 0) 1) 525 ;; (the start of the next).
526 nil)) 526 (end (string-match
527 (setq new-time-string "")) 527 "^[ \t]*[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?"
528 528 time-string
529 (string-match "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?" 529 (match-end 0)))
530 time-string) 530 ;; Get the whole string for this appointment.
531 531 (appt-time-string
532 (let* ((appt-time (list (appt-convert-time 532 (substring time-string beg (if end (1- end)))))
533 (match-string 0 time-string)))) 533
534 (time-msg (cons appt-time 534 ;; Add this appointment to appt-time-msg-list.
535 (list appt-time-string)))) 535 (let* ((appt-time (list (appt-convert-time only-time)))
536 (setq time-string new-time-string) 536 (time-msg (list appt-time appt-time-string)))
537 (setq appt-time-msg-list (nconc appt-time-msg-list 537 (setq appt-time-msg-list
538 (list time-msg))))))) 538 (nconc appt-time-msg-list (list time-msg))))
539
540 ;; Discard this appointment from the string.
541 (setq time-string
542 (if end (substring time-string end) "")))))
539 (setq entry-list (cdr entry-list))))) 543 (setq entry-list (cdr entry-list)))))
540 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list)) 544 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))
541 545
542 ;; Get the current time and convert it to minutes 546 ;; Get the current time and convert it to minutes
543 ;; from midnight. ie. 12:01am = 1, midnight = 0, 547 ;; from midnight. ie. 12:01am = 1, midnight = 0,