Переглянути джерело

clock: Generate clock report with archives in indirect buffers

* lisp/org-clock.el (org-dblock-write:clocktable): Get archives from
original buffer, not from indirect one.

Reported-by: Alois Janíček <janicek.dev@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-05/msg00282.html>
Nicolas Goaziou 5 роки тому
батько
коміт
8e6fb13a48
1 змінених файлів з 5 додано та 4 видалено
  1. 5 4
      lisp/org-clock.el

+ 5 - 4
lisp/org-clock.el

@@ -2453,20 +2453,21 @@ the currently selected interval size."
   (setq params (org-combine-plists org-clocktable-defaults params))
   (catch 'exit
     (let* ((scope (plist-get params :scope))
+	   (base-buffer (org-base-buffer (current-buffer)))
 	   (files (pcase scope
 		    (`agenda
 		     (org-agenda-files t))
 		    (`agenda-with-archives
 		     (org-add-archive-files (org-agenda-files t)))
 		    (`file-with-archives
-		     (and buffer-file-name
-			  (org-add-archive-files (list buffer-file-name))))
+		     (let ((base-file (buffer-file-name base-buffer)))
+		       (and base-file
+			    (org-add-archive-files (list base-file)))))
 		    ((or `nil `file `subtree `tree
 			 (and (pred symbolp)
 			      (guard (string-match "\\`tree\\([0-9]+\\)\\'"
 						   (symbol-name scope)))))
-		     (or (buffer-file-name (buffer-base-buffer))
-			 (current-buffer)))
+		     base-buffer)
 		    ((pred functionp) (funcall scope))
 		    ((pred consp) scope)
 		    (_ (user-error "Unknown scope: %S" scope))))