Skip to content
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

use affixation function? #9

Closed
minad opened this issue Dec 6, 2020 · 11 comments
Closed

use affixation function? #9

minad opened this issue Dec 6, 2020 · 11 comments

Comments

@minad
Copy link
Owner

minad commented Dec 6, 2020

Just to keep this in mind for the future. Moved here from minad/consult#5

@minad
Copy link
Owner Author

minad commented Dec 13, 2020

We should support this as soon as Emacs 28 is released or earlier if Selectrum implements it earlier.

@oantolin
Copy link
Collaborator

I'm using two Emacsen, both are binaries of Emacs 28 prereleases: on Linux, I use the debian repository http://emacs.ganneff.de/; and on Windows I am using binaries from the emax64 project. Neither of the two seems to have affixation functions yet.

@minad
Copy link
Owner Author

minad commented Dec 13, 2020

Maybe it is not in master yet. Will it will ever be? See the discussion in https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00613.html. We could still chime into the discussion on emacs-devel if we have something to say. I have not followed upstream development, I do not know what is going on or planned.

@minad
Copy link
Owner Author

minad commented Dec 13, 2020

@minad
Copy link
Owner Author

minad commented Dec 13, 2020

If we implement support for this at some point we should probably implement everything in the form of affixation functions, since it is potentially more efficient and if those are not yet supported, provide fallback annotation functions which call the affixation function.

We could also do it the other way round if we do not care about the (minor) efficiency gains. Would probably be simpler since we don't have to do the loop all the time. And since we always annotate only 10 functions at once it is not that bad I guess. Only embark-occur will then be more costly, I suppose?

@minad
Copy link
Owner Author

minad commented Dec 13, 2020

The question is then how we would translate prefixes, maybe show them directly after the candidate if only annotation functions are supported. Or simply do not show them at all. I think prefixes are not super useful after having worked a while on marginalia. Only very small annotations could go in front, icons etc. Or the modifier/symbol-class in marginalia-annotate-variable/marginalia-annotate-symbol.

@oantolin
Copy link
Collaborator

@oantolin But here it seems to be in master

Yes, I know it is. I'm just saying that probably only people who compile from source have it already. I'm using to regularly updated sources for binaries and they don't affixations yet.

If we implement support for this at some point we should probably implement everything in the form of affixation functions

You mean in addition to the annotations, right? You still want to support Emacs <28 for a while, I would assume.

@minad
Copy link
Owner Author

minad commented Dec 13, 2020

Yes, I know it is. I'm just saying that probably only people who compile from source have it already. I'm using to regularly updated sources for binaries and they don't affixations yet.

Right now it does not make sense to implement it. But as soon as some Emacs 28 versions with it become more widely available we can do it. Or when selectrum adds support for example. But I am not sure if selectrum can add support if the underlying emacs does not yet.

You mean in addition to the annotations, right? You still want to support Emacs <28 for a while, I would assume.

Yes, as I described above I would just support one form of annotations in marginalia and then depending on what is available translate to affixation or annotation functions.

@oantolin
Copy link
Collaborator

Yes, as I described above I would just support one form of annotations in marginalia and then depending on what is available translate to affixation or annotation functions.

Sorry, I think I read too fast and missed that. I agree with defining affixations first and then annotations in terms of them. As for Embark Occur, I'd switch it over to affixations too.

@minad
Copy link
Owner Author

minad commented Dec 14, 2020

@oantolin Selectrum already added affixation-function support. It didn't take long thanks to @clemera 😀 See radian-software/selectrum#271

I will prepare a prototype.

@minad
Copy link
Owner Author

minad commented Dec 19, 2020

I implemented preliminary support, see ef4fabf. In case we want to add prefixes or optimize this, we should express everything in terms of affixations instead. But for now this is good enough and ensures that our marginalia annotations take precedence over the Emacs 28 or selectrum affixations.

For "keyhole" completion-systems like icomplete and selectrum the optimization would not play a role, but it could play a role for live-occur of Embark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants