GNU bug report logs - #38101
User's customization to completion-styles requires tweak to completion-category-defaults

Previous Next

Package: emacs;

Reported by: João Távora <joaotavora <at> gmail.com>

Date: Thu, 7 Nov 2019 14:23:01 UTC

Severity: normal

Merged with 22324

Found in version 25.0.50

Fixed in version 29.1

To reply to this bug, email your comments to 38101 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Thu, 07 Nov 2019 14:23:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to João Távora <joaotavora <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 07 Nov 2019 14:23:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: User's customization to completion-styles requires tweak to
 completion-category-defaults
Date: Thu, 7 Nov 2019 14:22:29 +0000
> >     (setq completion-styles '(flex))
> >     (setq completion-category-defaults nil )
>
> Ha, I was just thinking about that: could you open a bug report about
> the need for tweaking completion-category-defaults?
> Note: the above `setq` isn't enough because packages can (and do) add
> themselves to completion-category-defaults later on.
>
>         Stefan

Hi maintainers,

As you can read in the above conversation, completion-category-defaults
needs to be tweaked to "unshadow" the user's customization to
completion-styles.

This is a bug report to track any possible improvements that can be done
in this regard.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Thu, 07 Nov 2019 14:47:01 GMT) Full text and rfc822 format available.

Message #8 received at 38101 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 38101 <at> debbugs.gnu.org
Subject: Re: bug#38101: User's customization to completion-styles requires
 tweak to completion-category-defaults
Date: Thu, 07 Nov 2019 16:45:48 +0200
> From: João Távora <joaotavora <at> gmail.com>
> Date: Thu, 7 Nov 2019 14:22:29 +0000
> 
> > >     (setq completion-styles '(flex))
> > >     (setq completion-category-defaults nil )
> >
> > Ha, I was just thinking about that: could you open a bug report about
> > the need for tweaking completion-category-defaults?
> > Note: the above `setq` isn't enough because packages can (and do) add
> > themselves to completion-category-defaults later on.
> >
> >         Stefan
> 
> Hi maintainers,
> 
> As you can read in the above conversation, completion-category-defaults
> needs to be tweaked to "unshadow" the user's customization to
> completion-styles.

Please help me to find this conversation by giving some URL or Subject
and Date.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Thu, 07 Nov 2019 15:10:02 GMT) Full text and rfc822 format available.

Message #11 received at 38101 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 38101 <at> debbugs.gnu.org
Subject: Re: bug#38101: User's customization to completion-styles requires
 tweak to completion-category-defaults
Date: Thu, 7 Nov 2019 15:09:04 +0000
On Thu, Nov 7, 2019 at 2:46 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Hi maintainers,
> >
> > As you can read in the above conversation, completion-category-defaults
> > needs to be tweaked to "unshadow" the user's customization to
> > completion-styles.
>
> Please help me to find this conversation by giving some URL or Subject
> and Date.

Sorry Eli, this was sent to me off-list by Stefan.  I just noticed it now.
(Also very sorry Stefan, this was a mistake).

Eli, the conversation you want is in Emacs devel, a reply of mine
to Oscar Fuentes yesterday, with a subject that includes "fido-mode".

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Thu, 07 Nov 2019 15:44:01 GMT) Full text and rfc822 format available.

Message #14 received at 38101 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 38101 <at> debbugs.gnu.org
Subject: Re: bug#38101: User's customization to completion-styles requires
 tweak to completion-category-defaults
Date: Thu, 07 Nov 2019 17:43:13 +0200
> From: João Távora <joaotavora <at> gmail.com>
> Date: Thu, 7 Nov 2019 15:09:04 +0000
> Cc: 38101 <at> debbugs.gnu.org
> 
> > Please help me to find this conversation by giving some URL or Subject
> > and Date.
> 
> Sorry Eli, this was sent to me off-list by Stefan.  I just noticed it now.
> (Also very sorry Stefan, this was a mistake).
> 
> Eli, the conversation you want is in Emacs devel, a reply of mine
> to Oscar Fuentes yesterday, with a subject that includes "fido-mode".

Thanks, but that thread is huge, and you've posted quite a lot there.
Could you perhaps state the URL of that message in the emacs-devel
archives?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Thu, 07 Nov 2019 16:03:02 GMT) Full text and rfc822 format available.

Message #17 received at 38101 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 38101 <at> debbugs.gnu.org
Subject: Re: bug#38101: User's customization to completion-styles requires
 tweak to completion-category-defaults
Date: Thu, 7 Nov 2019 16:02:03 +0000
Sure thing.

https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00227.html

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Fri, 08 Nov 2019 14:21:02 GMT) Full text and rfc822 format available.

Message #20 received at 38101 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 38101 <at> debbugs.gnu.org
Subject: Re: bug#38101: User's customization to completion-styles requires
 tweak to completion-category-defaults
Date: Fri, 08 Nov 2019 16:19:50 +0200
> From: João Távora <joaotavora <at> gmail.com>
> Date: Thu, 7 Nov 2019 16:02:03 +0000
> Cc: 38101 <at> debbugs.gnu.org
> 
> Sure thing.
> 
> https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00227.html

Thanks, but I see no references there to completion-category-defaults
or anything along those lines.

Perhaps Stefan or someone else could describe the actual problem in
this bug report?

TIA




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Fri, 08 Nov 2019 15:16:01 GMT) Full text and rfc822 format available.

Message #23 received at 38101 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 38101 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#38101: User's customization to completion-styles requires
 tweak to completion-category-defaults
Date: Fri, 8 Nov 2019 15:15:35 +0000
On Fri, Nov 8, 2019 at 2:20 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > From: João Távora <joaotavora <at> gmail.com>
> > Date: Thu, 7 Nov 2019 16:02:03 +0000
> > Cc: 38101 <at> debbugs.gnu.org
> >
> > Sure thing.
> >
> > https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00227.html
>
> Thanks, but I see no references there to completion-category-defaults
> or anything along those lines.

It's on line 23-24 of the linked email's body.

As I wrote, this is the problem:

JT >  completion-category-defaults
JT > needs to be tweaked to "unshadow" the user's customization to
JT > completion-styles.

This means that if you customize completion-styles, you also need
to tweak completion-category-defaults, because the latter shadows
the former. Stefan thinks this is a bug, and so do I.

Moreover, Stefan has stated that you need to "constantly" tweak
completion-category-defaults because other packages might
add to it.

I haven't analyzed the problem sufficiently to tell you _why_ the
shadowing happens, just that it happens.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Fri, 08 Nov 2019 15:36:01 GMT) Full text and rfc822 format available.

Message #26 received at 38101 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 38101 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#38101: User's customization to completion-styles requires
 tweak to completion-category-defaults
Date: Fri, 08 Nov 2019 17:35:15 +0200
> From: João Távora <joaotavora <at> gmail.com>
> Date: Fri, 8 Nov 2019 15:15:35 +0000
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 38101 <at> debbugs.gnu.org
> 
> JT >  completion-category-defaults
> JT > needs to be tweaked to "unshadow" the user's customization to
> JT > completion-styles.
> 
> This means that if you customize completion-styles, you also need
> to tweak completion-category-defaults, because the latter shadows
> the former. Stefan thinks this is a bug, and so do I.
> 
> Moreover, Stefan has stated that you need to "constantly" tweak
> completion-category-defaults because other packages might
> add to it.
> 
> I haven't analyzed the problem sufficiently to tell you _why_ the
> shadowing happens, just that it happens.

Thanks, this does explain the issue nicely.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38101; Package emacs. (Fri, 08 Nov 2019 17:15:01 GMT) Full text and rfc822 format available.

Message #29 received at 38101 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: João Távora <joaotavora <at> gmail.com>
Cc: 38101 <at> debbugs.gnu.org
Subject: Re: bug#38101: User's customization to completion-styles requires
 tweak to completion-category-defaults
Date: Fri, 08 Nov 2019 12:14:31 -0500
>> >     (setq completion-styles '(flex))
>> >     (setq completion-category-defaults nil)

Right: `completion-category-defaults` lets us specify different default
completion styles for particular cases, but it doesn't clearly says "how
different" and instead just overrides the global setting.

In practice it's been used so far to override the default (mostly)
prefix completion with substring completion, IOW the override is
performed in order to use a "more lax" completion (where "lax" here can
be understood as the size of the set of matching candidates for a given
pattern: `substring` matches more candidates than `basic` so it is "more
lax").

But if the user sets the default completion style to a "very lax" style
such as `flex` then the override doesn't work as intended any more.

It won't completely prevent the use of `flex` luckily:

    (defun completion--styles (metadata)
      (let* ((cat (completion-metadata-get metadata 'category))
             (over (completion--category-override cat 'styles)))
        (if over
            (delete-dups (append (cdr over) (copy-sequence completion-styles)))
           completion-styles)))

So, if the default `completion-styles` is `(flex)` and the
`completion-category-defaults` specifies, say, `(basic substring)`, then
the result is to use `(basic substring flex)` which still includes
`flex` (hence the problem is not too crippling) but `flex` will only be
used when both `basic` and `substring` fail to find any matching
candidates, which is not what was desired.  In this specific case is
`basic` or `substring` find matching candidates those would also have
been returned by `flex` and (presumably) with the best scores, so the
end result (compared to only using `flex`) is mostly that *Completions*
gets truncated.


        Stefan





Forcibly Merged 22324 38101. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 02 Feb 2022 18:32:02 GMT) Full text and rfc822 format available.

Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 03 Mar 2022 21:40:02 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.