-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Ideas regarding categories/annotations #41
Comments
Thanks for opening this issue! Category packageHow about the name linneaus? As for what to implement, I think only two of embark's classifiers are relevant (the others are not about minibuffer completion):
We can also make it easy to override the reported category by command. Maybe if the symbol naming the command has a certain property, the package can report the command name as the category. That might be a sensible interface. Annotation packageHow about the name marginalia? I think making it easy in the other package to have a command use its own name as the completion category, means that we can safely assume in this library that an alist of I'd put here all the |
Haha :) I thought about more descriptive names since they provide kind of a base functionality, therefore my more mundane boring names. Marginalia is very nice, we can directly use an old book as logo. Linneaus also makes sense I guess, but is not as literate. Feel free btw to edit the original issue, just adding bullet points? Maybe that is easier for the discussion here. EDIT: But it is also easier to lose some context... Category package
I stole this idea from you in consult and added consult-annotate-symbol which is very much like your function. However after that I added the consult-annotate-variable which also shows the value. The problem here is that the symbols don't distinguish the namespace and sometimes we want the variable sometimes we want the function. At this point the classifier somehow breaks down? Always use the function and for the commands which prefer the variable use the command-based classifier. I think we also need the command category. Which detects if a symbol is a command and does not return symbol in that case but command in order to show keybindings.
Agree
Ok. So I guess we allow using the command to specify an arbitrary category. It can either be command-category-name or some generic category like The question is what to do about the more complicated classifiers you have in embark? Somehow register them with linneaus additional to the basic linneaus symbol/package/command classifiers? But keep them in Embark? This makes sense if not generally useful! Annotation package:
This is a good idea, I also thought about that, maybe with a prefix/namespace "command-category-..." or something shorter? We could also namespace our categories under "linneaus-..." but then we introduce an implicit dependency. Therefore I would prefer a neutral namespace. |
@oantolin One other thing I wonder about - do we really need two packages here? My original assumption was that more of the Embark classifiers are general purpose, if only symbol, package and command-based classifiers are relevant for annotations it might be sufficient to just create a single marginalia package which contains all of what we discussed here. Since you will also require both packages for embark, that would also work for you and we can start a bit simpler without having to think too much what to put where. Independent of what comes out here, I considered factoring out the consult-annotate-mode from the consult package. |
I proposed a single package on reddit, "(And these two libraries are probably closely related enough that they could actually be a single package.)". After that you started this issue and started talking about two packages, so I thought you were saying no to my proposal. But if you're on board now, I really think a single package for both classification and annotations makes sense. Lets call it As for what to call the one-off category corresponding to single command, I was thinking no prefix at all, just the symbol naming the command. I doubt that would clash with any of the "real" categories.
It's not that the other Embark classifiers aren't general purpose, it's that they aren't for minibuffer completion. As I explained on reddit, there are other contexts in which Embark provides actions besides minibuffer completion, and the classifiers are for those. I would want to put into this new package we are discussing all of the minibuffer completion categories and all the annotation functions we need. Ideally after this package is ready:
|
Just some user feedback here: |
I agree with both you @protesilaos and @oantolin! Only the category prefix - there I am a bit worried and would prefer to be on the safer side (maybe also a marginalia- prefix for our categories). Another possibility I thought about: Can we add metadata fields? Because then we use the category |
@oantolin I started a first prototype here by simple extracting the code from consult (more or less verbatim) - https://github.com/minad/marginalia. I invited you there, added you as author/maintainer, but please let me know if you want to do things in another way. I am fine if the repository is managed under your account instead and I am fine if anything is changed, so please let me know if you rather would like to do things differently. But I had to play around with this a bit :) I implemented annotations based on categories but didn't add more classifiers yet from embark (only doing the command-name based thing right now). For me the approach works nicely. The code using categories is better than the consult-annotate-version and there is no degradation at all in comparison to how consult-annotate-mode works - only downside as of now is that there is still some selectrum specific code, but @clemera seems to be sorting this out right now by improving selectrum. Then this can probably go away. @protesilaos Sorry for messing again with the faces! If marginalia works out we have to revise the consult faces in modus again. |
No worries! I am prepared to review existing faces or add new ones. I am tracking the development process and will receive all the updates, but do not hesitate to ping/contact me in case you want to bring something to my attention. |
@protesilaos Thank you, that's good to hear! |
Thanks @minad for starting the marginalia repo! I'll go take a look. I should warn you that I'm pretty busy these days, and don't actually have much time for working on Emacs packages that much, so I might be slow to respond at times. |
There are a few things I observed and which must be done before this can replace what you have in Embark:
Maybe there are more things - but I have by no means a detailed picture of your embark codebase in mind. So there are probably things I missed and things you would do differently. I used the consult-annotate-mode as a starting point due to familiarity with it, since I just wrote it days ago. So if you have time to look at things, I guess these are the interesting points. |
Embark has a few more annotations I'll add:
|
|
The new variable marginalia-classifiers will contain functions that are run one after another to attempt to determine the category metadatum. The existing logic for determining the category has been moved into marginalia-classify-by-command-name.
I guess this can be closed, I moved the remaining points to the marginalia issue tracker. |
@oantolin based on our discussion at https://www.reddit.com/r/emacs/comments/k3c0u7/consult_counselswiper_alternative_for/gef1jxo?utm_source=share&utm_medium=web2x&context=3
So far this looks to me as if we can create two relatively simply and fully independent packages. Maybe this does not work out but it seems to be worth a try.
Category package (Linneaus)
The purpose of this package is to add (or refine?) the category completion metadata of commands which don't provide a category. There are various ad-hoc possibilities to infer the category information as has been done in the Embark classifier system.
Open question:How fine grained are the categories? (sufficiently, if not make our own according to Omar)Open question:Can we define arbitrary categories if there is such a need? (yes, according to Omar)Annotation package (Marginalia)
The purpose of this package is to add or refine annotations of completion metadata. Ideally the annotation functions should only rely on category information, keeping everything simple this way.
The text was updated successfully, but these errors were encountered: