Make custom consult bookmark menu robust for upgrade

`consult--source-bookmark` is gone in later versions.
This commit is contained in:
Daniel Borchmann 2026-03-21 14:48:56 +01:00
parent 0ecb4ff55a
commit 708fc312d2
No known key found for this signature in database
GPG Key ID: 50EA937BF472ADD1

View File

@ -92,6 +92,7 @@
(defun db/shortcuts () (defun db/shortcuts ()
"Open helm completion on common locations." "Open helm completion on common locations."
(interactive) (interactive)
(require 'consult)
(let (sources) (let (sources)
(push (list :name "Frequently Used" (push (list :name "Frequently Used"
:items (mapcar #'(lambda (entry) :items (mapcar #'(lambda (entry)
@ -101,7 +102,13 @@
:annotate #'(lambda (_) "") :annotate #'(lambda (_) "")
:action #'call-interactively) :action #'call-interactively)
sources) sources)
(push 'consult--source-bookmark (push (cond
((boundp 'consult-source-bookmark)
'consult-source-bookmark)
((boundp 'consult--source-bookmark)
'consult--source-bookmark)
(t
(error "No consult source for adding bookmarks")))
sources) sources)
(when (file-directory-p db/important-documents-path) (when (file-directory-p db/important-documents-path)
(let ((search-path (expand-file-name db/important-documents-path))) (let ((search-path (expand-file-name db/important-documents-path)))