From 195a6afb5f809986505556f0b952c3c1223f92f7 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 327005f..608ffef 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1896,7 +1896,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)))