Skip to content

Commit

Permalink
projectile-ripgrep: Align with projectile-ag
Browse files Browse the repository at this point in the history
Align the code with what projectile-ag does. Specifically:

- Expose the prefix arg as an actual argument
- Show that we're doing a regexp search
  • Loading branch information
mattiasb authored and bbatsov committed Apr 15, 2019
1 parent 8bfa1cf commit 919896e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -3214,20 +3214,22 @@ regular expression."
(error "Package 'ag' is not available")))

;;;###autoload
(defun projectile-ripgrep (search-term)
(defun projectile-ripgrep (search-term &optional arg)
"Run a Ripgrep search with `SEARCH-TERM' at current project root.
With an optional prefix argument ARG SEARCH-TERM is interpreted as a
regular expression."
(interactive (list (projectile--read-search-string-with-default
"Ripgrep search for")))
(interactive
(list (projectile--read-search-string-with-default
(format "Ripgrep %ssearch for" (if current-prefix-arg "regexp " "")))
current-prefix-arg))
(if (require 'ripgrep nil 'noerror)
(let ((args (mapcar (lambda (val) (concat "--glob !" val))
(append projectile-globally-ignored-files
projectile-globally-ignored-directories))))
(ripgrep-regexp search-term
(projectile-project-root)
(if current-prefix-arg
(if arg
args
(cons "--fixed-strings" args))))
(error "Package `ripgrep' is not available")))
Expand Down

0 comments on commit 919896e

Please sign in to comment.