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

Bug fixes and enhancement #5

Open
deb75 opened this issue Jan 24, 2023 · 1 comment
Open

Bug fixes and enhancement #5

deb75 opened this issue Jan 24, 2023 · 1 comment

Comments

@deb75
Copy link

deb75 commented Jan 24, 2023

Hi,

First, thanks for this nice package.

I had troubles using it at the beginning on windows11/mingw64/emacs29.0.60.

Here are a few modifications I made to make it work :

(defun helm-lines-search-rg (query root)
  "Search for lines matching QUERY in ROOT folder with `rg'."
  ;; https://jdhao.github.io/2020/02/16/ripgrep_cheat_sheet/
  (format (concat "rg"
                  " %s %s"
                  " --fixed-strings"
                  " --no-line-number"
                  " --no-filename"
                  " -g '!.git'"
                  " -g '!target'"
                  " -g '!node_modules'")
          query root))


(defun helm-lines-search-ag (query root)
  "Search for lines matching QUERY in ROOT folder with `ag'."
  (format (concat "ag"
                  " --literal"
                  " --nocolor"
                  " --nonumbers"
                  " --nofilename"
                  " --ignore .git"
                  " --ignore target"
                  " --ignore node_modules"
                  " %s %s")
          query root))

The main difference is that I replaced \"%s\" %s into %s %s because here :

         (cmd (concat (funcall helm-lines-search-function
                               (shell-quote-argument query)
                               (shell-quote-argument root))

you already quote arguments. This was breaking the search engine when a space appear in the query.

The other difference is that I made both engines search for literal strings, not regexp.

I guess this hard coded change could easily be made customizable.

Regards

@torgeir
Copy link
Owner

torgeir commented Jan 27, 2023

Hey!

And thanks for taking the time to fix it. Do care to have a go at making it customizable? I don’t use this package myself any longer, as I switched to vertico, but I’d be happy to accept PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants