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

Emojies other than unicode ones are not displayed with "emojify-completing-read" #339

Closed
jumper047 opened this issue Mar 9, 2023 · 5 comments

Comments

@jumper047
Copy link

jumper047 commented Mar 9, 2023

Result of the 'emojify-completing-read' execution with ivy-mode enabled:
image

with vertico-mode enabled:
image

unicode emojies, though, displayed correctly with vertico:
image

@jumper047
Copy link
Author

Also formatting in ivy seems more accurate (at least for my taste), but this is minor issue

@minad
Copy link
Owner

minad commented Mar 9, 2023

This should be fixed in emojify. I am not sure how emojify works, but it seems rather complex. It probably uses some trick to substitute the github emoji strings. Note that In Emacs 29 you can use emoji-search instead, which also displays correctly.

@minad minad closed this as completed Mar 9, 2023
@jumper047
Copy link
Author

Found relevant issue in emojify repo - iqbalansari/emacs-emojify#107

@jumper047
Copy link
Author

Interesting - seem like in case of custom emojies emojify displays them as propertized strings with images. emojify-completing-read function adds emojify-mode activation to the minibuffer-setup-hook here - https://github.com/iqbalansari/emacs-emojify/blob/1b726412f19896abf5e4857d4c32220e33400b55/emojify.el#L1849
As far as I can understand, vertico buffer should be affected too, but for some reason it doesn't. For now I ended up with that workaround:

(cl-defmethod vertico--format-candidate :around
  (cand prefix suffix index start)
  (setq cand (emojify-string cand))
  (cl-call-next-method cand prefix suffix index start))

I don't like it because it affects all functions, and, in theory, it can have some performance impact.

@minad
Copy link
Owner

minad commented Mar 9, 2023

I don't like it because it affects all functions, and, in theory, it can have some performance impact.

Overriding vertico--format-candidate is the correct approach. See https://github.com/minad/vertico/wiki#candidate-display-transformations-custom-candidate-highlighting if you want to do it properly and apply the transformation only to certain completion candidate types. In theory, there won't be a negative performance impact since vertico--format-candidate is only called for visible candidates and there aren't many.

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