-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
No way to provide initial input #16
Comments
Thank you! There is the |
If you call |
I have tried to use |
Thank you. I think this is indeed not possible without using the initial input argument. I wonder about the motivation for the deprecation, e.g. it needs a bit of digging through the mailing list and git blame. Then we can think of an alternative solution and ask for example the selectrum developers what they are proposing to use instead. I would like to make this project work well with both icomplete and selectrum. |
@s-kostyaev I decided to implement support for initial input since I think it can be useful in the special cases you mentioned f5ef8ba. Please let me know if it works for you. Note however that consult--read is private API, therefore and also since it benefits others, I would encourage you to make PRs if you have useful commands lying around :) If you don't have time for that, please add the command to the wishlist #6 such that we can at least keep it in mind! |
Thanks. I will provide PR as soon as I have free time. Also, why do you think selectrum has no support for |
@s-kostyaev Yes, it has. However the initial-input argument of completing-read is for some reason not passed through to selectrum-read (https://github.com/raxod502/selectrum/blob/945f8fe18933a53b2012a1d179587d90a70bb536/selectrum.el#L1616). I guess the reason is that commands using Lines 327 to 335 in c880adb
Maybe I should add that if consult uses initial input it is probably ok, since we make sure that it works well with selectrum. So I think we are good, but I hope maybe the selectrum developers change their mind since I don't like jumping through such hoops to achieve what I am looking for. Also note that |
I don't know more about this, I believe it was there from the start so @raxod502 may have more information. I also wondered about this a few times (why it is officially deprecated). Note you could also do something like: (minibuffer-with-setup-hook
(lambda () (insert "initial input"))
(completing-read "Test: " #'help--symbol-completion-table)) But I just noticed this doesn't currently work correctly with selectrum. |
@clemera Thank you for chiming in. Yes I had this before using a minibuffer-with-setup-hook, erase-minibuffer-contents, insert etc. But the solution I use now is more robust. Edit: How I read the upstream deprecation - It is deprecated for "most use-cases". But I guess it will continue to work forever and I don't see how they will get rid of this argument. Well they could also do the selectrum move and simply ignore the argument, but I don't think this is a great solution. In particular since selectrum itself supports initial input. The concept itself is therefore not deprecated. Maybe upstream should undeprecate this argument again. I think it is enough if one says that initial arguments are generally discouraged because they are intrusive etc. But as far as I see it from this issue, there are some special valid uses cases. |
Selectrum currently use exactly the same solution: |
@s-kostyaev Sure. But there are many things happening before and after. Therefore it is not a good idea to write my own hook which crashes this party. |
+1 |
Yeah, I think this may be an artifact of external packages having a lot more creativity with how to use the I was not thinking about these use cases when I developed Selectrum, so I read the docstring of |
@raxod502 Thanks for the explanation! |
Hi! Thanks for this cool project.
There is no way to provide initial input into
consult--read
. So there is no way to implementconsult-line-from-isearch
orconsult-line-symbol-at-point
. It can be very useful. Also, after this change we can add initial input asconsult-line
optional argument (like swiper does). This makes implementation that kind of functions trivial.The text was updated successfully, but these errors were encountered: