emacs-devel
[Top][All Lists]
Advanced

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

Re: Add user customization fido-completion-styles


From: João Távora
Subject: Re: Add user customization fido-completion-styles
Date: Mon, 01 Jun 2020 00:43:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux)

Andrew Schwartzmeyer <andrew@schwartzmeyer.com> writes:

> Hi,
>
> Users of fido-mode (like me) may want to customize the completion style it 
> uses, so add a variable to allow them to
> do so.
>
> For instance, I really like using the “initials” style so “vlm”
> quickly completes visual-line-mode, and then falling back to
> flex. There are also neat packages like orderless
> (https://github.com/oantolin/orderless) which add a new
> completion-style, which folks may want to plug-in and use. Anyway, it
> seems like it ought to be customizable.

Actually, it is, just not with custom.  These two lines should do the trick:

  (add-hook 'icomplete-minibuffer-setup-hook 'my-flex-styles)
  (defun my-flex-styles () (setq-local completion-styles '(initials flex)))

Or just use a lambda, which is even shorter.  I'd like to avoid a
duplicate version of completion-styles customization vars.  

I am however, receptive to customizing the default styles used in fido
mode.  We could come up with a "smarter" flex that values matches
following "-" a bit more.  Or maybe '(initials flex) is a good fit
already, I'll play around a bit with it.  Or we could even think about
making two styles merge "sooner", since currently we skip to the next
one only once the previous no longer matches anything.  Maybe that could
be changed, i.e. adding the matches of the secondary style once the
first one only has two or three matches.

> P.S. I wish “flex” were a bit faster. On my circa 2012 MacBook, M-x is
> noticeably slow with “flex” for commands.

Yes, flex isn't blazing fast, particularly with short patterns.  The
solution is (likely) to port parts of it in C, which isn't particularly
hard, just a bit tedious.

However, the slowness of flex shouldn't affect the ability to type fast
after M-x, since very new character typed should interrupt the lenghty
calculation.  Let me know if that is somehow not the case with your
completion experience.

> Also, I don’t know what “:version” to put on the defcustom, and the
> docs could be improved a bit.

That would depend on what version you intend the patch to target.  Since
fido-mode is a new thing in Emacs 27.1, it is my understanding (from
earlier feedback of Eli) that we can to push to emacs-27, since we
won't, by definition, introduce regressions.  But I would refrain from
doing so this late in the game, unless we are fixing severe
misbehaviour.

Also, "orderless" looks cool.  Is it faster than flex?

João





reply via email to

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