mirror of
https://github.com/chrisbarrett/nursery
synced 2025-08-17 13:33:32 -05:00
Make ripgrep flags customisable for org-roam-search
This commit is contained in:
@@ -63,6 +63,11 @@
|
|||||||
:group 'org-roam-search
|
:group 'org-roam-search
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
|
(defcustom org-roam-search-ripgrep-flags '("--follow" "--smart-case" "--json")
|
||||||
|
"The flags to apply when searching via ripgrep."
|
||||||
|
:group 'org-roam-search
|
||||||
|
:type '(list string))
|
||||||
|
|
||||||
(defcustom org-roam-search-ignored-tags nil
|
(defcustom org-roam-search-ignored-tags nil
|
||||||
"A list of tags for nodes that should never be included in search results.
|
"A list of tags for nodes that should never be included in search results.
|
||||||
|
|
||||||
@@ -161,9 +166,10 @@ would be excluded."
|
|||||||
|
|
||||||
(defun org-roam-search--ripgrep-for-nodes (query)
|
(defun org-roam-search--ripgrep-for-nodes (query)
|
||||||
(let ((reporter (make-progress-reporter "Searching nodes"))
|
(let ((reporter (make-progress-reporter "Searching nodes"))
|
||||||
(files (ht-create)))
|
(files (ht-create))
|
||||||
|
(ripgrep-args (append org-roam-search-ripgrep-flags (list query org-roam-directory))))
|
||||||
(async-wait
|
(async-wait
|
||||||
(async-start-process "ripgrep" org-roam-search-ripgrep-program
|
(apply 'async-start-process "ripgrep" org-roam-search-ripgrep-program
|
||||||
(lambda (_)
|
(lambda (_)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (not (eobp))
|
(while (not (eobp))
|
||||||
@@ -179,9 +185,7 @@ would be excluded."
|
|||||||
(file (expand-file-name file org-roam-directory)))
|
(file (expand-file-name file org-roam-directory)))
|
||||||
(puthash file file files))
|
(puthash file file files))
|
||||||
(forward-line)))
|
(forward-line)))
|
||||||
"--smart-case"
|
ripgrep-args))
|
||||||
"--json"
|
|
||||||
query org-roam-directory))
|
|
||||||
(progress-reporter-done reporter)
|
(progress-reporter-done reporter)
|
||||||
(seq-filter (lambda (node)
|
(seq-filter (lambda (node)
|
||||||
(and (ht-get files (org-roam-node-file node))
|
(and (ht-get files (org-roam-node-file node))
|
||||||
|
Reference in New Issue
Block a user