changeset 62901:555a704ce217

(mark-included-diary-files): Only kill included diary buffer if it was not already being visited. Reported by Stephen Berman <Stephen.Berman@gmx.net>.
author Glenn Morris <rgm@gnu.org>
date Mon, 30 May 2005 11:30:47 +0000
parents ce168589b4cd
children 6812f1044f86
files lisp/calendar/diary-lib.el
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/diary-lib.el	Mon May 30 11:20:30 2005 +0000
+++ b/lisp/calendar/diary-lib.el	Mon May 30 11:30:47 2005 +0000
@@ -1050,15 +1050,18 @@
            (regexp-quote diary-include-string)
            " \"\\([^\"]*\\)\"")
           nil t)
-    (let ((diary-file (substitute-in-file-name
-                       (buffer-substring-no-properties
-                        (match-beginning 2) (match-end 2))))
-          (mark-diary-entries-hook 'mark-included-diary-files))
+    (let* ((diary-file (substitute-in-file-name
+                        (match-string-no-properties 2)))
+           (mark-diary-entries-hook 'mark-included-diary-files)
+           (dbuff (find-buffer-visiting diary-file)))
+      ;; TODO if dbuff is non-nil, should we check for modifications
+      ;; and offer to save it first?
       (if (file-exists-p diary-file)
           (if (file-readable-p diary-file)
               (progn
                 (mark-diary-entries)
-                (kill-buffer (find-buffer-visiting diary-file)))
+                (unless dbuff
+                  (kill-buffer (find-buffer-visiting diary-file))))
             (beep)
             (message "Can't read included diary file %s" diary-file)
             (sleep-for 2))