]> git.eshelyaron.com Git - emacs.git/commitdiff
Minor diary include improvement.
authorGlenn Morris <rgm@gnu.org>
Wed, 29 Sep 2010 04:00:50 +0000 (21:00 -0700)
committerGlenn Morris <rgm@gnu.org>
Wed, 29 Sep 2010 04:00:50 +0000 (21:00 -0700)
* lisp/calendar/diary-lib.el (diary-include-other-diary-files):
Trap some recursive includes.

lisp/ChangeLog
lisp/calendar/diary-lib.el

index b645e41f5d5a403fcbe7351fdd3bcc7395dad4f6..24a359cea77f0c5575647b0f29063e513e1e75a6 100644 (file)
@@ -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>
index 219e489a2ebcb80f6d44d3f3db039515908674e1..ae244e0a1b6c63cf3fdd064d120fbec55f693c42 100644 (file)
@@ -848,16 +848,18 @@ the variable `diary-include-string'."
           (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)