dajva / rg.el

Emacs search tool based on ripgrep
https://rgel.readthedocs.io
GNU General Public License v3.0
470 stars 38 forks source link

More flexibility in rg-define-search :format #74

Closed nverno closed 4 years ago

nverno commented 4 years ago

Would it be possible to allow more flexibility in rg-define-search, eg. to provide a replacement for projectile's ripgrep command which uses ripgrep.el, I'm trying the following

(rg-define-search nvp-rg-projectile
  :query (or (thing-at-point 'symbol) (read-from-minibuffer "Search: "))
  :dir project
  :format literal
  :files (concat
          (mapconcat
           #'identity
           (--map (concat "--glob !" it)
                  (append projectile-globally-ignored-files
                          projectile-globally-ignored-directories)) " "))
  :flags '("--type all"))

But, it would be nice if :format could evaluate forms, so, for example, with a prefix it would do a regex search, and a literal otherwise, eg. something like

:format (not current-prefix-arg) ; do a literal search by default, regexp with a prefix arg
dajva commented 4 years ago

Sure, that would be ok. As long as it's possible to keep the current DSL.

nverno commented 4 years ago

Cool, I'll look into later on, thanks