changeset 110639:75c1013c664c

Minor diary include improvement. * lisp/calendar/diary-lib.el (diary-include-other-diary-files): Trap some recursive includes.
author Glenn Morris <rgm@gnu.org>
date Tue, 28 Sep 2010 21:00:50 -0700
parents e82d503da7c2
children f7f67bd95f3d
files lisp/ChangeLog lisp/calendar/diary-lib.el
diffstat 2 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Sep 28 20:54:03 2010 -0700
+++ b/lisp/ChangeLog	Tue Sep 28 21:00:50 2010 -0700
@@ -1,5 +1,8 @@
 2010-09-29  Glenn Morris  <rgm@gnu.org>
 
+	* calendar/diary-lib.el (diary-include-other-diary-files):
+	Trap some recursive includes.
+
 	* calendar/appt.el (appt-activate): Check diary file.
 
 2010-09-29  Katsumi Yamaoka  <yamaoka@jpl.org>
--- a/lisp/calendar/diary-lib.el	Tue Sep 28 20:54:03 2010 -0700
+++ b/lisp/calendar/diary-lib.el	Tue Sep 28 21:00:50 2010 -0700
@@ -848,16 +848,18 @@
           (diary-list-entries-hook 'diary-include-other-diary-files)
           (diary-display-function 'ignore)
           (diary-including t)
-          diary-hook diary-list-include-blanks)
+          diary-hook diary-list-include-blanks efile)
       (if (file-exists-p diary-file)
           (if (file-readable-p diary-file)
               (unwind-protect
-                  (setq diary-included-files
-                        (append diary-included-files
-                                (list (expand-file-name diary-file)))
-                        diary-entries-list
-                        (append diary-entries-list
-                                (diary-list-entries original-date number)))
+                  (if (member (setq efile (expand-file-name diary-file))
+                              diary-included-files)
+                      (error "Recursive diary include for %s" diary-file)
+                    (setq diary-included-files
+                          (append diary-included-files (list efile))
+                          diary-entries-list
+                          (append diary-entries-list
+                                  (diary-list-entries original-date number))))
                 (with-current-buffer (find-buffer-visiting diary-file)
                   (diary-unhide-everything)))
             (beep)