From 44c8cd7136e3fcd1e6bfa08895cac437b7a691fa Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 10 Aug 2015 12:19:13 -0400 Subject: [PATCH 1/2] org-map-entries: Fix org-agenda-prepare-buffers call * lisp/org.el (org-map-entries): Check that buffer-file-name is non-nil before passing to org-agenda-prepare-buffers. Like 11e8749, 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. Reported-by: Robert Klein --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d0ef7a645..b9fed4f4c 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -15490,7 +15490,7 @@ a *different* entry, you cannot use these techniques." (if (not scope) (progn (org-agenda-prepare-buffers - (list (buffer-file-name (current-buffer)))) + (and buffer-file-name (list buffer-file-name))) (setq res (org-scan-tags func matcher todo-only start-level))) ;; Get the right scope (cond @@ -15502,7 +15502,7 @@ a *different* entry, you cannot use these techniques." (setq scope (org-agenda-files t)) (setq scope (org-add-archive-files scope))) ((eq scope 'file) - (setq scope (list (buffer-file-name)))) + (setq scope (and buffer-file-name (list buffer-file-name)))) ((eq scope 'file-with-archives) (setq scope (org-add-archive-files (list (buffer-file-name)))))) (org-agenda-prepare-buffers scope) From 408f6da74de49fa4dfa4e0d7b7cecf22dd5ef890 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 10 Aug 2015 12:19:39 -0400 Subject: [PATCH 2/2] org-clock: Fix org-add-archive-files call * lisp/org-clock.el (org-dblock-write:clocktable): Check that buffer-file-name is non-nil before passing to org-add-archive-files. --- lisp/org-clock.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 332ea3c95..e44da734f 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -2403,7 +2403,8 @@ the currently selected interval size." (setq scope (org-agenda-files t)) (setq scope (org-add-archive-files scope))) ((eq scope 'file-with-archives) - (setq scope (org-add-archive-files (list (buffer-file-name))) + (setq scope (and buffer-file-name + (org-add-archive-files (list buffer-file-name))) one-file-with-archives t))) (setq scope-is-list (and scope (listp scope))) (if scope-is-list