all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Daniel Mendler <mail@daniel-mendler.de>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	Juri Linkov <juri@linkov.net>
Cc: emacs-devel@gnu.org
Subject: Re: Simplification of `affixation-function`
Date: Mon, 26 Apr 2021 01:31:53 +0300	[thread overview]
Message-ID: <50cfaa6f-67c0-117f-41b5-10fefabee0d2@yandex.ru> (raw)
In-Reply-To: <1e9bb418-9f1a-68ee-14de-e68f30f88b0a@daniel-mendler.de>

On 25.04.2021 21:08, Daniel Mendler wrote:
> On 4/25/21 7:58 PM, Dmitry Gutov wrote:
>> I guess my problem with it is, with the apparent end goal of 
>> flexibility, it ends up targeting only the default completion UI, and 
>> the more an alternative UI is different from it, the worse the result 
>> can look.
>>
>> And without semantic information, it fails to take advantage of the 
>> additional features the alternative UIs might provide.
> 
> You are right about that. As things stand now the 
> annotation/affixation-function only work well for the default 
> completions buffer and the vertical completion UIs.

Isn't Company a vertical completion UI?

> The 
> completion-at-point popups are very different from that, so it is only 
> fair if they try to invent their own metadata functions as you are doing 
> in Company with `company-kind` etc.

It's fair that they try to invent new stuff, but it's more economical to 
reuse the stuff when feasible.

> However I am a bit critical with regards to the "semantic information". 
> As far as I understood you use some icon names for that, but this 
> restricts the purpose of the annotations. Maybe it would be sufficient 
> to use a more crude solution, where you only specify that the 
> annotations/affixations must be sufficiently short in order to display 
> well in the popups, without going the full way to the semantic kinds.

There are currently only two places where affixation-function is used in 
the core.

One of them is the aforementioned help--symbol-completion-table.

Regardless of whether there will ever be a completing-read-function 
based on Company (it's not hard to do, actually; mostly the popup 
rendering method is holding it back, but I had it working with 
company-posframe), if help--symbol-completion-table-affixation plugged 
into :company-kind instead, the users could see the icons already 
familiar from completion code, from other backends, they wouldn't need 
to puzzle out what the "u", "a" and "c" characters mean. And other 
completion frameworks can pick up this feature too (maybe even reuse the 
icon mappings, we'll see). The user can also customize the icons' look, 
choose whether they should be SVG, text, icon font characters, or so on.

The other use is in read-char-by-name. And I can admit, seeing the 
characters in the first column is slightly better than following each 
completion. Not by much, they still work well enough as annotations, but 
seeing them in the first column is a bit tidier.

What would I do? First of all, keep them in annotations, because just 
one slightly better-looking use case does not justify the added 
complexity. If someone really wanted to improve positioning of 
annotations for that completion table, there are other options:

- Add a custom var that aligns all annotations to the right, then 
they'll also be in one column. Company has such an option already.

- Create a var specific for the default UI that would move the 
annotations to the left of the completions. read-char-by-name could bind 
it to t before calling completing-read. Then the *Completions* rendering 
code would do whatever is necessary to render it correctly at the 
requested side.

But since mule--ucs-names-affixation, aside from information, also 
contains presentation (spacing and alignment chars), it would be 
infeasible for a completion function that doesn't want extra stuff on 
the left to render its result on the right.

You can also note that the third (suffix) element is always an empty 
string in both of these use cases. So affixation-function was really 
added to be able to add a prefix.



  reply	other threads:[~2021-04-25 22:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-24 17:35 Simplification of `affixation-function` Daniel Mendler
2021-04-24 20:22 ` Juri Linkov
2021-04-24 21:17   ` Daniel Mendler
2021-04-24 21:41     ` Juri Linkov
2021-04-24 22:01       ` Daniel Mendler
2021-04-24 22:34   ` Stefan Monnier
2021-04-24 22:48     ` Dmitry Gutov
2021-04-24 22:56       ` Daniel Mendler
2021-04-25 17:58         ` Dmitry Gutov
2021-04-25 18:08           ` Daniel Mendler
2021-04-25 22:31             ` Dmitry Gutov [this message]
2021-04-27 16:48               ` Juri Linkov
2021-04-27 17:39                 ` Daniel Mendler
2021-04-27 18:11                   ` Juri Linkov
2021-04-27 18:40                     ` Daniel Mendler
2021-04-28  0:20                 ` Dmitry Gutov
2021-04-28 19:59                   ` Juri Linkov
2021-04-29  2:15                     ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50cfaa6f-67c0-117f-41b5-10fefabee0d2@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    --cc=mail@daniel-mendler.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.