Browse Source

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.
Kyle Meyer 4 years ago
parent
commit
11e8749102
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lisp/org-clock.el

+ 2 - 1
lisp/org-clock.el

@@ -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))