org-clock: Fix org-agenda-prepare-buffers call

* lisp/org-clock.el (org-dblock-write:clocktable): Pass buffer to
  org-agenda-prepare-buffers when buffer is not visiting file.

This surfaced as an error when 05efa7a ("Backport commit 3a5f751 from
Emacs master branch", 2015-08-08) replaced a
'(while (setq VAR (pop LIST)) BODY)' with '(dolist (VAR LIST) BODY)',
resulting in the body being executed when '(nil)' was passed to
org-agenda-prepare-buffers.
This commit is contained in:
Kyle Meyer 2015-08-09 21:29:14 -04:00
parent 04aea5ea6f
commit 11e8749102

View file

@ -2419,7 +2419,8 @@ the currently selected interval size."
;; Just from the current file
(save-restriction
;; get the right range into the restriction
(org-agenda-prepare-buffers (list (buffer-file-name)))
(org-agenda-prepare-buffers (list (or (buffer-file-name)
(current-buffer))))
(cond
((not scope)) ; use the restriction as it is now
((eq scope 'file) (widen))