dajva / rg.el

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

rg-define-search with save #60

Closed sjLambda closed 5 years ago

sjLambda commented 5 years ago

Thanks for rg.el, I've been using it for sometime now. But I just discovered rg-define-search macro and I've been using it to customize extensively. Is there a way to specify a name of the rg results buffer at the time this macro is run? I want to be able to provide the name as part of the args for the macro.

dajva commented 5 years ago

Thanks for the report. No there is no such functionality in rg-define-search. Customization for the result buffer name was recently added to master. It could be done dynamically via a function if needed. Maybe you can use that to achieve what you want?

sjLambda commented 5 years ago

Where would I do that dynamically? In rg-define-search or outside? I'm running these as a block under use-package so they run only when I need them and not slow down init startup. A quick example in the doc would help. Thanks.

dajva commented 5 years ago

This is a bit out of scope of this package's main use case so better to do it outside. I am not sure exactly how you would like to use it but something like this seems to fit your description:

(rg-define-search my-search
  :query "foo"
  :dir current
  :files "all")

(defadvice my-search (around my-search-around activate)
  "my-search with custom search buffer"
  (let ((rg-buffer-name "my search"))
    ad-do-it))
dajva commented 5 years ago

Closing this. Please reopen if you didn't get this working.