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: Tassilo Horn
Subject: Re: Add user customization fido-completion-styles
Date: Tue, 02 Jun 2020 18:47:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

João Távora <joaotavora@gmail.com> writes:

> On Tue, Jun 2, 2020 at 4:40 PM Tassilo Horn <tsdh@gnu.org> wrote:
>
>> >   (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 guess fido-mode sets `completion-styles' locally in order to achieve
>> ido-like defaults, right?
>
> Yes, exactly. fido-mode is broadly "choose these nice icomplete-mode
> settings that make it fake ido-mode".
>
>> But as a user with customized `completion-styles' and
>> `completion-category-overrides', I wish there was a simple way to
>> just use them with fido, too.
>
> You can try icomplete-mode directly if you don't like fido-mode's.
> fido-mode is a small customization layer on top of it that makes some
> choices for you.

Yes, I know.  And except for the change in completion-styles, I like it.
Not so much for plain icomplete-mode where the fido keybindings are
missing.

>> Especially, I can't see how I could figure out the right category
>> override.  Is the completion metadata accessible in
>> icomplete-minibuffer-setup-hook?
>
> I don't know what you mean.  Exactly what are you trying do to?
> Anyway, I'm reasonably confident you can set
> completion-category-overrides there.

If I understand the docs correctly, `completion-category-overrides'
override the normal `completion-styles' on a category basis.  I have
these customizations:

--8<---------------cut here---------------start------------->8---
(setq completion-styles '(basic partial-completion substring flex)
      completion-category-overrides
      '((ecomplete
         (styles basic partial-completion substring))
        (buffer
         (styles basic partial-completion substring))
        (unicode-name
         (styles basic partial-completion flex))
        (info-menu
         (styles basic partial-completion flex))
        (project-file
         (styles basic partial-completion substring initials))
        (file
         (styles basic partial-completion substring initials))
        ;; TODO: There's actually no command category (yet).
        (command (styles basic partial-completion substring initials))))
--8<---------------cut here---------------end--------------->8---

So when completing buffers, completion-styles will be

  (basic partial-completion substring)

whereas when completing files it'll be

  (basic partial-completion substring initials)

and when not completing something in the overrides, it'll go with the
normal customized completion-styles of

  (basic partial-completion substring flex).

I don't know when this happens, but it might be that it is before
`icomplete-minibuffer-setup-hook' is called and then setting
`completion-category-overrides' wouldn't have an effect.  I'll test...

Thanks,
Tassilo



reply via email to

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