Replies: 2 comments 1 reply
-
|
I tried folloiwng but still not able to get it to work |
Beta Was this translation helpful? Give feedback.
-
|
Sorry, my mistake, should have thought better. Please see below (require 'consult-org)
(defun my/consult-org--heading-state ()
"State function for Org headings with preview."
(consult--state-with-return
(my/consult-org--heading-preview)
#'my/consult-org--heading-jump))
(defun my/consult-org--heading-preview ()
"The preview function used if selecting from a list of Org headings.
Simply wraps `consult--jump-preview'."
;; the closure that `consult--jump-preview' returns must be retained for the
;; duration of completion, since it stores the list of overlays to remove
;; ('restore' variable)
;;(let ((preview-fn (consult--jump-preview)))
(lambda (action cand)
(let ((preview-fn (consult--jump-preview)))
(funcall preview-fn action
(when cand (get-text-property 0 'org-marker cand))))))
(defun my/consult-org--heading-jump (heading)
"Jump to Org HEADING.
Simply wraps `consult--jump'."
(consult--jump (get-text-property 0 'org-marker heading)))
(defvar my-consult-org-heading-source
`(:name "Org Heading"
:category org-heading
:items ,(apply #'consult-org--headings '(nil nil nil))
:history consult-org--history
:narrow ,(consult-org--narrow)
:state ,#'my/consult-org--heading-state
:annotate ,#'consult-org--annotate))
(add-to-list 'consult-buffer-sources 'my-consult-org-heading-source 'append) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I want to add consult-org-heading to consult-buffers sources, i tried few things but not able to get it right
can anyone please share if you have done this
even if you can help with adding consult-imenu to the buffer sources, that will be of great help
Thanks !
Beta Was this translation helpful? Give feedback.
All reactions