changeset 83015:ae6d0d2ecb1d

Merged in changes from CVS HEAD Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-31 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-55
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 11 Jan 2004 23:12:24 +0000
parents f5cadabb36dd (current diff) 3e89773f1456 (diff)
children 1d7467694692
files lisp/ChangeLog src/alloc.c
diffstat 10 files changed, 386 insertions(+), 290 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Jan 11 21:59:40 2004 +0000
+++ b/lisp/ChangeLog	Sun Jan 11 23:12:24 2004 +0000
@@ -1,3 +1,49 @@
+2004-01-11  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+	* calendar/appt.el: Update copyright and commentary.
+	(appt-issue-message): Delete (see appt-activate).
+	(appt-visible, appt-msg-window): Make obsolete, in favour of
+	appt-display-format.
+	(appt-display-mode-line, appt-display-duration)
+	(appt-display-diary, appt-time-msg-list, appt-mode-string)
+	(appt-prev-comp-time, appt-display-count, appt-timer)
+	(appt-convert-time): Doc change.
+	(appt-disp-window-function, appt-delete-window-function): Use
+	defcustom rather than defvar.
+	(appt-display-format): New variable.
+	(appt-display-message): New function with display code from
+	appt-check.
+	(appt-check): Add optional FORCE argument.  Doc change.  Add
+	appt-make-list to diary-hook if displaying diary.  Remove
+	checking of view-diary-entries-initially.  Message
+	display section removed to new function appt-display-message.
+	(appt-display-window): Doc change.  Remove unused internal var
+	this-buffer.  Do not beep, since appt-display-message does that.
+	(appt-make-list): Doc change.  Use caar.
+	(appt-sort-list): Simplify by using builtin sort function.
+	(appt-update-list): New function for updating appts when diary is
+	saved.
+	(appt-activate): New autoloaded function to toggle package
+	functionality.
+
+	* calendar/cal-x.el: (calendar-one-frame-setup)
+	(calendar-only-one-frame-setup, calendar-two-frame-setup): Doc
+	change.
+
+	* calendar/calendar.el: Update copyright.
+	(view-diary-entries-initially, european-calendar-style): Doc
+	change.
+	(calendar-setup): Make defcustom rather than defvar.
+	(mark-visible-calendar-date): Initialize temp-face and faceinfo
+	in let binding so local to function.
+
+	* calendar/diary-lib.el: Update copyright.
+	(diary, diary-entry-time): Doc change.
+	(list-diary-entries): Doc change.  Trivial logic change.
+	(fancy-diary-display): Restore make-face command mistakenly
+	deleted 2003-05-08.
+	(show-all-diary-entries): Allow to pop-up frame if needed.
+
 2004-01-09  John Paul Wallington  <jpw@gnu.org>
 
 	* bindings.el (mode-line-change-eol): Add EVENT parameter.
--- a/lisp/calendar/appt.el	Sun Jan 11 21:59:40 2004 +0000
+++ b/lisp/calendar/appt.el	Sun Jan 11 23:12:24 2004 +0000
@@ -1,6 +1,6 @@
 ;;; appt.el --- appointment notification functions
 
-;; Copyright (C) 1989, 1990, 1994, 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1990, 1994, 1998, 2004 Free Software Foundation, Inc.
 
 ;; Author: Neil Mager <neilm@juliet.ll.mit.edu>
 ;; Maintainer: FSF
@@ -27,7 +27,7 @@
 
 ;;
 ;; appt.el - visible and/or audible notification of
-;;           appointments from ~/diary file.
+;;           appointments from diary file.
 ;;
 ;;;
 ;;; Thanks to  Edward M. Reingold for much help and many suggestions,
@@ -35,62 +35,41 @@
 ;;;
 ;;;
 ;;; This functions in this file will alert the user of a
-;;; pending appointment based on their diary file.
-;;;
-;;; A message will be displayed in the mode line of the Emacs buffer
-;;; and (if you request) the terminal will beep and display a message
-;;; from the diary in the mini-buffer, or you can choose to
-;;; have a message displayed in a new buffer.
-;;;
-;;; The variable `appt-message-warning-time' allows the
-;;; user to specify how much notice they want before the appointment. The
-;;; variable `appt-issue-message' specifies whether the user wants
-;;; to be notified of a pending appointment.
-;;;
-;;; In order to use the appt package, you only need
-;;; to load it---provided you have appointments.
-;;;
-;;; Before that, you can also set some options if you want
-;;;   (setq view-diary-entries-initially t)
-;;;   (setq appt-issue-message t)
+;;; pending appointment based on his/her diary file.  This package
+;;; is documented in the Emacs manual.
 ;;;
-;;;  This is an example of what can be in your diary file:
-;;; Monday
-;;;   9:30am Coffee break
-;;;  12:00pm Lunch
-;;;
-;;; Based upon the above lines in your .emacs and diary files,
-;;; the calendar and diary will be displayed when you enter
-;;; Emacs and your appointments list will automatically be created.
-;;; You will then be reminded at 9:20am about your coffee break
-;;; and at 11:50am to go to lunch.
+;;; To activate this package, simply use (appt-activate 1).
+;;; A `diary-file' with appointments of the format described in the
+;;; documentation of the function `appt-check' is required.
+;;; Relevant customizable variables are also listed in the
+;;; documentation of that function.
+;;; 
+;;; Today's appointment list is initialized from the diary when this
+;;; package is activated. Additionally, the appointments list is
+;;; recreated automatically at 12:01am for those who do not logout
+;;; every day or are programming late. It is also updated when the
+;;; `diary-file' is saved. Calling `appt-check' with an argument forces
+;;; a re-initialization at any time.
 ;;;
-;;; Use describe-function on appt-check for a description of other variables
-;;; that can be used to personalize the notification system.
+;;; In order to add or delete items from today's list, without
+;;; changing the diary file, use `appt-add' and `appt-delete'.
 ;;;
-;;;  In order to add or delete items from todays list, use appt-add
-;;;  and appt-delete.
-;;;
-;;;  Additionally, the appointments list is recreated automatically
-;;;  at 12:01am for those who do not logout every day or are programming
-;;;  late.
-;;;
+
 ;;; Brief internal description - Skip this if you are not interested!
 ;;;
-;;; The function appt-make-list creates the appointments list which appt-check
-;;; reads. This is all done automatically.
-;;; It is invoked from the function list-diary-entries.
+;;; The function `appt-make-list' creates the appointments list which
+;;; `appt-check' reads.
 ;;;
 ;;; You can change the way the appointment window is created/deleted by
-;;; setting  the variables
+;;; setting the variables
 ;;;
 ;;;	     appt-disp-window-function
 ;;; and
 ;;; 	     appt-delete-window-function
 ;;;
-;;; For instance, these variables can be set to functions that display
+;;; For instance, these variables could be set to functions that display
 ;;; appointments in pop-up frames, which are lowered or iconified after
-;;; appt-display-interval minutes.
+;;; `appt-display-interval' minutes.
 ;;;
 
 ;;; Code:
@@ -98,15 +77,6 @@
 ;; Make sure calendar is loaded when we compile this.
 (require 'calendar)
 
-(provide 'appt)
-
-;;;###autoload
-(defcustom appt-issue-message t
-  "*Non-nil means check for appointments in the diary buffer.
-To be detected, the diary entry must have the time
-as the first thing on a line."
-  :type 'boolean
-  :group 'appt)
 
 ;;;###autoload
 (defcustom appt-message-warning-time 12
@@ -122,80 +92,149 @@
 
 ;;;###autoload
 (defcustom appt-visible t
-  "*Non-nil means display appointment message in echo area."
+  "*Non-nil means display appointment message in echo area.
+This variable is only relevant if `appt-msg-window' is nil."
+  :type 'boolean
+  :group 'appt)
+
+(make-obsolete-variable 'appt-visible 'appt-display-format "21.4")
+
+;;;###autoload
+(defcustom appt-msg-window t
+  "*Non-nil means display appointment message in another window.
+If non-nil, this variable overrides `appt-visible'."
   :type 'boolean
   :group 'appt)
 
+(make-obsolete-variable 'appt-msg-window 'appt-display-format "21.4")
+
+;; TODO - add popup.
+(defcustom appt-display-format (cond (appt-msg-window 'window)
+                                     (appt-visible 'echo)
+                                     (t nil))
+  "How appointment reminders should be displayed.
+The options are:
+   window - use a separate window
+   echo   - use the echo area
+   nil    - no visible reminder.
+See also `appt-audible' and `appt-display-mode-line'."
+  :type '(choice
+          (const :tag "Separate window" window)
+          (const :tag "Echo-area" echo)
+          (const :tag "No visible display" nil))
+  :group 'appt
+  :version "21.4")
+
 ;;;###autoload
 (defcustom appt-display-mode-line t
-  "*Non-nil means display minutes to appointment and time on the mode line."
-  :type 'boolean
-  :group 'appt)
-
-;;;###autoload
-(defcustom appt-msg-window t
-  "*Non-nil means display appointment message in another window."
+  "*Non-nil means display minutes to appointment and time on the mode line.
+This is in addition to any other display of appointment messages."
   :type 'boolean
   :group 'appt)
 
 ;;;###autoload
 (defcustom appt-display-duration 10
-  "*The number of seconds an appointment message is displayed."
+  "*The number of seconds an appointment message is displayed.
+Only relevant if reminders are to be displayed in their own window."
   :type 'integer
   :group 'appt)
 
 ;;;###autoload
 (defcustom appt-display-diary t
-  "*Non-nil means to display the next days diary on the screen.
+  "*Non-nil displays the diary when the appointment list is first initialized.
 This will occur at midnight when the appointment list is updated."
   :type 'boolean
   :group 'appt)
 
-(defvar appt-time-msg-list nil
-  "The list of appointments for today.
-Use `appt-add' and `appt-delete' to add and delete appointments from list.
-The original list is generated from the today's `diary-entries-list'.
-The number before each time/message is the time in minutes from midnight.")
-
-(defconst appt-max-time 1439
-  "11:59pm in minutes - number of minutes in a day minus 1.")
-
 (defcustom appt-display-interval 3
   "*Number of minutes to wait between checking the appointment list."
   :type 'integer
   :group 'appt)
 
+(defcustom appt-disp-window-function 'appt-disp-window
+  "Function called to display appointment window.
+Only relevant if reminders are being displayed in a window."
+  :type '(choice (const appt-disp-window)
+                 function)
+  :group 'appt)
+
+(defcustom appt-delete-window-function 'appt-delete-window
+  "Function called to remove appointment window and buffer.
+Only relevant if reminders are being displayed in a window."
+  :type '(choice (const appt-delete-window)
+                 function)
+  :group 'appt)
+
+
+;;; Internal variables below this point.
+
 (defvar appt-buffer-name " *appt-buf*"
   "Name of the appointments buffer.")
 
-(defvar appt-disp-window-function 'appt-disp-window
-  "Function called to display appointment window.")
+(defvar appt-time-msg-list nil
+  "The list of appointments for today.
+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
+MINUTES is the time in minutes of the appointment after midnight, and
+STRING is the description of the appointment.")
 
-(defvar appt-delete-window-function 'appt-delete-window
-  "Function called to remove appointment window and buffer.")
+(defconst appt-max-time 1439
+  "11:59pm in minutes - number of minutes in a day minus 1.")
 
 (defvar appt-mode-string nil
   "String being displayed in the mode line saying you have an appointment.
-The actual string includes the amount of time till the appointment.")
+The actual string includes the amount of time till the appointment.
+Only used if `appt-display-mode-line' is non-nil.")
 
 (defvar appt-prev-comp-time nil
-  "Time of day (mins since midnight) at which we last checked appointments.")
+  "Time of day (mins since midnight) at which we last checked appointments.
+A nil value forces the diary file to be (re-)checked for appointments.")
 
 (defvar appt-now-displayed nil
   "Non-nil when we have started notifying about a appointment that is near.")
 
-(defvar appt-display-count nil)
+(defvar appt-display-count nil
+  "Internal variable used to count number of consecutive reminders.")
+
+(defvar appt-timer nil
+  "Timer used for diary appointment notifications (`appt-check').
+If this is non-nil, appointment checking is active.")
+
+
+;;; Functions.
 
-(defun appt-check ()
-  "Check for an appointment and update the mode line.
+(defun appt-display-message (string mins)
+  "Display a reminder about an appointment.
+The string STRING describes the appointment, due in integer MINS minutes.
+The format of the visible reminder is controlled by `appt-display-format'.
+The variable `appt-audible' controls the audible reminder."
+  (cond ((eq appt-display-format 'window)
+         (funcall appt-disp-window-function
+                  (number-to-string mins)
+                  (format-time-string "%a %b %e " (current-time))
+                  string)
+         (run-at-time (format "%d sec" appt-display-duration)
+                      nil
+                      appt-delete-window-function))
+        ((eq appt-display-format 'echo)
+         (message "%s" string)))
+  (if appt-audible (beep 1)))
+
+
+(defun appt-check (&optional force)
+  "Check for an appointment and update any reminder display.
+If optional argument FORCE is non-nil, reparse the diary file for
+appointments.  Otherwise the diary file is only parsed once per day,
+and when saved.
+
 Note: the time must be the first thing in the line in the diary
-for a warning to be issued.
+for a warning to be issued.  The format of the time can be either
+24 hour or am/pm.  For example:
 
-The format of the time can be either 24 hour or am/pm.
-Example:
-
-               02/23/89
-                 18:00 Dinner
+              02/23/89
+                18:00 Dinner
 
               Thursday
                 11:45am Lunch meeting.
@@ -203,42 +242,41 @@
 Appointments are checked every `appt-display-interval' minutes.
 The following variables control appointment notification:
 
-`appt-issue-message'
-	If t, the diary buffer is checked for appointments.
-
-`appt-message-warning-time'
-	Variable used to determine if appointment message
-	should be displayed.
+`appt-display-format'
+        Controls the format in which reminders are displayed.
 
 `appt-audible'
-	Variable used to determine if appointment is audible.
+	Variable used to determine if reminder is audible.
 	Default is t.
 
-`appt-visible'
-	Variable used to determine if appointment message should be
-	displayed in the mini-buffer.  Default is t.
+`appt-message-warning-time'
+	Variable used to determine when appointment message
+	should first be displayed.
+
+`appt-display-mode-line'
+        If non-nil, a generic message giving the time remaining
+        is shown in the mode-line when an appointment is due.
 
-`appt-msg-window'
-	Variable used to determine if appointment message
-	should temporarily appear in another window.  Mutually exclusive
-	to `appt-visible'.
+`appt-display-interval'
+        Interval in minutes at which to check for pending appointments.
+
+`appt-display-diary'
+        Display the diary buffer when the appointment list is
+        initialized for the first time in a day.
+
+The following variables are only relevant if reminders are being
+displayed in a window:
 
 `appt-display-duration'
-	The number of seconds an appointment message
-	is displayed in another window.
+	The number of seconds an appointment message is displayed.
 
 `appt-disp-window-function'
-    	Function called to display appointment window.  You can customize
-	appt.el by setting this variable to a function different from the
-	one provided with this package.
+    	Function called to display appointment window.
 
 `appt-delete-window-function'
-    	Function called to remove appointment window and buffer.  You can
-	customize appt.el by setting this variable to a function different
-	from the one provided with this package."
+    	Function called to remove appointment window and buffer."
 
   (let* ((min-to-app -1)
-	 (new-time "")
 	 (prev-appt-mode-string appt-mode-string)
 	 (prev-appt-display-count (or appt-display-count 0))
 	 ;; Non-nil means do a full check for pending appointments
@@ -248,7 +286,7 @@
 	 (full-check
 	  (or (not appt-now-displayed)
 	      ;; This is true every appt-display-interval minutes.
-	      (= 0 (mod prev-appt-display-count appt-display-interval))))
+	      (zerop (mod prev-appt-display-count appt-display-interval))))
 	 ;; Non-nil means only update the interval displayed in the mode line.
 	 (mode-line-only
 	  (and (not full-check) appt-now-displayed)))
@@ -267,26 +305,31 @@
 	  ;; At the first check in any given day, update our
 	  ;; appointments to today's list.
 
-	  (if (or (null appt-prev-comp-time)
-		  (< cur-comp-time appt-prev-comp-time))
+	  (if (or force
+                  (null appt-prev-comp-time)             ; first check
+		  (< cur-comp-time appt-prev-comp-time)) ; new day
 	      (condition-case nil
 		  (progn
-		    (if (and view-diary-entries-initially appt-display-diary)
-			(diary)
+		    (if appt-display-diary
+                        (let ((diary-hook
+                               (if (assoc 'appt-make-list diary-hook)
+                                   diary-hook
+                                 (cons 'appt-make-list diary-hook))))
+                          (diary))
 		      (let ((diary-display-hook 'appt-make-list))
 			(diary))))
 		(error nil)))
-	  (setq appt-prev-comp-time cur-comp-time)
 
-	  (setq appt-mode-string nil)
-	  (setq appt-display-count nil)
+	  (setq appt-prev-comp-time cur-comp-time
+                appt-mode-string nil
+                appt-display-count nil)
 
 	  ;; If there are entries in the list, and the
 	  ;; user wants a message issued,
 	  ;; get the first time off of the list
 	  ;; and calculate the number of minutes until the appointment.
 
-	  (if (and appt-issue-message appt-time-msg-list)
+	  (if appt-time-msg-list
 	      (let ((appt-comp-time (car (car (car appt-time-msg-list)))))
 		(setq min-to-app (- appt-comp-time cur-comp-time))
 
@@ -317,45 +360,21 @@
 
 		(when (and (<= min-to-app appt-message-warning-time)
 			   (>= min-to-app 0))
-		  (setq appt-now-displayed t)
-		  (setq appt-display-count
-			(1+ prev-appt-display-count))
+		  (setq appt-now-displayed t
+                        appt-display-count (1+ prev-appt-display-count))
 		  (unless mode-line-only
-		    (if appt-msg-window
-			(progn
-			  (setq new-time (format-time-string "%a %b %e "
-							     (current-time)))
-			  (funcall
-			   appt-disp-window-function
-			   (number-to-string min-to-app) new-time
-			   (car (cdr (car appt-time-msg-list))))
-
-			  (run-at-time
-			   (format "%d sec" appt-display-duration)
-			   nil
-			   appt-delete-window-function))
-			      ;;; else
-
-		      (if appt-visible
-			  (message "%s"
-				   (car (cdr (car appt-time-msg-list)))))
-
-		      (if appt-audible
-			  (beep 1))))
-
+                    (appt-display-message (cadr (car appt-time-msg-list))
+                                          min-to-app))
 		  (when appt-display-mode-line
 		    (setq appt-mode-string
-			  (concat  " App't in "
-				   (number-to-string min-to-app)
-				   " min. ")))
+                          (format " App't in %s min." min-to-app)))
 
 		  ;; When an appointment is reached,
 		  ;; delete it from the list.
 		  ;; Reset the count to 0 in case we display another
 		  ;; appointment on the next cycle.
-		  (if (= min-to-app 0)
-		      (setq appt-time-msg-list
-			    (cdr appt-time-msg-list)
+		  (if (zerop min-to-app)
+		      (setq appt-time-msg-list (cdr appt-time-msg-list)
 			    appt-display-count nil)))))
 
 	  ;; If we have changed the mode line string,
@@ -372,7 +391,9 @@
 
 
 (defun appt-disp-window (min-to-app new-time appt-msg)
-  "Display appointment message APPT-MSG in a separate buffer."
+  "Display appointment message APPT-MSG in a separate buffer.
+The appointment is due in MIN-TO-APP (a string) minutes.
+NEW-TIME is a string giving the date."
   (require 'electric)
 
   ;; Make sure we're not in the minibuffer
@@ -384,9 +405,8 @@
 	(if (display-multi-frame-p)
 	    (select-frame (other-frame 1)))))
 
-  (let* ((this-buffer (current-buffer))
-	 (this-window (selected-window))
-	 (appt-disp-buf (set-buffer (get-buffer-create appt-buffer-name))))
+  (let ((this-window (selected-window))
+        (appt-disp-buf (set-buffer (get-buffer-create appt-buffer-name))))
 
     (if (cdr (assq 'unsplittable (frame-parameters)))
 	;; In an unsplittable frame, use something somewhere else.
@@ -405,9 +425,7 @@
     (shrink-window-if-larger-than-buffer (get-buffer-window appt-disp-buf t))
     (set-buffer-modified-p nil)
     (raise-frame (selected-frame))
-    (select-window this-window)
-    (if appt-audible
-	(beep 1))))
+    (select-window this-window)))
 
 (defun appt-delete-window ()
   "Function called to undisplay appointment messages.
@@ -437,11 +455,9 @@
 The time should be in either 24 hour format or am/pm format."
 
   (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
-  (if (string-match "[0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?"
+  (unless (string-match "[0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?"
 		    new-appt-time)
-      nil
     (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))))
@@ -452,7 +468,7 @@
 (defun appt-delete ()
   "Delete an appointment from the list of appointments."
   (interactive)
-  (let* ((tmp-msg-list appt-time-msg-list))
+  (let ((tmp-msg-list appt-time-msg-list))
     (while tmp-msg-list
       (let* ((element (car tmp-msg-list))
              (prompt-string (concat "Delete "
@@ -476,15 +492,11 @@
 		   (defvar diary-entries-list))
 ;;;###autoload
 (defun appt-make-list ()
-  "Create the appointments list from todays diary buffer.
+  "Create 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.
-  02/23/89
-    12:00pm lunch
-   Wednesday
-     10:00am group meeting
-We assume that the variables DATE and NUMBER
-hold the arguments that `list-diary-entries' received.
+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."
 
   ;; We have something to do if the range of dates that the diary is
@@ -557,38 +569,24 @@
 	       (cur-hour (nth 2 now))
 	       (cur-min (nth 1 now))
 	       (cur-comp-time (+ (* cur-hour 60) cur-min))
-	       (appt-comp-time (car (car (car appt-time-msg-list)))))
+	       (appt-comp-time (car (caar appt-time-msg-list))))
 
 	  (while (and appt-time-msg-list (< appt-comp-time cur-comp-time))
 	    (setq appt-time-msg-list (cdr appt-time-msg-list))
 	    (if appt-time-msg-list
-		(setq appt-comp-time (car (car (car appt-time-msg-list))))))))))
+		(setq appt-comp-time (car (caar appt-time-msg-list)))))))))
 
 
 (defun appt-sort-list (appt-list)
-  "Simple sort to put the appointments list APPT-LIST in order.
-Scan the list for the smallest element left in the list.
-Append the smallest element left into the new list, and remove
-it from the original list."
-  (let ((order-list nil))
-    (while appt-list
-      (let* ((element (car appt-list))
-             (element-time (car (car element)))
-             (tmp-list (cdr appt-list)))
-        (while tmp-list
-          (if (< element-time (car (car (car tmp-list))))
-              nil
-            (setq element (car tmp-list))
-            (setq element-time (car (car element))))
-          (setq tmp-list (cdr tmp-list)))
-        (setq order-list (nconc order-list (list element)))
-        (setq appt-list (delq element appt-list))))
-    order-list))
+  "Sort an appointment list, putting earlier items at the front.
+APPT-LIST is a list of the same format as `appt-time-msg-list'."
+(sort appt-list (lambda (e1 e2) (< (caar e1) (caar e2)))))
 
 
 (defun appt-convert-time (time2conv)
   "Convert hour:min[am/pm] format to minutes from midnight.
-Also try to accept the hour.min[am/pm] format."
+A period (.) can be used instead of a colon (:) to separate the
+hour and minute parts."
   (let ((conv-time 0)
         (hr 0)
         (min 0))
@@ -615,16 +613,41 @@
     (setq conv-time (+ (* hr 60) min))
     conv-time))
 
-(defvar appt-timer nil
-  "Timer used for diary appointment notifications (`appt-check').")
+
+(defun appt-update-list ()
+  "If the current buffer is visiting the diary, update appointments.
+This function is intended for use with `write-file-functions'."
+  (and (equal buffer-file-name (expand-file-name diary-file))
+       appt-timer
+       (let ((appt-display-diary nil))
+         (appt-check t)))
+  nil)
+
 
-(unless appt-timer
-  (setq appt-timer (run-at-time t 60 'appt-check)))
+;;;###autoload
+(defun appt-activate (&optional arg)
+"Toggle checking of appointments.
+With optional numeric argument ARG, turn appointment checking on if
+ARG is positive, otherwise off."
+  (interactive "P")
+  (let ((appt-active appt-timer))
+    (setq appt-active (if arg (> (prefix-numeric-value arg) 0)
+                        (not appt-active)))
+    (remove-hook 'write-file-functions 'appt-update-list)
+    (or global-mode-string (setq global-mode-string '("")))
+    (delq 'appt-mode-string global-mode-string)
+    (and appt-timer
+         (cancel-timer appt-timer)
+         (setq appt-timer nil))
+    (when appt-active
+      (add-hook 'write-file-functions 'appt-update-list)
+      (setq appt-timer (run-at-time t 60 'appt-check)
+            global-mode-string
+            (append global-mode-string '(appt-mode-string)))
+      (appt-check t))))
 
-(or global-mode-string (setq global-mode-string '("")))
-(or (memq 'appt-mode-string global-mode-string)
-    (setq global-mode-string
-	  (append global-mode-string '(appt-mode-string))))
+
+(provide 'appt)
 
 ;;; arch-tag: bf5791c4-8921-499e-a26f-772b1788d347
 ;;; appt.el ends here
--- a/lisp/calendar/cal-x.el	Sun Jan 11 21:59:40 2004 +0000
+++ b/lisp/calendar/cal-x.el	Sun Jan 11 23:12:24 2004 +0000
@@ -69,7 +69,9 @@
 Can be used to change frame parameters, such as font, color, location, etc.")
 
 (defun calendar-one-frame-setup (&optional arg)
-  "Start calendar and display it in a dedicated frame together with the diary."
+  "Start calendar and display it in a dedicated frame together with the diary.
+This function requires a display capable of multiple frames, else
+`calendar-basic-setup' is used instead."
   (if (not (display-multi-frame-p))
       (calendar-basic-setup arg)
     (if (frame-live-p calendar-frame) (delete-frame calendar-frame))
@@ -97,7 +99,9 @@
            'diary))))))
 
 (defun calendar-only-one-frame-setup (&optional arg)
-  "Start calendar and display it in a dedicated frame."
+  "Start calendar and display it in a dedicated frame.
+This function requires a display capable of multiple frames, else
+`calendar-basic-setup' is used instead."
   (if (not (display-multi-frame-p))
       (calendar-basic-setup arg)
     (if (frame-live-p calendar-frame) (delete-frame calendar-frame))
@@ -116,7 +120,9 @@
           (set-window-dedicated-p (selected-window) 'calendar))))))
 
 (defun calendar-two-frame-setup (&optional arg)
-  "Start calendar and diary in separate, dedicated frames."
+  "Start calendar and diary in separate, dedicated frames.
+This function requires a display capable of multiple frames, else
+`calendar-basic-setup' is used instead."
   (if (not (display-multi-frame-p))
       (calendar-basic-setup arg)
     (if (frame-live-p calendar-frame) (delete-frame calendar-frame))
--- a/lisp/calendar/calendar.el	Sun Jan 11 21:59:40 2004 +0000
+++ b/lisp/calendar/calendar.el	Sun Jan 11 23:12:24 2004 +0000
@@ -1,7 +1,7 @@
 ;;; calendar.el --- calendar functions
 
 ;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997,
-;;	2000, 2001, 2003 Free Software Foundation, Inc.
+;;	2000, 2001, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Keywords: calendar
@@ -154,10 +154,11 @@
 
 ;;;###autoload
 (defcustom view-diary-entries-initially nil
-  "*Non-nil means display current date's diary entries on entry.
+  "*Non-nil means display current date's diary entries on entry to calendar.
 The diary is displayed in another window when the calendar is first displayed,
 if the current date is visible.  The number of days of diary entries displayed
-is governed by the variable `number-of-diary-entries'."
+is governed by the variable `number-of-diary-entries'.  This variable can
+be overridden by the value of `calendar-setup'."
   :type 'boolean
   :group 'diary)
 
@@ -573,7 +574,10 @@
 
 Names can be capitalized or not, written in full (as specified by the
 variable `calendar-day-name-array'), or abbreviated (as specified by
-`calendar-day-abbrev-array') with or without a period."
+`calendar-day-abbrev-array') with or without a period.  To take effect,
+this variable should be set before the calendar package and its associates
+are loaded.  Otherwise, use one of the functions `european-calendar' or
+`american-calendar' to force the appropriate update."
   :type 'boolean
   :group 'diary)
 
@@ -1445,12 +1449,19 @@
   "Start calendar and diary in separate, dedicated frames.")
 
 ;;;###autoload
-(defvar calendar-setup nil
-  "The frame set up of the calendar.
-The choices are `one-frame' (calendar and diary together in one separate,
-dedicated frame), `two-frames' (calendar and diary in separate, dedicated
-frames), `calendar-only' (calendar in a separate, dedicated frame); with
-any other value the current frame is used.")
+(defcustom calendar-setup nil
+  "The frame setup of the calendar.
+The choices are: `one-frame' (calendar and diary together in one separate,
+dedicated frame); `two-frames' (calendar and diary in separate, dedicated
+frames); `calendar-only' (calendar in a separate, dedicated frame); with
+any other value the current frame is used.  Using any of the first 
+three options overrides the value of `view-diary-entries-initially'."
+  :type '(choice
+          (const :tag "calendar and diary in separate frame" one-frame)
+          (const :tag "calendar and diary each in own frame" two-frames)
+          (const :tag "calendar in separate frame" calendar-only)
+          (const :tag "use current frame" nil))
+  :group 'calendar)
 
 ;;;###autoload
 (defun calendar (&optional arg)
@@ -2746,16 +2757,16 @@
 		  (delete-char 1)
 		  (insert mark)
 		  (forward-char -2))
-	      (progn ; attr list 
-		(setq temp-face 
-		      (make-symbol (apply 'concat "temp-face-" 
-					  (mapcar '(lambda (sym) 
-						     (cond ((symbolp sym) (symbol-name sym))
-							   ((numberp sym) (int-to-string sym))
-							   (t sym))) mark))))
+              (let ; attr list 
+                  ((temp-face 
+                    (make-symbol (apply 'concat "temp-face-" 
+                                        (mapcar '(lambda (sym) 
+                                                   (cond ((symbolp sym) (symbol-name sym))
+                                                         ((numberp sym) (int-to-string sym))
+                                                         (t sym))) mark))))
+                   (faceinfo mark))
 		(make-face temp-face)
 		;; Remove :face info from the mark, copy the face info into temp-face
-		(setq faceinfo mark)
 		(while (setq faceinfo (memq :face faceinfo))
 		  (copy-face (read (nth 1 faceinfo)) temp-face)
 		  (setcar faceinfo nil)
--- a/lisp/calendar/diary-lib.el	Sun Jan 11 21:59:40 2004 +0000
+++ b/lisp/calendar/diary-lib.el	Sun Jan 11 23:12:24 2004 +0000
@@ -1,6 +1,6 @@
 ;;; diary-lib.el --- diary functions
 
-;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995, 2003
+;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995, 2003, 2004
 ;;           Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -52,8 +52,8 @@
 (defun diary (&optional arg)
   "Generate the diary window for ARG days starting with the current date.
 If no argument is provided, the number of days of diary entries is governed
-by the variable `number-of-diary-entries'.  This function is suitable for
-execution in a `.emacs' file."
+by the variable `number-of-diary-entries'.  A value of ARG less than 1
+does nothing.  This function is suitable for execution in a `.emacs' file."
   (interactive "P")
   (diary-check-diary-file)
   (let ((date (calendar-current-date)))
@@ -284,7 +284,7 @@
   "Create and display a buffer containing the relevant lines in diary-file.
 The arguments are DATE and NUMBER; the entries selected are those
 for NUMBER days starting with date DATE.  The other entries are hidden
-using selective display.
+using selective display.  If NUMBER is less than 1, this function does nothing.
 
 Returns a list of all relevant diary entries found, if any, in order by date.
 The list entries have the form ((month day year) string specifier) where
@@ -314,29 +314,29 @@
     `diary-hook' is run last.  This can be used for an appointment
         notification function."
 
-  (if (< 0 number)
-      (let ((original-date date);; save for possible use in the hooks
-            old-diary-syntax-table
-            diary-entries-list
-            file-glob-attrs
-            (date-string (calendar-date-string date))
-            (d-file (substitute-in-file-name diary-file)))
-        (message "Preparing diary...")
-        (save-excursion
-          (let ((diary-buffer (find-buffer-visiting d-file)))
-	    (if (not diary-buffer)
-		(set-buffer (find-file-noselect d-file t))
-	      (set-buffer diary-buffer)
-	      (or (verify-visited-file-modtime diary-buffer)
-		  (revert-buffer t t))))
-	  (setq file-glob-attrs (nth 1 (diary-pull-attrs nil "")))
-          (setq selective-display t)
-          (setq selective-display-ellipses nil)
-          (if diary-header-line-flag
-              (setq header-line-format diary-header-line-format))
-          (setq old-diary-syntax-table (syntax-table))
-          (set-syntax-table diary-syntax-table)
-          (unwind-protect
+  (when (> number 0)
+    (let ((original-date date);; save for possible use in the hooks
+          old-diary-syntax-table
+          diary-entries-list
+          file-glob-attrs
+          (date-string (calendar-date-string date))
+          (d-file (substitute-in-file-name diary-file)))
+      (message "Preparing diary...")
+      (save-excursion
+        (let ((diary-buffer (find-buffer-visiting d-file)))
+          (if (not diary-buffer)
+              (set-buffer (find-file-noselect d-file t))
+            (set-buffer diary-buffer)
+            (or (verify-visited-file-modtime diary-buffer)
+                (revert-buffer t t))))
+        (setq file-glob-attrs (nth 1 (diary-pull-attrs nil "")))
+        (setq selective-display t)
+        (setq selective-display-ellipses nil)
+        (if diary-header-line-flag
+            (setq header-line-format diary-header-line-format))
+        (setq old-diary-syntax-table (syntax-table))
+        (set-syntax-table diary-syntax-table)
+        (unwind-protect
             (let ((buffer-read-only nil)
                   (diary-modified (buffer-modified-p))
                   (mark (regexp-quote diary-nonmarking-symbol)))
@@ -635,10 +635,10 @@
                                                      sym
                                                    (symbol-name sym)))
                                               marks))))
-                         faceinfo)
+                         (faceinfo marks))
+                    (make-face temp-face)
                     ;; Remove :face info from the marks,
                     ;; copy the face info into temp-face
-                    (setq faceinfo marks)
                     (while (setq faceinfo (memq :face faceinfo))
                       (copy-face (read (nth 1 faceinfo)) temp-face)
                       (setcar faceinfo nil)
@@ -715,7 +715,8 @@
 all entries, not just some, are visible.  If there is no diary buffer, one
 is created."
   (interactive)
-  (let ((d-file (diary-check-diary-file)))
+  (let ((d-file (diary-check-diary-file))
+        (pop-up-frames (window-dedicated-p (selected-window))))
     (save-excursion
       (set-buffer (or (find-buffer-visiting d-file)
                       (find-file-noselect d-file t)))
@@ -1100,8 +1101,8 @@
 
 Returns `diary-unknown-time' (default value -9999) if no time is recognized.
 The recognized forms are XXXX, X:XX, or XX:XX (military time), and XXam,
-XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm, or XX:XXPM.  We also try to
-accept time in the form XX[.XX][am/pm/AM/PM]]."
+XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm, or XX:XXPM.  A period (.) can
+be used instead of a colon (:) to separate the hour and minute parts."
   (let ((case-fold-search nil))
     (cond ((string-match        ; Military time
 	    "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)"
--- a/lisp/textmodes/texnfo-upd.el	Sun Jan 11 21:59:40 2004 +0000
+++ b/lisp/textmodes/texnfo-upd.el	Sun Jan 11 23:12:24 2004 +0000
@@ -618,10 +618,11 @@
 Single argument, END-OF-MENU, is position limiting search."
   (skip-chars-forward "[:.,\t\n ]+")
   ;; don't copy a carriage return at line beginning with asterisk!
+  ;; don't copy @detailmenu or @end menu as descriptions!
   ;; do copy a description that begins with an `@'!
   ;; !! Known bug: does not copy descriptions starting with ^|\{?* etc.
   (if (and (looking-at "\\(\\w+\\|@\\)")
-	   (not (looking-at "\\(^\\* \\|^@end menu\\)")))
+	   (not (looking-at "\\(^\\* \\|^@detailmenu\\|^@end menu\\)")))
       (buffer-substring
        (point)
        (save-excursion
@@ -1782,7 +1783,13 @@
   * this node must be the first node in the included file,
   * each highest hierarchical level node must be of the same type.
 
-Thus, normally, each included file contains one, and only one, chapter."
+Thus, normally, each included file contains one, and only one, chapter.
+
+However, when an included file does not have any node lines in
+it, this command does not try to create a menu entry for it.
+Consequently, you can include any file, such as a version or an
+update file without node lines, not just files that are
+chapters."
 
 ;; The menu-list has the form:
 ;;
--- a/man/ChangeLog	Sun Jan 11 21:59:40 2004 +0000
+++ b/man/ChangeLog	Sun Jan 11 23:12:24 2004 +0000
@@ -1,3 +1,7 @@
+2004-01-11  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+	* calendar.texi (Appointments): Update section.
+
 2003-12-29  Kevin Ryde <user42@zip.com.au>
 
 	* viper.texi (Vi Macros): Fix reference to the Emacs manual.
--- a/man/calendar.texi	Sun Jan 11 21:59:40 2004 +0000
+++ b/man/calendar.texi	Sun Jan 11 23:12:24 2004 +0000
@@ -1325,36 +1325,22 @@
 @section Appointments
 @cindex appointment notification
 
+@vindex appt-display-format
+@vindex appt-audible
   If you have a diary entry for an appointment, and that diary entry
 begins with a recognizable time of day, Emacs can warn you several
 minutes beforehand that that appointment is pending.  Emacs alerts you
-to the appointment by displaying a message in the mode line.
-
-@vindex diary-hook
-@findex appt-make-list
-  To enable appointment notification, you must enable the time display
-feature of Emacs, @kbd{M-x display-time} (@pxref{Mode Line}).  You must
-also add the function @code{appt-make-list} to the
-@code{diary-hook}, like this:
-
-@example
-(add-hook 'diary-hook 'appt-make-list)
-@end example
+to the appointment by displaying a message in your chosen format, as
+specified by the variable @code{appt-display-format}.  If the value
+of @code{appt-audible} is non-nil, an audible reminder is also given.
 
-@noindent
-Adding this text to your @file{.emacs} file does the whole job:
-
-@example
-(display-time)
-(add-hook 'diary-hook 'appt-make-list)
-(diary 0)
-@end example
-
-  With these preparations done, when you display the diary (either with
-the @kbd{d} command in the calendar window or with the @kbd{M-x diary}
-command), it sets up an appointment list of all the diary entries found
-with recognizable times of day, and reminds you just before each of
-them.
+@findex appt-activate
+  To enable appointment notification, call the function
+@code{appt-activate} with a positive argument. This sets up an
+appointment list for today from the diary file, giving all diary entries
+found with recognizable times of day, and reminds you just before each
+of them. Calling @code{appt-activate} with a negative argument disables
+the appointment package.
 
   For example, suppose the diary file contains these lines:
 
@@ -1364,19 +1350,26 @@
  12:00pm Lunch
 @end example
 
+@vindex appt-message-warning-time
 @noindent
-Then on Mondays, after you have displayed the diary, you will be
-reminded at 9:20am about your coffee break and at 11:50am about lunch.
+Then on Mondays, you will be reminded at around 9:20am about your coffee
+break and at around 11:50am about lunch. How many minutes in advance you
+are first warned is determined by the value of
+@code{appt-message-warning-time}.
 
   You can write times in am/pm style (with @samp{12:00am} standing
 for midnight and @samp{12:00pm} standing for noon), or 24-hour
 European/military style.  You need not be consistent; your diary file
-can have a mixture of the two styles.
+can have a mixture of the two styles.  Times must be at the beginning
+of lines if they are to be recognized.
 
 @vindex appt-display-diary
-  Emacs updates the appointments list automatically just after
-midnight.  This also displays the next day's diary entries in the diary
-buffer, unless you set @code{appt-display-diary} to @code{nil}.
+  Emacs updates the appointments list from the diary file automatically
+just after midnight.  An update can be forced at any time by
+re-activating the appointment package.  Both these actions also display
+the day's diary buffer, unless you set @code{appt-display-diary} to
+@code{nil}.  The appointments list is also updated whenever the
+diary file is saved.
 
 @findex appt-add
 @findex appt-delete
@@ -1386,10 +1379,6 @@
 list without affecting your diary file.  You delete entries from the
 appointment list with @kbd{M-x appt-delete}.
 
-@vindex appt-issue-message
-  You can turn off the appointment notification feature at any time by
-setting @code{appt-issue-message} to @code{nil}.
-
 @node Daylight Savings
 @section Daylight Savings Time
 @cindex daylight savings time
--- a/src/ChangeLog	Sun Jan 11 21:59:40 2004 +0000
+++ b/src/ChangeLog	Sun Jan 11 23:12:24 2004 +0000
@@ -1,3 +1,8 @@
+2004-01-11  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* alloc.c (allocate_vectorlike): Surround calls to mallopt with
+	BLOCK/UNBLOCK_INPUT.
+
 2004-01-08  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* xmenu.c (Fx_popup_dialog): Add an Ok button if no buttons are
--- a/src/alloc.c	Sun Jan 11 21:59:40 2004 +0000
+++ b/src/alloc.c	Sun Jan 11 23:12:24 2004 +0000
@@ -2499,7 +2499,9 @@
   /* Prevent mmap'ing the chunk.  Lisp data may not be mmap'ed
      because mapped region contents are not preserved in
      a dumped Emacs.  */
+  BLOCK_INPUT;
   mallopt (M_MMAP_MAX, 0);
+  UNBLOCK_INPUT;
 #endif
 
   nbytes = sizeof *p + (len - 1) * sizeof p->contents[0];
@@ -2507,7 +2509,9 @@
 
 #ifdef DOUG_LEA_MALLOC
   /* Back to a reasonable maximum of mmap'ed areas.  */
+  BLOCK_INPUT;
   mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
+  UNBLOCK_INPUT;
 #endif
 
   consing_since_gc += nbytes;