Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle dired bookmarks from Bookmarks+ #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion consult-dir.el
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ arguments and return a list of directories."
"Sources used by `consult-dir--pick'."
:type '(repeat symbol))

(defcustom consult-dir-bookmark-handlers
'(nil)
"Symbols used to filter bookmarks"
:type '(repeat symbol))

(defun consult-dir--default-dirs ()
"Return the default directory and project root if available."
(let ((fulldir (expand-file-name default-directory))
Expand All @@ -137,7 +142,7 @@ arguments and return a list of directories."
(bookmark-maybe-load-default-file)
(let ((file-narrow ?f))
(thread-last bookmark-alist
(cl-remove-if (lambda (cand) (bookmark-get-handler cand)))
(cl-remove-if-not (lambda (cand) (member (bookmark-get-handler cand) consult-dir-bookmark-handlers)))
(cl-remove-if-not (lambda (cand)
(let ((bm (bookmark-get-bookmark-record cand)))
(when-let ((file (alist-get 'filename bm)))
Expand All @@ -150,6 +155,7 @@ arguments and return a list of directories."
"Return a list of project directories managed by project.el."
(unless (and (boundp 'project--list) (listp project--list))
(and (require 'project nil t)
(fboundp #'project--read-project-list)
(project--read-project-list)))
(and (boundp 'project--list) (consp project--list)
(mapcar #'car project--list)))
Expand Down