[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BIKESHED: completion faces

From: Dmitry Gutov
Subject: Re: BIKESHED: completion faces
Date: Sun, 3 Nov 2019 23:53:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 30.10.2019 3:49, Stefan Monnier wrote:

It has an explanatory value which makes the completion-style more
understandable (e.g. I'm pretty sure there are still users who don't
know about the `partial-completion` style that's enabled by default:
they just occasionally see completion lists which they don't understand
and shrug it off).

And just use it, probably. Even if they don't exactly see what matches what.

But no, I don't know how important it is (I do find it useful when
implementing/debugging the code to make sure it worked right ;-)

Indeed, but that's covered by your ability to customize the face anyway.

This said, it seems that highlighting the common part is the "standard"
behavior is all other completion systems whereas highlighting the "first
difference" seems to be specific to Emacs.

Probably, but "all other completion systems" use a popup, which is a significantly different UI. They usually have some different background for that rectangle, and a different foreground as well. So there's some pre-existing theming/styling work there.

Further, none of the other systems AFAIK use a fallback list of completion styles. So normally the matching is fuzzy to begin with, and in that case, highlighting the matches is moderately useful.

They won't see a situation with a long list of simple prefix matches where the first column is highlighted uniformly.

For this reason, it is common in other completion systems to
highlight the "common" part somehow (e.g. underline, bold, ...).
Personally, I'm not a big fan of underline, italic and even bold (unless
it's used sparingly, like it is now). With that said...

FWIW, I'm no big fan of underline (maybe it's the LaTeX influence speaking).
But I found it tolerable for first-difference after trying it out.

I'm more against using bold for the common part. Underline is less aggravating.

It's a bit more subtle than that (and the "first-difference" name is
a misnomer, due to history): when I revamped the default completion
system for Emacs-24, adding partial-completion (as well as `basic` which
is a bit more sophisticated than just "prefix completion", in reality),
I had to decide what to do with "first-difference" since it doesn't have
as clear a meaning as for the plain old prefix completion.  So the way
I adapted it to the new reality is that "first difference" now really
means "first char after point".  If you do

     M-x dovi C-b C-b ?

you'll see that `completions-first-difference` is applied to the "c"
of the "doc-view..." commands because that's the first character after
the position in the candidate that corresponds to the position of
point in the pattern.

I'm having trouble reproducing this. Should I be using icomplete-mode? Anyway, it bold-s the whole current selected completion.

And if I type "(dovi" in an Elisp buffer, C-M-i moves point to after the common part.

So I get what you're hinting at, in theory, but these cases should indeed be rare. And there might be other things we could do about them.

   2- depending on the completion style, there might be further
      character that still keep the desired completion while
      eliminating more of the others.
      For example let's say you want to run
      `doc-view-fit-height-to-window`; after you do `M-x doc-view- ?`
      you'll see that the `f` is highlighted as first-difference
      but if hit `f` you still have 5 remaining choices, whereas if you
      hit `h` your choice is the only remaining one.

This one in interesting. Some pre-computation could give a better hint in this regard, but it could be disorienting as well, if one is used for first-difference to be the char after point.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]