Compare commits

..

No commits in common. "64b9260df7d643a81eeec1d873372f5f0d539026" and "e6b2f9eefb5e888f35398bd4a86b52bedc56b459" have entirely different histories.

2 changed files with 4 additions and 33 deletions

10
init.el
View File

@ -703,7 +703,6 @@ 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
@ -949,14 +948,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 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)

View File

@ -478,27 +478,6 @@ 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
(error "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
@ -1882,11 +1861,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 prompt)
(defun db/org-get-location (&optional use-all-org-files initial-input)
"Interactively query for location and return mark.
Use INITIAL-INPUT as initial input when filtering available
locations. Use PROMPT as prompt when given.
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
@ -1931,7 +1910,7 @@ linking to any item."
(consult--read (consult--slow-operation "Collecting headings..."
(or (consult-org--headings t nil scope)
(user-error "No headings")))
:prompt (or prompt "Choose heading: ")
:prompt "Choose heading: "
:category 'org-heading
:sort nil
:initial initial-input