From 7f512bed15ec6dba309d0aaacfe718fce637aa93 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 15:41:07 +0200 Subject: [PATCH] Avoid duplicate entries in Org location queries This happens when the current buffer is already part of the Org agenda files. In this case, we do not add the default buffer to the list of search files. --- site-lisp/db-org.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index ec17a16..a58632b 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1898,7 +1898,8 @@ linking to any item." org-agenda-files))) (scope (cond (use-all-org-files - (append (list (buffer-file-name default-buffer)) + (append (unless current-buffer-is-in-org-agenda-files? ; avoid duplicate entries + (list (buffer-file-name default-buffer))) (org-agenda-files) (cl-remove-if-not #'stringp org-agenda-text-search-extra-files)))