Commit bf87510a authored by Glenn Morris's avatar Glenn Morris

(mark-included-diary-files): Only kill included diary buffer if it was

not already being visited.
Reported by Stephen Berman <Stephen.Berman@gmx.net>.
parent 85be564d
......@@ -1050,15 +1050,18 @@ changing the variable `diary-include-string'."
(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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment