]> git.eshelyaron.com Git - emacs.git/commitdiff
org-map-entries: Fix org-agenda-prepare-buffers call
authorPhillip Lord <phillip.lord@newcastle.ac.uk>
Sat, 30 Apr 2016 07:43:39 +0000 (08:43 +0100)
committerPhillip Lord <phillip.lord@newcastle.ac.uk>
Sat, 30 Apr 2016 13:46:44 +0000 (14:46 +0100)
* lisp/org.el (org-map-entries): Check that buffer-file-name is non-nil
  before passing to org-agenda-prepare-buffers.

This is a backport of commit 44c8cd7136e3fcd1e6bfa08895cac437b7a691fa
from upstream org-mode. Addresses bug #23365.

lisp/org/org.el

index 231daa9a6a78ff151f3a0a4654ebb86d94891469..61bcb451d70af10cc3ccc25835d825df5706a9d9 100644 (file)
@@ -15069,7 +15069,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
@@ -15081,7 +15081,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)