-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
General support for narrowing prefixes (used by consult-buffer and consult-flycheck as of now) #55
Conversation
Also perform some renamings in consult for consistency
Up to now we only depend on lightweight components, it is okay to require them directly.
Maybe it is good enough. It certainly is good enough for orderless users. Orderless is comically configurable, you can configure it so a string of the form Of course, you don't want to cater just to Orderless users. EDIT: (If you really wanted it to be |
@oantolin I found something better - I just implemented the space hack. (You used b#, because this is what I used before) |
6f552cb
to
9b0e105
Compare
@oantolin Could you help me as the local actions expert - what is the best way to bind the SPC key only locally for the current command? Use minibuffer setup and exit hooks and define/undefine there? But this is not compatible with recursion right? Or can I only modify the keymap locally somehow? |
9b0e105
to
368782b
Compare
So you removed the |
I don't know! This would be good to figure out. Embark never needed this since the funky keybindings don't need to be active for the entire minibuffer completion session, only immediately after running |
Yes, I removed that again. This does not work well. Sorry for the confusion. |
I think the setup and exit hooks are your best bet. With some extra local variables to keep track of state you can get it right on recursive minibuffers too. |
@oantolin I added an implementation which seems to work. I think this approach is acceptable. What do you think in general about this method to implement narrowing? The nice thing is that it can possibly generalize to arbitrary other candidates and is reasonably low-tech. You only need the setup and add a prefix to the candidates. |
1733646
to
fb7996e
Compare
I tested with selectrum and it wokrs great after I found out how to set the keymap ;) Congrats for getting a general solution working! |
@clemera Thanks. Yes, see the UPDATE above and the docstring. I am using zero-width-space for now. It is weird when |
Yes that's a nice idea. Though for me I see ZWSP box because I have things setup so I see format-control chars (via |
Ok, in that case I suggest to use for example the vertical line character. Or some unicode colon? Therefore I made that configurable. |
Yeah, I will think about it, maybe it's not to bad to have a visible char like an arrow or something, than you also see you need to delete it. |
It works great with icomplete too! It should probably support the default completion as well, the relevant map would be You have a typo: in |
I like |
This reverts commit 3b82760.
62ba050
to
14b6aa0
Compare
I think either way would be fine though as you say the more visible approach could be less confusing for first time users. |
I was going to say the same thing as @clemera. The ellipsis is slightly less confusing, but I don't think the zero width space is actually very confusing and would be fine too. I do know that I wouldn't bother changing the default, so I know I'm OK with either one. |
edacac4
to
506dbd4
Compare
I implemented the low-tech consult-buffer solution. I prefix everything with "b#" etc. The prefix is hidden with the display property which is nice. However in order to narrow one has to press "b # SPC" and this is worse than the old behavior. Furthermore there is no support for showing invisible buffers anymore. The consult--buffer-selectrum implementation supported pressing SPC and then only the invisible buffers where shown.
I don't like it.Now I do!See #10.
Ping @clemera @oantolin
UPDATE: I prefix everything with "b [zero-width-space]". Then I modify the keymap such that if pressing space after a prefix character like "b", it inserts "[zero-width-space] SPC". This works nicely, allows widening by deleting the prefix characters again etc. I am happy with the solution. It is reasonably low-tech. No dynamic candidates. Only the keymap tweak.