[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, 5 Nov 2019 16:31:14 +0000

[sorry for the duplicate email Dmitry, I forgot to cc emacs-devel]

On Tue, Nov 5, 2019 at 2:57 PM Dmitry Gutov <address@hidden> wrote:
> On 05.11.2019 13:10, João Távora wrote:
> >> We agree, yes. Although I'm more in favor of changing the defaults,
> >
> > So are we all, but that's a non-starter.  I'm sure everyone here thinks
> > "their" settings should be the defaults.
> The implication would be that trying to improve the defaults is useless
> or hopeless. I disagree.

I would rather say that setting a change to Emacs defaults as a bar to
clear is counter-productive.  And frequently demotivational.

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.

> > So what you are proposing with the "do-nothing" approach amounts to a
> > lose-lose.
> Have you read my other idea, then?

Yes.  A new face, I presume.  And a generic attempt to figure a good
place to apply it for every possible style.  The patch is a bit too
large for reviewing right now.

By the way, every other proposal in this thread, is trivial.  Only yours
adds significant new logic.  Not saying that's bad, but it's a drawback
the others don't have.

> > 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...

> But there
> are other techniques, like limiting the number of matches shown at a
> time.

Sure, I was talking about parts of 'flex' itself.  There are of course
improvements outside it (even besides the large enough rocket).  Say,
generators and lazy evaluation in completions could indeed be useful.
But that's a possibly big big change in minibuffer.el and, much worse,
all its users.

> 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.

> > But in matching systems like icomplete-mode
> > it isn't a problem (in terms of responsiveness) because icomplete-mode
> > has a while-no-input trick in it.  Perhaps so should company (presuming
> > that's what you are using).
> I'm trying it out with 'M-x completion-at-point'.

Then the slowness you're experiencing stems from the fact that that is
blocking, eager, interface, i.e. it's not a "kink" in flex.

> >> I disagree that it's a significant problem, though. Enabling 'flex' is
> >> one line. Customizing the face is just another line.
> > Isn't true for custom.el users.  And it just doesn't make sense that to
> > enable "good" flex matching you have to go touch two places.  We're
> > discussing usability, after all.
> 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.

> >> highlighting would be applied to two fairly different things.
> >
> > So is 'shadow' and 'bold' and many more.  It all has to do with how you
> > design the semantics, something that is our prerrogative.
> I wouldn't use 'shadow' or 'bold' for the new face either. Nothing that
> matches completions-common-part of completions-first-difference exactly.
> > The current
> > face semantics were designed for 'prefix', they just don't scale well
> > for other pattern-matching strategies.
> >
> > 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.  

2. If I see that every completion has its second character highlighted,
I know I'm using prefix.

This is discounting the fact that I probably want to know and control
whether I'm using flex or prefix anyway.  Using both is strange.

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.

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.


reply via email to

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