Mercurial > emacs
comparison lisp/calendar/appt.el @ 60225:c467ceeff8c7
(appt-time-msg-list): 3rd elt of each
appointment says it was explicitly made.
(appt-add): Set the 3rd element.
(appt-make-list): Preserve explicit appointments.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 23 Feb 2005 21:05:51 +0000 |
parents | aac0a33f5772 |
children | b9677b0e5e91 bbc2e661b93c |
comparison
equal
deleted
inserted
replaced
60224:374bd52dd8b8 | 60225:c467ceeff8c7 |
---|---|
187 (defvar appt-time-msg-list nil | 187 (defvar appt-time-msg-list nil |
188 "The list of appointments for today. | 188 "The list of appointments for today. |
189 Use `appt-add' and `appt-delete' to add and delete appointments. | 189 Use `appt-add' and `appt-delete' to add and delete appointments. |
190 The original list is generated from today's `diary-entries-list', and | 190 The original list is generated from today's `diary-entries-list', and |
191 can be regenerated using the function `appt-check'. | 191 can be regenerated using the function `appt-check'. |
192 Each element of the generated list has the form (MINUTES) STRING; where | 192 Each element of the generated list has the form (MINUTES STRING [FLAG]); where |
193 MINUTES is the time in minutes of the appointment after midnight, and | 193 MINUTES is the time in minutes of the appointment after midnight, and |
194 STRING is the description of the appointment.") | 194 STRING is the description of the appointment. |
195 FLAG, if non-nil, says that the element was made with `appt-add' | |
196 so calling `appt-make-list' again should preserve it.") | |
195 | 197 |
196 (defconst appt-max-time 1439 | 198 (defconst appt-max-time 1439 |
197 "11:59pm in minutes - number of minutes in a day minus 1.") | 199 "11:59pm in minutes - number of minutes in a day minus 1.") |
198 | 200 |
199 (defvar appt-mode-string nil | 201 (defvar appt-mode-string nil |
491 (unless (string-match "[0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?" | 493 (unless (string-match "[0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?" |
492 new-appt-time) | 494 new-appt-time) |
493 (error "Unacceptable time-string")) | 495 (error "Unacceptable time-string")) |
494 (let* ((appt-time-string (concat new-appt-time " " new-appt-msg)) | 496 (let* ((appt-time-string (concat new-appt-time " " new-appt-msg)) |
495 (appt-time (list (appt-convert-time new-appt-time))) | 497 (appt-time (list (appt-convert-time new-appt-time))) |
496 (time-msg (cons appt-time (list appt-time-string)))) | 498 (time-msg (list appt-time appt-time-string t))) |
497 (setq appt-time-msg-list (nconc appt-time-msg-list (list time-msg))) | 499 (setq appt-time-msg-list (nconc appt-time-msg-list (list time-msg))) |
498 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list)))) | 500 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list)))) |
499 | 501 |
500 ;;;###autoload | 502 ;;;###autoload |
501 (defun appt-delete () | 503 (defun appt-delete () |
523 (eval-when-compile (defvar number) | 525 (eval-when-compile (defvar number) |
524 (defvar original-date) | 526 (defvar original-date) |
525 (defvar diary-entries-list)) | 527 (defvar diary-entries-list)) |
526 ;;;###autoload | 528 ;;;###autoload |
527 (defun appt-make-list () | 529 (defun appt-make-list () |
528 "Create the appointments list from today's diary buffer. | 530 "Update the appointments list from today's diary buffer. |
529 The time must be at the beginning of a line for it to be | 531 The time must be at the beginning of a line for it to be |
530 put in the appointments list (see examples in documentation of | 532 put in the appointments list (see examples in documentation of |
531 the function `appt-check'). We assume that the variables DATE and | 533 the function `appt-check'). We assume that the variables DATE and |
532 NUMBER hold the arguments that `list-diary-entries' received. | 534 NUMBER hold the arguments that `list-diary-entries' received. |
533 They specify the range of dates that the diary is being processed for." | 535 They specify the range of dates that the diary is being processed for. |
536 | |
537 Any appointments made with `appt-add' are not affected by this | |
538 function." | |
534 | 539 |
535 ;; We have something to do if the range of dates that the diary is | 540 ;; We have something to do if the range of dates that the diary is |
536 ;; considering includes the current date. | 541 ;; considering includes the current date. |
537 (if (and (not (calendar-date-compare | 542 (if (and (not (calendar-date-compare |
538 (list (calendar-current-date)) | 543 (list (calendar-current-date)) |
542 (list (calendar-gregorian-from-absolute | 547 (list (calendar-gregorian-from-absolute |
543 (+ (calendar-absolute-from-gregorian original-date) | 548 (+ (calendar-absolute-from-gregorian original-date) |
544 number))))) | 549 number))))) |
545 (save-excursion | 550 (save-excursion |
546 ;; Clear the appointments list, then fill it in from the diary. | 551 ;; Clear the appointments list, then fill it in from the diary. |
547 (setq appt-time-msg-list nil) | 552 (dolist (elt appt-time-msg-list) |
553 ;; Delete any entries that were not made with appt-add. | |
554 (unless (nth 2 elt) | |
555 (setq appt-time-msg-list | |
556 (delq elt appt-time-msg-list)))) | |
548 (if diary-entries-list | 557 (if diary-entries-list |
549 | 558 |
550 ;; Cycle through the entry-list (diary-entries-list) | 559 ;; Cycle through the entry-list (diary-entries-list) |
551 ;; looking for entries beginning with a time. If | 560 ;; looking for entries beginning with a time. If |
552 ;; the entry begins with a time, add it to the | 561 ;; the entry begins with a time, add it to the |