changeset 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 374bd52dd8b8
children da8941727664
files lisp/calendar/appt.el
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/appt.el	Wed Feb 23 21:04:14 2005 +0000
+++ b/lisp/calendar/appt.el	Wed Feb 23 21:05:51 2005 +0000
@@ -189,9 +189,11 @@
 Use `appt-add' and `appt-delete' to add and delete appointments.
 The original list is generated from today's `diary-entries-list', and
 can be regenerated using the function `appt-check'.
-Each element of the generated list has the form (MINUTES) STRING; where
+Each element of the generated list has the form (MINUTES STRING [FLAG]); where
 MINUTES is the time in minutes of the appointment after midnight, and
-STRING is the description of the appointment.")
+STRING is the description of the appointment.
+FLAG, if non-nil, says that the element was made with `appt-add'
+so calling `appt-make-list' again should preserve it.")
 
 (defconst appt-max-time 1439
   "11:59pm in minutes - number of minutes in a day minus 1.")
@@ -493,7 +495,7 @@
     (error "Unacceptable time-string"))
   (let* ((appt-time-string (concat new-appt-time " " new-appt-msg))
          (appt-time (list (appt-convert-time new-appt-time)))
-         (time-msg (cons appt-time (list appt-time-string))))
+         (time-msg (list appt-time appt-time-string t)))
     (setq appt-time-msg-list (nconc appt-time-msg-list (list time-msg)))
     (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))))
 
@@ -525,12 +527,15 @@
 		   (defvar diary-entries-list))
 ;;;###autoload
 (defun appt-make-list ()
-  "Create the appointments list from today's diary buffer.
+  "Update the appointments list from today's diary buffer.
 The time must be at the beginning of a line for it to be
 put in the appointments list (see examples in documentation of
 the function `appt-check').  We assume that the variables DATE and
 NUMBER hold the arguments that `list-diary-entries' received.
-They specify the range of dates that the diary is being processed for."
+They specify the range of dates that the diary is being processed for.
+
+Any appointments made with `appt-add' are not affected by this
+function."
 
   ;; We have something to do if the range of dates that the diary is
   ;; considering includes the current date.
@@ -544,7 +549,11 @@
 		      number)))))
       (save-excursion
 	;; Clear the appointments list, then fill it in from the diary.
-	(setq appt-time-msg-list nil)
+	(dolist (elt appt-time-msg-list)
+	  ;; Delete any entries that were not made with appt-add.
+	  (unless (nth 2 elt)
+	    (setq appt-time-msg-list
+		  (delq elt appt-time-msg-list))))
 	(if diary-entries-list
 
 	    ;; Cycle through the entry-list (diary-entries-list)