emacsorphanage / helm-ag

The silver searcher with helm interface
492 stars 77 forks source link

ability to add options dynamically? (question) #408

Open pcompassion opened 1 year ago

pcompassion commented 1 year ago

I'd like to do the following when I search

- find symbol in a project 
- add restrictions (options) 
  - to narrow to files that matches a pattern (--include) 
  - to narrow to files that doesn't match a pattern (--exclude)
  - to change the base directory (it can be project root or any directory that a user wants)

(helm-ag supports most because I can just type --include etc at the helm prompt, with the exception of changing root directory , it must be done via a new search)

(helm-ag being the most flexible, with many other helm related search tools) I need to restart the search so that helm can prompt me for those options. For example, if I start out with project-root, and I decide to narrow the search to a directory, I need to start over the search from the start and specify the directory I want to search.

I suspect the dynamic search options that I describe can be done.
Because it seems to be similar to the ability to go from helm-swoop to helm-multiswoop.
Difference is that I want to go back and forth and need to keep more states (such as include files, exclude files and such)

My guess is that, you can store a context (eg include files, search query, root directory for search) then issue an updated command with the stored context.

Since it seems to take me a while to figure out that it's indeed doable, I thought I would ask first if this is indeed doable.

Especially, I'm not sure how context should be implemented in elisp. (elisp has notion of buffer-local and such, and I am not quite familiar with the concepts)
I guess my work would be easier if I can figure out how helm's session(?) can be stored.

Of course this will be easy if helm-ag or helm-grep implementation supports this type of operation.
But even if they don't, helm itself might support it.

I just wanted to ask if this functionality can be implemented either in helm-ag or helm itself.