1

I am trying to setup a way to systematically search through all my org-roam notes and I came across the following code that uses consult-ripgrep:

(defun bms/org-roam-rg-search ()
  "Search org-roam directory using consult-ripgrep. With live-preview."
  (interactive)
  (let ((consult-ripgrep-command "rg --multiline --null --ignore-case --type org --line-buffered --color=always --max-columns=500 --no-heading --line-number . -e ARG OPTS"))
    (consult-ripgrep org-roam-directory)))

I am using doom emacs and I setup the above code in my config.el file. However, when I run M-x bms/org-roam-rg-search and type in anything, it asks me about 'matched required' as shown: enter image description here

I am confused about what I am doing incorrect as it is searching the correct folder where my notes are stored and I am typing in keywords that exist in the directory but nothing shows up. When I open an eshell terminal and type rg test I get several matches but consult-ripgrep asking me for match required even though I typed in a string.

1
  • 1
    Your function works on my side. Nov 7, 2022 at 1:51

2 Answers 2

2

So I looked at the consul-ripgrep and consul-grep documentation and I'm still not entirely sure how the INITIAL parameter is meant to be used however I took your code and just added an empty string as the last parameter to the call to consult-ripgrep and it seems to be working now:

(defun local/org-roam-rg-search ()
  "Search org-roam directory using consult-ripgrep. With live-preview."
  (interactive)
  (let ((consult-ripgrep-command "rg --multiline --null --ignore-case --type org --line-buffered --color=always --max-columns=500 --no-heading --line-number . -e ARG OPTS"))
  (consult-ripgrep org-roam-directory "")))
2
  • I made the change as you did and I still get the same issue as above. Now that I look closely, when I type M-x consult-ripgrep-command nothing shows up. But M-x consult-ripgrep does show up.
    – user39286
    Nov 6, 2022 at 15:18
  • The "initial" parameter for when you want to pre-populate the minibuffer with some search text. Useful when you already know some of what the query will contain, etc.
    – mtraceur
    Sep 9 at 21:13
0

I am trying to setup a way to systematically search through all my org-roam notes ... I am using doom emacs

Doom's built-in function +default/org-notes-search does exactly this. It is bound to SPC n s (when using evil).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.