-
-
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
New function to use completing-read as the UI for completion-at-point #31
Conversation
Thank you! I will take a closer look at this soon. But probably after we got the marginalia-mode ready since then I have more capacity to add new functions. |
@oantolin I looked a bit at this and I generally agree that something like this can have its place here. Selectrum has this function, see https://github.com/raxod502/selectrum/blob/9d7ae14e4f8f43e36e68aa6194d754d114dbe707/selectrum.el#L1666. It differs a bit from your version. While it is not so nice to have this kind of duplication I think it makes sense for selectrum to provide this separately since a selectrum user might want to have that feature without buying into consult for example. Then the question is if it would make sense to have this in icomplete-vertical rather than here? Maybe you prefer to separate the concerns somehow and would rather like to see this in the consult utility packag, as a utility. Since consult is a bit of a kitchen sink package, I guess we should not draw too many lines regarding to what should be included here and what not. But I guess it makes sense to think about it a bit. @clemera what is your opinion regarding this, from the selectrum maintainer perspective? |
There are various choices how to handle special cases like in Selectrum we delegate to |
To comment on the code: Note that the proposed version doesn't handle |
I think it makes more sense to have a function like this is consult than in icomplete-vertical: not only does it not having anything to do with verticality (one would also want this with horizontal icomplete), it doesn't even really have anything to do with a completion UI. I thought that was exactly the point of consult: to collect completion functionality that is UI-independent. @clemera has a good point about Also, @clemera mentioned that this function handles the case when called from the minibuffer specially, and points out that I'll make those changes and then you can decide. |
I agree with the changes you mention it should be independent so might be nice to have it here. |
Ok, good! Will these work with selectrum too? Just out of interest - Is it sufficiently generic, since @clemera mentioned something that these functions are usually completion-system-specific? But as far as I see it if the completion system only provides the basic completing-read class of functions it makes sense to implement something like completion-at-point generically and externally and then it should be here. The other question is the one of if it is useful. If it is only ever useful to icomplete-vertical users it could go as well there, even if it is not strictly icomplete or even less vertical-related. I am still a bit undecided what should go where and finding the right boundaries. But I am not against having this as a kitchen sink package as long as the content is sufficiently high quality :) |
I think it is generic. There is still one thing my function does differently than the one in selectrum, which is that it always uses completing-read. A more closely analogous function would use read-file-name if the category metadatum indicates we are completing files. I guess I can implement that. With that change, this function would behave for selectrum users almost identically to the function in selectrum. And it isn't just useful to icomplete-vertical users: it is also useful for icomplete users that don't use icomplete-vertical, for users of |
Hey, @clemera, is the return value of |
Oh boy the recursive minibuffer thing is driving me crazy! I now remember why I delegated to |
I like the recursive minibuffer. I even made this https://github.com/minad/recursion-indicator 🤣 |
I like recursive minibuffers too, and have them enabled, but I also tend to press TAB during minibuffer completion, and this function pops me into a recursive minibuffer each time. |
Thank you for looking at it. I guess having this here makes sense since we want to collect generic functions here! @oantolin You said two things:
Do you want to fix something regarding to complete--in-region (use that?) and also use read-file-name before this is merged? Then we should add a bit of documentation to the readme - I can do that after merging. |
I will switch to read-file-name of the completion category is As for whether to use this from the minibuffer or not: would it make sense to add a customize variable controlling that behavior? If you don't want a variable, I think I'd leave the behavior as it is now (recurse always). I think I've made my peace with it. It just drove me crazy for a few hours. |
You can leave it as is without a variable. read-file-name would be good. |
This is nice in case the user has a special value of read-file-name-function or special key bindings in minibuffer-local-filename-completion-map.
OK, I'm done. |
@oantolin |
You mean exit function, right? Oh, wow, that was a silly mistake! Thanks for noticing it. I'll fix it right away. |
Also, correctly set the exit status to sole for the case of a unique completion.
@oantolin Is this ready? |
I believe so. I'm already using it and it seems fine. |
This function was requested by @tomfitzhenry in the wishlist issue #6.