[Top][All Lists]

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

Re: BIKESHED: completion faces

From: João Távora
Subject: Re: BIKESHED: completion faces
Date: Tue, 05 Nov 2019 23:11:16 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Dmitry Gutov <address@hidden> writes:
> On 05.11.2019 18:31, João Távora wrote:
>> I would rather say that setting a change to Emacs defaults as a bar to
>> clear is counter-productive.  And frequently demotivational.
> Emacs has a problem of trying to accommodate too many workflows in the
> same UI. The result sometimes turns out to not be optimal for any of 
> them. I'm trying to avoid this problem here.
>> Best solutions arise when we can understand exactly what it is that
>> people like about current defaults, and can accomodate that specific
>> preference in a new system, so that they barely notice it.
> That sounds like a change in defaults, though.

Yes, but much more controlled.  This particular change in defaults so is
done so that the explanatory part that people (presumably) like about
the current 'basic' match highlighting is still preserved.

> Your proposal would add a different styling for different completion
> styles. That would require some code as well, likely a similar amount.

No, we are not talking about the same thing.  In my latest proposal, two
faces are renamed, obsolete alias are created, and
completion-pcm--hilit-commonality is trivially changed to use
'completions-emphasis' instead of 'completions-common'.

>>  > > The former part can be improved in flex, the latter can't: it's
>>  > > intrinsic to the technique.
>>  > All can be improved, just with varying degrees of difficulty.
>> Sure, a pig and a large enough rocket...
> Is that because the current completion system is not optimal for flex?

No, no. I just lightheartedly commented that in response to your "all
can be improved".  Like "all animals can fly, even pigs, provided you
attach a large enough rocket".

> algorithm itself, but any subsequent bottlenecks would not be triggered.
> This approach really relies on good and fast scoring, though.

If we're going to do extensive changes in the name of performance, isn't
it better to use Daniel's generator.el library?  It sounds like just the

>>  > One just has to make sure not to cache the result improperly.
>> Cache invalidation, one of the "hard" problems in computing.  Buying
>> trouble, I say.
> Let us not forget that we're competing with other editors who
> routinely show off flex matching and somehow deal with accompanying
> performance problems.

Possibly/probably by using delayed evaluation techniques.

>>  > As you can imagine, IMHO this part "making sense" is less important than
>>  > the consistency in highlighting.
>> It's only "inconsistent" if you you refuse to accept that concepts
>> such
>> as "relevance" or "emphasis" are more important the specifics of the
>> matching technique implemented.
> I'm more interested in highlighting being consistent and relevant to
> whatever the next action the user should perform.

And that's cool, I maintain that this isn't broken at all by my
proposal.  Can you explain how it would be?

>>  > > What I'm proposing is no different from say, mode-line-emphasis, which
>>  > > lisp/man.el and lisp/vc/vc-dispatcher.el use in "two wildly different
>>  > > things".
>>  > Here's an example. When the input is one char, how will you figure out
>>  > what the highlighting in the *Completions* buffer means?
>> OK, let's take that example.  It depends on whether I'm using a
>> "prefix"
>> or "flex" style.  But even if I'm using them both together, or I'm such
>> a doofus that I don't remember anymore:
>> 1. If I see that "one char" being matched in the middle of a lot of
>> completions, I know what it means: I'm using 'flex' and/or 'substring'
>> and that is the character that's matched.
> That implies an extra thinking step. Whatever synapses take part it
> that, my brain could've used for something else.
>> 2. If I see that every completion has its second character highlighted,
>> I know I'm using prefix.
> _Probably_, but you won't know for sure until you also read those
> characters. There could be just 2-3 completions anyway, so you
> wouldn't get the picture at a glance.

I don't aggree with your quantification of useful/wasful sinapses,
obviously.  And it seems we are confusing two things here (and I may be
at fault, too).  One thing is "discovering what style Emacs is using"
the other thing is "why is this particular style showing me this visual
feedback".  The first can be solved by other means (by hinting to
temporarily in the mode-line for example).

>> This is discounting the fact that I probably want to know and control
>> whether I'm using flex or prefix anyway.
> But you probably won't. Or other users won't. That's the idea behind
> completion-styles anyway. If you are the "controlling" type anyway,
> you would probably customize faces anyway.

No.  I think it's unreasonable to ask that.

> And here's also the argument for waiting until the default changes:
> because if the new default is (setq completion-styles '(flex)), then
> the dilemma we have before us now is easily dismissed.

We agree, totally, but that's not going to happen anytime soon.  So we
should make sure that whoever does that 'setq' or customizes that
variable doesn't get a strange "alien" experience.

>> It's also discounting the fact that in 2. prefix completion should, IMO,
>> use my proposed "emphasis" face to highlight the first -- not the second
>> -- character. I've argued before that no loss of explanatory power would
>> materialize from this.
> No loss of explanatory power indeed. The only argument we've made is
> that it'll probably be annoying.

Why annoying?

>> Finally it also dicounts the fact that yours is an extremely contorted
>> example.  I almost never want completions for stuff that contains or
>> starts with a specific single character.  Flex/substring becomes really
>> useful when you type 2-4 characters, and you are made visually aware of
>> the subsequence they matched within the candidate.
> But okay, should those really be emphasized more than "first
> difference"? The latter tells the user what they might want to type 
> next. The former is mostly useful to see "why am I getting these
> completions at all" or they're bored and want to study the completion 
> logic or something. In other words, less frequent situations than
> simply typing code.

Every 'grep' search also brings that visual explanation of the matches.
So does every search engine I've tried.  Why shouldn't 'flex' or 'p-c-m'
or 'string'?  We've seen how all other editors, except Vim (apparently),
highlight them by default.


reply via email to

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