-
-
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-completing-read-multiple
does not handle completion-file-name-table
correctly
#567
Comments
No, as far as I know CRM cannot handle complex completion tables with completion boundaries like file path completion. Are you sure that this works? For this reason consult-crm cannot handle this either. |
Certainly works for me. I'm on emacs 29.0.50. I did (completing-read-multiple "Foo: " #'completion-file-name-table) Obviously the vanilla crm interface is a bit clunky, so you have to input the separator Does it not work for you? The last reference I can find to crm in NEWS is in NEWS.24, where the separator became a regexp, so I don't think its likely to be a version issue. |
Ok, I will take a look. If this is true then I will remove consult-crm entirely from consult since we cannot implement it in the way it is implemented. |
Unfortunately it turned out that the consult-completing-read-multiple implementation is fundamentally flawed (See #567). It is also impossible to save the implementation since it was based on false assumptions. The assumption was that the completion tables passed to completing-read-multiple don't have non-trivial completion boundaries. For now I didn't remove the implementation from Consult yet since there are a few packages like Citar, which still rely on it. I will probably deprecate the command soon and remove it shortly after.
@Hugo-Heagren Thank you for point this out! You are perfectly right that the default Unfortunately there is no way we can salvage the current implementation of |
Well, I'm very sorry to see it go, I really liked the interface of consult's crm. But I agree, if I can't be properly compliant, it shouldn't be used as if it is. Could you expand on what the general nature of the problem is? You say in the commit message that "The assumption was that the completion tables passed to completing-read-multiple don't have non-trivial completion boundaries", but I'm not sure what a completion boundary is, or what the difference between trivial and non-trivial versions would be. I ask because if I find the time, I would be glad to have a go at implementing a version of consult crm again? |
The implementation of consult-crm is unfortunately too simplistic. It takes a list of the candidate strings and modifies them depending on if they are selected or not (check mark). Now if you have completion boundaries, this approach cannot work since completion candidates depend on the part of the string you are completing. For example for files the whole completion result is a full path. The boundaries are determined by the path separator (slashes). The completion fields bounded by the boundaries are the file/directory names which are completed in each step. Does this make sense? You can look into the Emacs manual for programmable completion and the boundaries action of completion tables. |
I forgot to mention trivial tables - a list of strings or an alist of symbols for example is a trivial table. For those tables completion needs only a single step to produce the final result. For those tables consult-crm worked just fine. |
Redirect back to the default implementation.
I too am very sorry to see this go and hope that this would get added back in the future. |
@jsilve24 Where did you use it? I am not sure if we find a way to put a version back which works better for the aforementioned tables with boundaries. We are basically backed into a corner by the generality of the completion tables and we have almost no design freedom left. For more restricted (trivial) tables the old approach worked well but it doesn't generalize. I think the impact of the removal is rather small since completing-read-multiple is not used widely. The main user seems to be citar (also due to its long candidate strings), but it also switched to completing-read a while ago in most cases. |
I think I've been mostly using I'm currently working on a vertico module bump, so I'll remove the Doom |
@iyefrat Thanks for mentioning your use case! I think it is similar to The only use case where consult-crm seems to be really needed is Citar, since Citar uses these long candidate strings, such that the interface becomes essentially unusable if you select multiple candidates. I hope that @bdarcus will figure out a better solution soon (essentially calling Now given that Citar is the only relevant consumer (if you buy the argument that |
Ah yeah, I've just found that, I'll be adding it to Doom. It is less convenient, since:
These are relatively minor and are not worth keeping around a broken implementation, maybe I'm missing an easier way to do these as well. There is however the added bonus with the vertico indicator of it being clearer when packages are doing nonstandard stuff with |
The underlying issue here is that the consult-crm interface is just too different from default
Magit definitely abuses the API by relying too much on the exact internal implementation. But with the removal of consult-crm all such issues should be gone anyway. |
Yeah, but I like to offload my vert&co configuration to Doom when i can help it 😛, and this feels like a too opinionated default.
Yeah Like I said it's all pretty minor, but it's still not as instantly obvious. I wonder how hard it would be to invert the syntax highlighting for the separators for example. I need to look into that. I do have a thought for the |
By "folding" do you mean like a shortened representation of it? If yes, I think we'd toyed with that idea. But it retains the more general limitations you note. edit: I just think CRM is a horrible UI in general, regardless of candidate length. |
I liked this feature a lot! Sad to see it go. Couldn't this just be kept in as an "experimental" function? It wouldn't replace completing-read-multiple by default, but the users who want it could still use it. |
Just to be clear, it never replaced |
@iyefrat Thanks for the clarification! |
@t-e-r-m
It was an experimental function. And it failed :-P |
minad/consult@d30213aa2093 -> minad/consult@822928a86097 minad/marginalia@dbc37b373e73 -> minad/marginalia@26f2bd9ee7b6 minad/vertico@46e8e0565079 -> minad/vertico@cc5f5421c627 oantolin/embark@2890e535f55b -> oantolin/embark@d88478b45f2d oantolin/orderless@8f64537f556f -> oantolin/orderless@75eeae21971d - Remove everything related to `consult-completing-read-multiple` since the function has been deprecated upstream due to implementation issues Ref: minad/consult#567 Close: doomemacs#6352
The other two I noticed are embark-export where I get an error
and mu4e-view-save-attachments where I don't get an error but I had enjoyed the consult version of CRM. |
The function |
minad/consult@d30213aa2093 -> minad/consult@822928a86097 minad/marginalia@dbc37b373e73 -> minad/marginalia@26f2bd9ee7b6 minad/vertico@46e8e0565079 -> minad/vertico@cc5f5421c627 oantolin/embark@2890e535f55b -> oantolin/embark@d88478b45f2d oantolin/orderless@8f64537f556f -> oantolin/orderless@75eeae21971d - Remove everything related to `consult-completing-read-multiple` since the function has been deprecated upstream due to implementation issues Ref: minad/consult#567 Close: doomemacs#6352
minad/consult@d30213aa2093 -> minad/consult@822928a86097 minad/marginalia@dbc37b373e73 -> minad/marginalia@26f2bd9ee7b6 minad/vertico@46e8e0565079 -> minad/vertico@cc5f5421c627 oantolin/embark@2890e535f55b -> oantolin/embark@d88478b45f2d oantolin/orderless@8f64537f556f -> oantolin/orderless@75eeae21971d - Remove everything related to `consult-completing-read-multiple` since the function has been deprecated upstream due to implementation issues Ref: minad/consult#567 Close: doomemacs#6352
Thank you!
Sent From My Mobile Device
…________________________________
From: Omar Antolín Camarena ***@***.***>
Sent: Thursday, May 12, 2022 4:35:48 PM
To: minad/consult ***@***.***>
Cc: Justin Silverman ***@***.***>; Mention ***@***.***>
Subject: Re: [minad/consult] `consult-completing-read-multiple` does not handle `completion-file-name-table` correctly (Issue #567)
The function embark-consult--crm-selected has already been removed from embark-consult, so after updating you shouldn't get that error anymore, @jsilve24<https://github.com/jsilve24>
—
Reply to this email directly, view it on GitHub<#567 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AADOORQFR4D7XOI73Y74B4DVJVTSJANCNFSM5U6J3J5Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I recently wanted to write a command which included selecting more than one file name. The standard way to do this is
In vanilla emacs (and with other completion enhancements like vertico or icomplete-vertical) this works exactly as expected: completion is done on filenames, and whenever a full file is completed, it can be somehow delimited (e.g. by typing the crm-separator), and then another one can be completed.
With the recommended advice overriding standard crm with consult's enhanced version, the above code stops working. Removing the advice fixes the problem, so I think that
consult-completing-read-multiple
is the problem.I still get a completion prompt with multiple candidates (all the files in the current dir), and can select more than one, but if I type in the name of a directory and press
/
, the list doesn't update to that directory, as it would in other systems.Tried searching for other issues but couldn't find any. I found this though, so this is clearly a use-case which other people need.
The text was updated successfully, but these errors were encountered: