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
|
||||
: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
|
||||
"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)
|
||||
(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-start-process "ripgrep" org-roam-search-ripgrep-program
|
||||
(apply 'async-start-process "ripgrep" org-roam-search-ripgrep-program
|
||||
(lambda (_)
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
@@ -179,9 +185,7 @@ would be excluded."
|
||||
(file (expand-file-name file org-roam-directory)))
|
||||
(puthash file file files))
|
||||
(forward-line)))
|
||||
"--smart-case"
|
||||
"--json"
|
||||
query org-roam-directory))
|
||||
ripgrep-args))
|
||||
(progress-reporter-done reporter)
|
||||
(seq-filter (lambda (node)
|
||||
(and (ht-get files (org-roam-node-file node))
|
||||
|
Reference in New Issue
Block a user