unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
@ 2019-11-07 14:22 João Távora
  2019-11-07 14:45 ` Eli Zaretskii
  2019-11-08 17:14 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: João Távora @ 2019-11-07 14:22 UTC (permalink / raw)
  To: 38101

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
  2019-11-07 14:22 bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults João Távora
@ 2019-11-07 14:45 ` Eli Zaretskii
  2019-11-07 15:09   ` João Távora
  2019-11-08 17:14 ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-11-07 14:45 UTC (permalink / raw)
  To: João Távora; +Cc: 38101

> From: João Távora <joaotavora@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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
  2019-11-07 14:45 ` Eli Zaretskii
@ 2019-11-07 15:09   ` João Távora
  2019-11-07 15:43     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: João Távora @ 2019-11-07 15:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 38101

On Thu, Nov 7, 2019 at 2:46 PM Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
  2019-11-07 15:09   ` João Távora
@ 2019-11-07 15:43     ` Eli Zaretskii
  2019-11-07 16:02       ` João Távora
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-11-07 15:43 UTC (permalink / raw)
  To: João Távora; +Cc: 38101

> From: João Távora <joaotavora@gmail.com>
> Date: Thu, 7 Nov 2019 15:09:04 +0000
> Cc: 38101@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?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
  2019-11-07 15:43     ` Eli Zaretskii
@ 2019-11-07 16:02       ` João Távora
  2019-11-08 14:19         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: João Távora @ 2019-11-07 16:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 38101

Sure thing.

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

João





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
  2019-11-07 16:02       ` João Távora
@ 2019-11-08 14:19         ` Eli Zaretskii
  2019-11-08 15:15           ` João Távora
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-11-08 14:19 UTC (permalink / raw)
  To: João Távora, Stefan Monnier; +Cc: 38101

> From: João Távora <joaotavora@gmail.com>
> Date: Thu, 7 Nov 2019 16:02:03 +0000
> Cc: 38101@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
  2019-11-08 14:19         ` Eli Zaretskii
@ 2019-11-08 15:15           ` João Távora
  2019-11-08 15:35             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: João Távora @ 2019-11-08 15:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 38101, Stefan Monnier

On Fri, Nov 8, 2019 at 2:20 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: João Távora <joaotavora@gmail.com>
> > Date: Thu, 7 Nov 2019 16:02:03 +0000
> > Cc: 38101@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
  2019-11-08 15:15           ` João Távora
@ 2019-11-08 15:35             ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2019-11-08 15:35 UTC (permalink / raw)
  To: João Távora; +Cc: 38101, monnier

> From: João Távora <joaotavora@gmail.com>
> Date: Fri, 8 Nov 2019 15:15:35 +0000
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 38101@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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults
  2019-11-07 14:22 bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults João Távora
  2019-11-07 14:45 ` Eli Zaretskii
@ 2019-11-08 17:14 ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2019-11-08 17:14 UTC (permalink / raw)
  To: João Távora; +Cc: 38101

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






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-11-08 17:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 14:22 bug#38101: User's customization to completion-styles requires tweak to completion-category-defaults João Távora
2019-11-07 14:45 ` Eli Zaretskii
2019-11-07 15:09   ` João Távora
2019-11-07 15:43     ` Eli Zaretskii
2019-11-07 16:02       ` João Távora
2019-11-08 14:19         ` Eli Zaretskii
2019-11-08 15:15           ` João Távora
2019-11-08 15:35             ` Eli Zaretskii
2019-11-08 17:14 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).