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

Always prompt for directory when starting consult-ripgrep #900

Closed
petergaultney opened this issue Dec 5, 2023 · 2 comments
Closed

Always prompt for directory when starting consult-ripgrep #900

petergaultney opened this issue Dec 5, 2023 · 2 comments

Comments

@petergaultney
Copy link

I wanted to do something like #605 but don't have enough ELisp chops (or time in my day) to figure out how to switch directories once a consult-ripgrep session has started. I'd like to just drop into the directory picker and then go back to my search.

It would be really cool if consult-ripgrep had a more featureful interface (I know @minad prefers composable packages rather than built-in functions) that would allow the user to change the context while inside it.

Anyway, in the absence of that, I will post my hacked-together solution and close this issue so that others might benefit.

@petergaultney
Copy link
Author

I hacked the following together, which I'm going to swap into the keybinding that I've been using for consult-ripgrep itself - I pretty much always want to choose a directory that isn't the project directory, and if I did want the project directory, it's just one additional tap on Enter.

(defun my/consult-ripgrep ()
  (interactive)
  (run-at-time 0 nil #'consult-ripgrep
     (universal-argument)
    ))

I don't really understand why run-at-time is necessary here, but it didn't work without it, and I stole that idea from this other related issue I found while looking around.

@minad
Copy link
Owner

minad commented Dec 5, 2023

The following should work:

(defun consult-ripgrep-always-prompt-dir ()
  (interactive)
  (consult-ripgrep t))

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