-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
consult-prompt UI #130
Comments
Sounds good! Thank you for discussing first, this way we can hopefully avoid a chaos during the review as in #83. A few comments/questions:
|
What you describe sounds good. By prompt contents you mean the last output or the last line? For me prompt usually just means "dir > " or something else depending on the shell/mode. And this wouldn't been informative enough to select. That's the reason I am asking - Marginalia could also be an option to add more infos, but note that you cannot filter based on annotations. At least not directly, you can always do embark occur and then flush-lines. |
I mean something like
Do you want the output corresponding to a given input prompt to appear in Marginalia annotations as a single line of |
I don't get that. Why is there input at the prompt, which I did not execute yet? In 99% of my cases the prompt is empty.
Output to the corresponding prompt? Which output, I thought the command has not been executed? Do you mean the last command from the history and the last output? |
I think we have something different in mind. I envisioned |
Ah, now I get it. You want something which should show a list of prompts in the current buffer not jumping across buffers. Why is this even useful? Why is this needed in contrast to consult-line? Or is the idea that you can still jump across buffers since you include all prompts of all shell buffers? Yes, I had something like this helm-selector in mind which allows me to jump between shells and possible create a new one if none of a certain type exists. If you find helm-selector more useful, why do you not propose that one first? |
Same reason that
I thought you would have preferred that the |
Yes, but consult-imenu already provides something more specific since it hooks into the existing imenu infrastructure. The consult-prompt you envision is easily emulated (at least in a single buffer) by
This sounds like a very good idea too! I would actually prefer that. Note #135. So we should at first clean up the buffer sources. Right now this is an ad-hoc mess. It works but it should be cleaned up if we want to add more sources. But when I initially started this I was happy with only files and buffers. |
You want to obtain the prompts using these next-prompt functions right? This is certainly different than using consult-line regexps, but I still wonder about the tradeoffs. Maybe most of these functions also use regexps internally? I've at least seen comint-prompt-regexp. But maybe some special modes use markers instead for their next-prompt function? |
That sounds fine.
|
Okay, I see that consult-prompt would work differently than a potential more general consult-line-multibuffer. What do think about the use cases? Would you still see the need for consult-prompt or would a multi buffer search be enough? I usually prefer the more general solution if it is possible and still works reasonably well for the special cases. But there is also consult-error, so I think we can also have consult-prompt. How are the corresponding helm commands called? I saw helm-comint. Is there also the more general helm-prompt? |
One more thought - right now most commands are single buffer. Also consult-error, which is unlike counsel-compilation-error I think. This avoids the complications of selecting the relevant set of buffers. But if we add a multi buffer consult-prompt the behavior of the commands should somehow be aligned. Then there is consult-project-imenu. Maybe all consult-prompt, consult-error and consult-imenu should then be made available in two variants. A local one and one that works across buffers, with a reasonable behavior to select the relevant buffers. |
I do not expect to use
|
Okay I see! For me this consult-prompt functionality does not seem useful since I am very accustomed to regular shells and terminals. And there you usually don't do something like this. Furthermore you could always search for the input or parts of the output you remember. But this does not mean that I don't want to have this feature! But I want a simple solution and there is one readily available - we should really just use regexps! The consult-outline command already works with arbitrary regexps (at least internally), I have to recheck, but I tried at some point to generalize (see 50141d3 in the consult-match branch). I think we should go that route and simply use the correct prompt regexp.Then we get that feature (at least in the single buffer case) for free. And the multi buffer should then be implemented as consult-outline-multibuffer (if it is even needed after all). We could even implement consult-outline such that it uses the prompt regexp when used in a shell/terminal buffer! Then we wouldn't even need an extra command! Right now, when I execute consult-outline in eshell, I get the error "No headings". What do you think? But maybe using regexp is not general/robust enough, that's the question here. |
I'm fine with using a regexp with consult-outline. So it seems we should simply use an association list to determine a makeshift |
Consult-match was just an experiment. You can modify consult-outline accordingly or implement consult-prompt on top of it. I don't think we have both outlines and prompts? If the regexp approach turns out to be too weak we can still reconsider your original proposal. But let's try the easy solution first :) |
I think the discussion here has concluded, please feel free to proceed with a PR if you are still interested! I close this issue since I am not going to implement this myself as of now. The feature request is still on the wish list though, so it won't get lost. By the way, do you have any idea regarding the evil issue (emacs-evil/evil#1406)? |
As discussed in the wishlist,
consult-prompt
would offer a list of all prompts, includingeshell
,comint
, and possibly more. I'll try to implement this within the next week or so, but before I start, I want to clarify what the UI should be like.Helm has separate commands for 1) selecting a prompt from all (say)
comint
buffers and 2) selecting a prompt from only the currentcomint
buffer. Do we want separate commands here as well?Numerous major modes are derived from
comint
, so filtering bycomint
alone would lead toshell-mode
buffers getting mixed in withinf-ruby
andinferior-python
buffers, which isn't always what I would want.An alternative is to allow space-bar-filtering by major mode. If multiple major modes start with the same letter, we'd have to make a
defcustom
for the user to choose major mode gets that letter.We'd additionally need something like
to let us acquire all the prompts. The user would specify the major mode and a function to navigate to the next prompt. At each prompt, we'd extract the first line of input (not sure if there's a robust way of capturing more lines of input at a given prompt). Does this sound reasonable?
The text was updated successfully, but these errors were encountered: