From 27582a4195d360ee7e5b1ce771edad1a11745a65 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 13:05:04 +0200 Subject: [PATCH 01/19] Replace custom usage of `org-refile-targets' with consult functions This is experimental and needs some further testing. --- site-lisp/db-org.el | 113 +++++++++++++------------------------------- 1 file changed, 32 insertions(+), 81 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 930fe63..d065ddf 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -22,6 +22,7 @@ (require 'holidays) (require 'dired) (require 'bookmark) +(require 'consult-org) (autoload 'which-function "which-func") (autoload 'org-element-property "org-element") @@ -1307,18 +1308,7 @@ Current Task: %s(replace-regexp-in-string \"%\" \"%%\" (or org-clock-current-tas " ("c" (db/org-clock-goto-first-open-checkbox nil) nil) - ("a" (with-current-buffer - ;; Make sure we are in some Org buffer, as `org-refile-get-location' - ;; might try to parse the current buffer in search for some Org - ;; headings, possibly producing errors along the way. - (->> (org-agenda-files :unrestricted) - cl-first - get-file-buffer) - ;; Show all possible items, i.e. exclude refile verification; since the - ;; cache includes only verified items, also disable it locally. - (let ((org-refile-use-cache nil) - (org-refile-target-verify-function nil)) - (org-refile '(4)))) + ("a" (consult-org-heading nil 'agenda) nil) ("s" (db/org-clock-goto-first-open-checkbox t) nil)) @@ -1882,9 +1872,9 @@ locations. When USE-ALL-ORG-FILES is nil, this functions by default searches through the current buffer if that one is an Org buffer and is associated with a file, and `db/org-default-org-file' otherwise. -If the current buffer is associated with a file from the variable -`org-agenda-files', though, the search is extended through all -agenda files (the rationale being that Org agenda files are +However, if the current buffer is associated with a file from the list +returned by the function `org-agenda-files', the search is extended +through all agenda files (the rationale being that Org agenda files are always considered to be one large data collection). When USE-ALL-ORG-FILES is non-nil, search through all files in @@ -1896,12 +1886,7 @@ Search is always conducted up to level 9. If the selected location does not have an associated point or mark, error out. Disable refile cache and any active refile filter hooks to allow linking to any item." - (let ((org-refile-target-verify-function nil) - (org-refile-use-cache nil) - ;; If the current buffer is an Org buffer and is associated with a file, - ;; search through it; otherwise, use the default Org Mode file as - ;; default buffer - (default-buffer (if (and (buffer-file-name) (derived-mode-p 'org-mode)) + (let ((default-buffer (if (and (buffer-file-name) (derived-mode-p 'org-mode)) (current-buffer) (find-file-noselect db/org-default-org-file)))) @@ -1912,67 +1897,33 @@ linking to any item." (-any (-partial #'file-equal-p it) org-agenda-files))) - ;; Default file(s) to search through; note that `default-buffer' is - ;; provided later to `org-refile-get-location' as additional argument - (org-refile-targets (append (if current-buffer-is-in-org-agenda-files? - '((org-agenda-files :maxlevel . 9)) - '((nil :maxlevel . 9))) + (scope (cond (use-all-org-files + (append (list (buffer-file-name default-buffer)) + (org-agenda-files) + (cl-remove-if-not #'stringp + org-agenda-text-search-extra-files))) + (current-buffer-is-in-org-agenda-files? + (org-agenda-files)) + (t + (list (buffer-file-name default-buffer))))) - ;; When USE-ALL-ORG-FILES is non-nil, add - ;; all agenda files, but only if not - ;; already done so. - (and use-all-org-files - (not current-buffer-is-in-org-agenda-files?) - '((org-agenda-files :maxlevel . 9))) - - ;; When USE-ALL-ORG-FILES is non-nil, add - ;; extra file files to search though. - (and use-all-org-files - `((,(cl-remove-if-not #'stringp - org-agenda-text-search-extra-files) - :maxlevel . 9))))) - - (target-pointer (let ((old-completing-read (symbol-function 'completing-read))) - ;; We temporarily overwrite `completing-read' to - ;; provide our initial input; this is necessary - ;; because `org-refile-get-location' sets the - ;; initial-input parameter of `completing-read' to - ;; nil without any possibility for a custom string. - (unwind-protect - (progn - (fset 'completing-read #'(lambda (prompt - table - &optional - predicate - require-match - _initial-input - hist - def - inherit-input-method) - (funcall old-completing-read - prompt - table - predicate - require-match - initial-input - hist - def - inherit-input-method))) - (org-refile-get-location nil default-buffer)) - (fset 'completing-read old-completing-read)))) - (pom (nth 3 target-pointer))) - (cond - ((markerp pom) pom) - ((integerp pom) - ;; Convert point to marker to ensure we are always in the correct - ;; buffer; the second element of `target-pointer' contains the path to - ;; the target file - (save-mark-and-excursion - (with-current-buffer (find-file-noselect (nth 1 target-pointer)) - (org-with-wide-buffer - (goto-char pom) - (point-marker))))) - (t (user-error "Invalid location")))))) + (pom (consult--read (consult--slow-operation "Collecting headings..." + (or (consult-org--headings nil nil scope) + (user-error "No headings"))) + :prompt "Go to heading: " + :category 'org-heading + :sort nil + :initial initial-input + :require-match t + :history '(:input consult-org--history) + :narrow (consult-org--narrow) + :annotate #'consult-org--annotate + :group #'consult-org--group + :lookup (apply-partially #'consult--lookup-prop 'org-marker) + :preview-key nil))) + (if (markerp pom) + pom + (user-error "Invalid location"))))) (defun db/org-find-links-to-current-item (arg) "Find links to current item. From 9780f1fe7fb217e8c8226758dc8210ffc77f5117 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 13:08:18 +0200 Subject: [PATCH 02/19] Use default buffer for Org location queries --- site-lisp/db-org.el | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index d065ddf..7916e81 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1907,20 +1907,21 @@ linking to any item." (t (list (buffer-file-name default-buffer))))) - (pom (consult--read (consult--slow-operation "Collecting headings..." - (or (consult-org--headings nil nil scope) - (user-error "No headings"))) - :prompt "Go to heading: " - :category 'org-heading - :sort nil - :initial initial-input - :require-match t - :history '(:input consult-org--history) - :narrow (consult-org--narrow) - :annotate #'consult-org--annotate - :group #'consult-org--group - :lookup (apply-partially #'consult--lookup-prop 'org-marker) - :preview-key nil))) + (pom (with-current-buffer default-buffer + (consult--read (consult--slow-operation "Collecting headings..." + (or (consult-org--headings nil nil scope) + (user-error "No headings"))) + :prompt "Go to heading: " + :category 'org-heading + :sort nil + :initial initial-input + :require-match t + :history '(:input consult-org--history) + :narrow (consult-org--narrow) + :annotate #'consult-org--annotate + :group #'consult-org--group + :lookup (apply-partially #'consult--lookup-prop 'org-marker) + :preview-key nil)))) (if (markerp pom) pom (user-error "Invalid location"))))) From 5d7776a6dd9a691c6a7d852e9f40891db3b44089 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 13:47:05 +0200 Subject: [PATCH 03/19] Include prefix when choosing Org heading Otherwise, the candidates seem to be truncated at the front? --- site-lisp/db-org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 7916e81..6802387 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1909,7 +1909,7 @@ linking to any item." (pom (with-current-buffer default-buffer (consult--read (consult--slow-operation "Collecting headings..." - (or (consult-org--headings nil nil scope) + (or (consult-org--headings t nil scope) (user-error "No headings"))) :prompt "Go to heading: " :category 'org-heading From e60dee0a1389db636ec1e41c873ef2876d77b91b Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 13:47:42 +0200 Subject: [PATCH 04/19] Fix prompt when choosing Org headings --- site-lisp/db-org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 6802387..ec17a16 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1911,7 +1911,7 @@ linking to any item." (consult--read (consult--slow-operation "Collecting headings..." (or (consult-org--headings t nil scope) (user-error "No headings"))) - :prompt "Go to heading: " + :prompt "Choose heading: " :category 'org-heading :sort nil :initial initial-input From 7f512bed15ec6dba309d0aaacfe718fce637aa93 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 15:41:07 +0200 Subject: [PATCH 05/19] 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))) From 504b3cab80f1c394f40fe6192718006da16340dd Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 15:42:00 +0200 Subject: [PATCH 06/19] Do not create new nodes when refiling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I haven't used this … ever? --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index 9450235..119b63c 100644 --- a/init.el +++ b/init.el @@ -872,7 +872,7 @@ split horizontally again, but this extra work should not matter much." (db/org-default-notes-file . (:maxlevel . 9))) org-refile-use-outline-path 'buffer-name org-refile-use-cache nil - org-refile-allow-creating-parent-nodes 'confirm + org-refile-allow-creating-parent-nodes 'nil org-indirect-buffer-display 'current-window org-outline-path-complete-in-steps nil org-refile-target-verify-function 'db/verify-refile-target) From eff28a53213d8a597e0b7e13089b442348a40cb1 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 15:42:47 +0200 Subject: [PATCH 07/19] Make custom Org location query function available in main init file --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 119b63c..c008c01 100644 --- a/init.el +++ b/init.el @@ -727,7 +727,8 @@ split horizontally again, but this extra work should not matter much." db/org-bookmark-store-link db/org-bookmark-export db/org-lint-invalid-bookmark-link - db/org-lint-possible-bookmark-link)) + db/org-lint-possible-bookmark-link + db/org-get-location)) ;; This is to make the byte-compiler happy about setting some variables later on ;; that are defined in those packages. From 44fb922b66077f5a2efe61a930e85333b44c0dd2 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 15:47:50 +0200 Subject: [PATCH 08/19] Allow custom prompt in own Org location query function --- site-lisp/db-org.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index a58632b..3eb516b 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1863,11 +1863,11 @@ not." (t (user-error "Neither ID nor CUSTOM_ID given"))))) (org-search-view nil query))) -(defun db/org-get-location (&optional use-all-org-files initial-input) +(defun db/org-get-location (&optional use-all-org-files initial-input prompt) "Interactively query for location and return mark. Use INITIAL-INPUT as initial input when filtering available -locations. +locations. Use PROMPT as prompt when given. When USE-ALL-ORG-FILES is nil, this functions by default searches through the current buffer if that one is an Org buffer and is @@ -1912,7 +1912,7 @@ linking to any item." (consult--read (consult--slow-operation "Collecting headings..." (or (consult-org--headings t nil scope) (user-error "No headings"))) - :prompt "Choose heading: " + :prompt (or prompt "Choose heading: ") :category 'org-heading :sort nil :initial initial-input From 1ccc8d927dd03f9d3c3dc63fb54a814bb1853977 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 17:17:50 +0200 Subject: [PATCH 09/19] Use consult for querying Org refile locations --- init.el | 10 +++++++++- site-lisp/db-org.el | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index c008c01..9f1cd8c 100644 --- a/init.el +++ b/init.el @@ -703,6 +703,7 @@ split horizontally again, but this extra work should not matter much." db/org-clock-goto-first-open-checkbox) :autoload (db/check-special-org-files-in-agenda db/verify-refile-target + db/org-refile-get-location db/find-parent-task db/ensure-running-clock db/save-current-org-task-to-file @@ -948,7 +949,14 @@ split horizontally again, but this extra work should not matter much." (org-agenda-redo-all)) ;; Inhibit direct input when point is at the beginning of a headline. - (add-to-list 'org-speed-command-hook 'db/org-ignore-insert-on-headline-start))) + (add-to-list 'org-speed-command-hook 'db/org-ignore-insert-on-headline-start) + + ;; Use consult for querying refile targets + (define-advice org-refile-get-location (:around + (orig-func prompt default-buffer new-nodes) + use-consult-instead) + (ignore orig-func) + (db/org-refile-get-location prompt default-buffer new-nodes)))) (use-package org-cycle :autoload (org-cycle-hide-drawers) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 3eb516b..9d6d4bd 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -480,6 +480,27 @@ Via %%(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer- ;; any agenda when a super-item is tagged with :HOLD:. (not (member "HOLD" (org-get-tags (point)))))) +(defun db/org-refile-get-location (prompt default-buffer new-nodes) + "Replacement function for `org-refile-get-location' using `consult'. + +This function can be used instead of `org-refile-get-location', +e.g. using `define-advice'. The parameters PROMPT, DEFAULT-BUFFER, and +NEW-NODES have the same meaning. However, setting NEW-NODES to a +non-nil value will result in a warning, as creating new headlings is not +supported with this function. + +Also note that the usual variables governing the behavior of +`org-refile' do not have any effect here. In particular, +`org-refile-verify-target-function' is not (yet) considered." + (when new-nodes + (warn "Cannot create new nodes (yet) with consult interface for `org-refile'")) + (let ((pom (with-current-buffer (or default-buffer (current-buffer)) + (db/org-get-location t nil (concat prompt " "))))) ; TODO: incorporate verify function + (list (buffer-name (marker-buffer pom)) + (buffer-file-name (marker-buffer pom)) + "" ; some regexp matching the headline? + (marker-position pom)))) + ;;; Helper Functions for Clocking From b10c97e06d80ed4b31b9d66bed8715cdaa32e083 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 17:51:01 +0200 Subject: [PATCH 10/19] Fix type signature for `org-refile-get-location` substitute function --- init.el | 2 +- site-lisp/db-org.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index 9f1cd8c..c9e5b2d 100644 --- a/init.el +++ b/init.el @@ -953,7 +953,7 @@ split horizontally again, but this extra work should not matter much." ;; Use consult for querying refile targets (define-advice org-refile-get-location (:around - (orig-func prompt default-buffer new-nodes) + (orig-func &optional prompt default-buffer new-nodes) use-consult-instead) (ignore orig-func) (db/org-refile-get-location prompt default-buffer new-nodes)))) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 9d6d4bd..8a0420a 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -480,7 +480,7 @@ Via %%(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer- ;; any agenda when a super-item is tagged with :HOLD:. (not (member "HOLD" (org-get-tags (point)))))) -(defun db/org-refile-get-location (prompt default-buffer new-nodes) +(defun db/org-refile-get-location (&optional prompt default-buffer new-nodes) "Replacement function for `org-refile-get-location' using `consult'. This function can be used instead of `org-refile-get-location', From 8c5cdd00bd0c8df02a376b98e60f005230f53576 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 17:51:33 +0200 Subject: [PATCH 11/19] Provide regular expression in custom Org refile location function Not sure what this is good for, but it might be necessary somewhen? --- 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 8a0420a..dad032a 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -498,7 +498,8 @@ Also note that the usual variables governing the behavior of (db/org-get-location t nil (concat prompt " "))))) ; TODO: incorporate verify function (list (buffer-name (marker-buffer pom)) (buffer-file-name (marker-buffer pom)) - "" ; some regexp matching the headline? + ;; The third entry is some regexp matching the headline, apparently? + (format org-complex-heading-regexp-format (org-entry-get pom "ITEM")) (marker-position pom)))) From 4dd695a33306b0a66a800136f55420beaa10462e Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 17:52:01 +0200 Subject: [PATCH 12/19] Use consult function to provide `org-goto` `org-goto` does not work as before, as our custom Org refile location query function does not honor the `org-refile-targets` variable. So, let's just use `consult-org-heading` directly, since this is what I want. --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index c9e5b2d..f03b02b 100644 --- a/init.el +++ b/init.el @@ -741,7 +741,8 @@ split horizontally again, but this extra work should not matter much." :pin "gnu" :bind (:map org-mode-map ([remap org-return] . (lambda () (interactive) (org-return :indent))) - ([remap org-clock-goto] . db/org-clock-goto-first-open-checkbox)) + ([remap org-clock-goto] . db/org-clock-goto-first-open-checkbox) + ([remap org-goto] . consult-org-heading)) :autoload (org-get-todo-state org-entry-get) :commands (org-return) From bc22db34dae5e6fdbe5b06b44a030b3f248d01fa Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 17:55:42 +0200 Subject: [PATCH 13/19] Don't quote nil --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index f03b02b..4e69e50 100644 --- a/init.el +++ b/init.el @@ -875,7 +875,7 @@ split horizontally again, but this extra work should not matter much." (db/org-default-notes-file . (:maxlevel . 9))) org-refile-use-outline-path 'buffer-name org-refile-use-cache nil - org-refile-allow-creating-parent-nodes 'nil + org-refile-allow-creating-parent-nodes nil org-indirect-buffer-display 'current-window org-outline-path-complete-in-steps nil org-refile-target-verify-function 'db/verify-refile-target) From d6ea9544349d381b73b2e86093c2466aded2f706 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 18:14:40 +0200 Subject: [PATCH 14/19] Remove obsolete docstring parts --- site-lisp/db-org.el | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index dad032a..2cf17ad 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1902,12 +1902,7 @@ always considered to be one large data collection). When USE-ALL-ORG-FILES is non-nil, search through all files in the variables `org-agenda-files', `org-agenda-text-search-extra-files', and the current file or -`db/org-default-org-file' as described above. - -Search is always conducted up to level 9. If the selected -location does not have an associated point or mark, error out. -Disable refile cache and any active refile filter hooks to allow -linking to any item." +`db/org-default-org-file' as described above." (let ((default-buffer (if (and (buffer-file-name) (derived-mode-p 'org-mode)) (current-buffer) (find-file-noselect db/org-default-org-file)))) From 4e59c1467d991d1fb2c8aa3c61e261076f490aa3 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 18:22:14 +0200 Subject: [PATCH 15/19] Remember to incorporate `org-refile-target-verify-function` --- site-lisp/db-org.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 2cf17ad..a9d926d 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -495,7 +495,10 @@ Also note that the usual variables governing the behavior of (when new-nodes (warn "Cannot create new nodes (yet) with consult interface for `org-refile'")) (let ((pom (with-current-buffer (or default-buffer (current-buffer)) - (db/org-get-location t nil (concat prompt " "))))) ; TODO: incorporate verify function + (db/org-get-location t nil (concat prompt " "))))) ; TODO: incorporate verify + ; function, use direct call to + ; consult--read for this and + ; replace the :predicate key? (list (buffer-name (marker-buffer pom)) (buffer-file-name (marker-buffer pom)) ;; The third entry is some regexp matching the headline, apparently? From cab71bf815407b64e14890532c420a8086d8704c Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 20:09:02 +0200 Subject: [PATCH 16/19] Remove obsolete configuration for `org-goto` --- init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/init.el b/init.el index 4e69e50..b11e900 100644 --- a/init.el +++ b/init.el @@ -735,7 +735,6 @@ split horizontally again, but this extra work should not matter much." ;; that are defined in those packages. (use-package org-attach) (use-package org-id) -(use-package org-goto) (use-package org :pin "gnu" @@ -781,7 +780,6 @@ split horizontally again, but this extra work should not matter much." org-attach-store-link-p 'attached org-attach-auto-tag nil org-bookmark-names-plist nil - org-goto-interface 'outline-path-completion org-id-link-to-org-use-id t org-return-follows-link t org-hide-emphasis-markers t From 251ee5ad28d31592de12e809f964cdd5d62802a4 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 20:09:11 +0200 Subject: [PATCH 17/19] Remove now unnecessary autoload --- init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init.el b/init.el index b11e900..0f2aaca 100644 --- a/init.el +++ b/init.el @@ -728,8 +728,7 @@ split horizontally again, but this extra work should not matter much." db/org-bookmark-store-link db/org-bookmark-export db/org-lint-invalid-bookmark-link - db/org-lint-possible-bookmark-link - db/org-get-location)) + db/org-lint-possible-bookmark-link)) ;; This is to make the byte-compiler happy about setting some variables later on ;; that are defined in those packages. From e50bae5c6b18ddad1b96d893fecf59570913c3c9 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 17 Aug 2025 20:11:19 +0200 Subject: [PATCH 18/19] Disable incomplete `org-refile-get-location` override for now A better implementation is needed that accomodates for `org-refile-target-verify-function`. --- init.el | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/init.el b/init.el index 0f2aaca..787cd3e 100644 --- a/init.el +++ b/init.el @@ -947,14 +947,7 @@ split horizontally again, but this extra work should not matter much." (org-agenda-redo-all)) ;; Inhibit direct input when point is at the beginning of a headline. - (add-to-list 'org-speed-command-hook 'db/org-ignore-insert-on-headline-start) - - ;; Use consult for querying refile targets - (define-advice org-refile-get-location (:around - (orig-func &optional prompt default-buffer new-nodes) - use-consult-instead) - (ignore orig-func) - (db/org-refile-get-location prompt default-buffer new-nodes)))) + (add-to-list 'org-speed-command-hook 'db/org-ignore-insert-on-headline-start))) (use-package org-cycle :autoload (org-cycle-hide-drawers) From 1f30ab8590bc69c781a44d53ff1cc27c197d2955 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Tue, 19 Aug 2025 19:38:11 +0200 Subject: [PATCH 19/19] Make sure there are no duplicates in location candidates --- site-lisp/db-org.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index a9d926d..1433f6c 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1918,11 +1918,13 @@ the variables `org-agenda-files', org-agenda-files))) (scope (cond (use-all-org-files - (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))) + (->> (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)) + (-map #'file-truename) + (-uniq))) (current-buffer-is-in-org-agenda-files? (org-agenda-files)) (t