Subject: bug#6999: 23.2; [PATCH] appt ignores included diary files

From: Leo <[email-masked]>
Date: Wed, 08 Sep 2010 13:45:46 +0100

On 2010-09-08 13:31 +0100, Leo wrote:
> When the main diary file includes other diary files. File saving in the
> included does no appt-check, which means if one adds appointments
> directly into the included file, they will not be added by
> appt-update-list.
>
> One simple solution is to make appt-update-list do appt-check if major
> mode is diary-mode. Then users can open included files in diary mode and
> add appointments.
[...]

Annoyingly appt-check pops up the main diary buffer. So maybe do this
instead:

diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index 3573c95..32563ab 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -660,10 +660,11 @@ hour and minute parts."
 (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 (string-equal buffer-file-name (expand-file-name diary-file))
+  (and (or (string-equal buffer-file-name (expand-file-name diary-file))
+           (eq major-mode 'diary-mode))
        appt-timer
        (let ((appt-display-diary nil))
-         (appt-check t)))
+         (save-window-excursion (appt-check t))))
   nil)
 
 ;; In Emacs-21.3, the manual documented the following procedure to