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

Restart command in different directory #605

Closed
indigoviolet opened this issue Jul 11, 2022 · 2 comments
Closed

Restart command in different directory #605

indigoviolet opened this issue Jul 11, 2022 · 2 comments

Comments

@indigoviolet
Copy link

Similar to #596, is there a way to change the directory of an arbitrary consult command after we have already entered the prompt?

For example, let's say I'm using consult-find, I can start it with a prefix to prompt for a directory; but if I've already entered consult-find, I can't change the directory I'm searching in.

It would be nice to be able to invoke the directory prompt with some keypress and return to the consult-find command. I can kind of do this via consult-dir, by setting consult-dir-default-command, but not generically - since I don't know how to get the current consult command.

Any suggestions?

@minad
Copy link
Owner

minad commented Jul 11, 2022

You can adapt the solution from #596. In order to obtain the current command you could store this-command in a minibuffer-setup-hook. See for example Marginalia or Embark which use this technique. Emacs 28 comes with the current-minibuffer-command variable which should hold the relevant command name, but I haven't tried this variable so far.

@minad minad closed this as completed Jul 11, 2022
@petergaultney
Copy link

I'm curious if anyone ever wrote a snippet for this that they'd like to share.

I'm trying to reproduce some muscle-memory from Helm; specifically, helm-rg, which allows me to type M-d when I'm in the middle of a grep to switch into "select a directory" mode.

It would be very convenient if this were something that had a general purpose solution. Unfortunately I'm not much good at ELisp myself.

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

3 participants