-
Notifications
You must be signed in to change notification settings - Fork 33
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
Apply a "transformation" to all completing-read functions that use file candidates #181
Comments
Indeed. I think it would be nice if there were a safe, standard way to make changes like this. |
I was playing around with this method and one problem with it is that it is very slow because the formatting (adding the icons in this case) is done before filtering. Which means that all candidates are formatted even when only a handful are shown (due to search or space constraints). It would be more helpful to apply the transformation after the filtering/truncation of the list but before displaying the candidates. I hope that you would consider adding this functionality. EDIT: Additionally, the |
Great ideas, I was thinking I felt some lag, but have mostly been using it with the recent files which I have limited to 200 candidates, so quite speedy non-the-less. But I do agree it makes more sense if possible if it only applies to the shown candidates (for performance). Regarding your edit, for me even the |
@terlar perhaps your computer is faster than mine since I also limit the recent files to 200, but the lag is definitely noticeable. Regarding the highlighting, it's my mistake. I change the code to use the |
Did you try without the
It actually seems like recentf might have them properly formatted already so maybe it is not even needed? |
EDIT: Turns out my own code was the bottleneck and once I fixed it things became much faster (except for the initial formatting which does take around half a second, but that's manageable). |
There is now the marginalia (ping @minad) package which allows you to add annotations based on metadata. To add support for file icons we (and marginalia?) need to add support for the upcoming |
The point of the affixation function is to have prefix and suffix annotations? I wonder why you say they are more efficient, only because the annotations are applied in batch? But hopefully it will still be lazy? There is alread minad/marginalia#9. As soon as affixation functions become available, we will support them. |
I mentioned that because when I skim read the rest of this discussion there was mentioned that adding icons can be slow. As we only apply annotations on display now this problem should go away. The downside is that it has to be redone on every display but I hope it's not that slow that this would introduce problems.
Do you mean when Emacs 28 comes out or when we add support here? Should be easy to add, I will have a look. |
Well, icomplete will start to support it in 28. But if selectrum supports it earlier, I am happy to add support to marginalia before 28 is released. |
As described with marginalia you can now define annotations for all file completions. Support for affixation function was also recently added to Selectrum so as soon marginalia supports them, file icons should also be possible. Can this be closed? |
Sounds good, I haven’t checked out affixiation or marginalia yet. But sounds like it will do the trick, thank you! |
Affixation function support is not added to marginalia yet but @minad is planning to do so at some point. |
I was just trying to see if I could get all-the-icons integration with selectrum and it seems to go well.
I defined the following function:
Then it can be used with a map-car on the file-lists. But I wonder how do I integrate it with all the different functions?
For my own custom functions it is fine:
But if I want to integrate it with
find-file
, find-file-rg and all the other fancy functions that exist that list files. What is the best way?The text was updated successfully, but these errors were encountered: