-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Introduce embark--minibuffer-point #200
Conversation
(- (point) (minibuffer-prompt-end)) can be negative
I suspect all of the above methods to obtain the metadata are actually wrong. The correct way to obtain the metadata may be this: (completion-metadata (buffer-substring-no-properties (minibuffer-prompt-end)
(max (minibuffer-prompt-end) (point)))
minibuffer-completion-table
minibuffer-completion-predicate) |
Okay, I actually solved this in a simpler way now in Vertico. I simply do not update the UI when the point is outside the legal region, see minad/vertico@b0f5699. (EDIT: But this will then break the vertical movement commands. Maybe keeping the point checks is better after all.) However I think I keep the fix in Marginalia (minad/marginalia@2d19497) for robustness. And in Embark the problem is still there if you move the point to the prompt and run |
People should not be moving the point into the prompt! What's wrong with these people? 😆 I'm not completely convinced this really needs to be fixed, but I agree that the best fix is probably what you did. |
Yes, it is very wrong :-P
But there is a but. If you move the point right after the prompt I still had an issue in Vertico where I got -1, maybe because the sensor mode got triggered to late or because of the overlays. I have no idea. Then I thought it is better to fix this such that it works even for the people who like to move into the prompt :D |
Merged! I was tempted instead to document that calling embark commands from within the minibuffer prompt is undefined behavior, and to add code to embark so that it uninstalls itself if you do that. |
In any case it is good to merge this. Now that I made this |
(- (point) (minibuffer-prompt-end))
can be negativeI had problems with this in Marginalia (minad/marginalia@2d19497) and Vertico (minad/vertico@c72e8de).
Then I have a question about Embark metadata access
Icomplete and Icomplete-vertical uses this:
which is equivalent to
I wonder about
(point) < (minibuffer-prompt-end)
.In Vertico I am now using this, which is probably wrong.
See also oantolin/icomplete-vertical#27, where I have been confused for the first time.