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

Provide an alternative to counsel-unicode #4

Closed
manuel-uberti opened this issue Nov 28, 2020 · 16 comments
Closed

Provide an alternative to counsel-unicode #4

manuel-uberti opened this issue Nov 28, 2020 · 16 comments

Comments

@manuel-uberti
Copy link

Hi,

just an idea maybe worth looking into. Also, there is insert-char-preview that offers a more generic approach than counsel-unicode.

@minad
Copy link
Owner

minad commented Nov 28, 2020

Why is that needed? For me Emacs 27.1 already shows the unicode character and the name if I call insert-char. I have bound insert-char to "C-c u" in my init.el. What else do you have in mind? Do you want to see the hex code etc?

Please note that I have never really used ivy. I've been on ido for years and only recently upgraded to selectrum. Therefore if you want something specific, I appreciate a detailed description!

@manuel-uberti
Copy link
Author

You're absolutely right, sorry.

I was thinking of showing the preview of the unicode charter along with the name. I am on Emacs 28 (commit: a7825c4be06b7c0b544df34555ecf586276245e6) with selectrum and insert-char doesn't show me the unicode character, only the name.

@manuel-uberti
Copy link
Author

This is from emacs -Q with selectrum-mode active:
Screenshot from 2020-11-28 09-28-47

@minad
Copy link
Owner

minad commented Nov 28, 2020

Yes, I am currently trying to find out which part of my elaborate init.el is resposible for the preview 😂

@minad
Copy link
Owner

minad commented Nov 28, 2020

I looked into the code of read-char-by-name and there does not seem to be a setting. There is the annotation-function which does this, if you take a look. For me the preview works if I do emacs -Q on 26 and 27 even only with the standard completion if I press TAB.

Maybe they added an option in Emacs 28 which disables annotations by default?

Edit: Actually it seems that some things have been changed in 28, there is no annotation-function anymore. Now it is called affixation-function. Probably this is more powerful? Please check the Emacs changelog!

https://github.com/emacs-mirror/emacs/blob/a7825c4be06b7c0b544df34555ecf586276245e6/lisp/international/mule-cmds.el#L3141

@manuel-uberti
Copy link
Author

I am looking into it right now, but it seems to add \t for spacing IIUC.

@minad
Copy link
Owner

minad commented Nov 28, 2020

@manuel-uberti It seems the affixations funtion is a VERY recent addition! It supports prefix and suffix! See the commit emacs-mirror/emacs@3b74059!

Also ping @clemera - it seems Emacs 28 will support prefix and suffix via the affixation function! We just discussed this! Maybe selectrum could already start supporting the affixation metadata?

@manuel-uberti
Copy link
Author

Oh, well, I am too much on the bleeding edge I see. :)

@minad
Copy link
Owner

minad commented Nov 28, 2020

Yes, very much too much 😆 But if you are on it and currently not busy studying it would be great if you could help test consult on 28! I don't have 28 yet (still waiting util gccmacs hits master...)

@manuel-uberti
Copy link
Author

Sure thing. Let me install it and give it a spin.

@manuel-uberti
Copy link
Author

A quick run went very well. I tried

  • consult-bookmark
  • consult-line
  • consult-buffer (with the preview disabled, though)

Now, if only consult-unicode was available I'd be set. ;)

@minad
Copy link
Owner

minad commented Nov 28, 2020

Cool, did you try the preview too? This is a more intricate feature. Even if you don't like it could you try it? This would help.
I think the preview for buffers is a nice feature, but one needs to get accustomed to it a bit I feel.

Regarding consult-unicode, I am not sure if we should add it here since the benefit over the standard insert-char seems to be rather marginal (If there is even one with the affixation function...)

@manuel-uberti
Copy link
Author

manuel-uberti commented Nov 28, 2020

Yes, I tried with the preview. It's a bit distracting for me when switching buffers, but it works as expected.

As for consult-unicode: if there is a way to leverage the built-in insert-char with selectrum to get a preview, sure, we don't need the consult version I guess.

@minad
Copy link
Owner

minad commented Nov 28, 2020

Thank you for testing!

As for consult-unicode: if there is a way to leverage the built-in insert-char with selectrum to get a preview, sure, we don't need the consult version I guess.

For me it works with 26 and 27, I guess it should also work with some configuration on 28.

@manuel-uberti
Copy link
Author

I see, then I guess we can close it here, since it does not seem related neither to selectrum nor consult. :)

@minad
Copy link
Owner

minad commented Nov 28, 2020

Yes, I tried with the preview. It's a bit distracting for me when switching buffers, but it works as expected.

@manuel-uberti The preview seems to be particularly useful if one wants to do recursive edits of the preview. But this probably applies more to consult-line, consult-mark and consult-outline. I made sure that editing works and does not move the candidates. So you can jump back and forth between an active search and the buffer.

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