all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* cus-test fails from completion-category-overrides eglot adds
@ 2022-10-25 19:47 Mattias Engdegård
  2022-10-25 21:19 ` João Távora
  0 siblings, 1 reply; 12+ messages in thread
From: Mattias Engdegård @ 2022-10-25 19:47 UTC (permalink / raw)
  To: emacs-devel; +Cc: João Távora

The test-custom-opts test currently fails because eglot adds elements to `completion-category-overrides` that doesn't match its declared type.

While eglot also adds to `completion-styles-alist`, from which the type of `completion-category-overrides` is derived, this happens too late; the defcustom type is already set.

Most likely that type needs to be made dynamic (late-bound) in some way. A validation function would be one way, but it doesn't help with interactive customisation, does it? (I'm no defcustom expert and it shows.)




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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-25 19:47 Mattias Engdegård
@ 2022-10-25 21:19 ` João Távora
  2022-10-25 22:48   ` Stefan Monnier
                     ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: João Távora @ 2022-10-25 21:19 UTC (permalink / raw)
  To: Mattias Engdegård, Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]

On Tue, Oct 25, 2022 at 8:47 PM Mattias Engdegård <
mattias.engdegard@gmail.com> wrote:
>
> The test-custom-opts test currently fails because eglot adds elements to
`completion-category-overrides` that doesn't match its declared type.

Is this test in the normal test suite executed by `make check`?  I ran that
after
the merge and the only failure I got was the usual tramp-something that I
ignore.

> While eglot also adds to `completion-styles-alist`, from which the type
of `completion-category-overrides` is derived, this happens too late; the
defcustom type is already set.

I think Stefan in the expert in this area.  Eglot contains a bit of code
authored by
him that enables the "backend" completion style, a kind of
"all-styles-controlled-elsewhere" style (needs a better name btw, imo).

That code isn't Eglot-specific at all and should be moved to some other
library that Eglot can depend on.

Anyway, it seems the problem is the activation of said style in a
custom-coherent way.  This is not always easy or possible, but it might
be here.  I seem to recall having tried doing the setting in
eglot--managed-mode (where most other settings by Eglot happen)
and coming to the conclusion that it didn't work.

But if it's just a type declaration thing, shouldn't the type declaration
be broadened (presuming Eglot isn't adding some nonsense to the var?)

João

[-- Attachment #2: Type: text/html, Size: 1792 bytes --]

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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-25 21:19 ` João Távora
@ 2022-10-25 22:48   ` Stefan Monnier
  2022-10-26  6:22   ` Stefan Kangas
  2022-10-26  7:44   ` Michael Albinus
  2 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2022-10-25 22:48 UTC (permalink / raw)
  To: João Távora; +Cc: Mattias Engdegård, emacs-devel

> But if it's just a type declaration thing, shouldn't the type declaration
> be broadened (presuming Eglot isn't adding some nonsense to the var?)

Yeah, the problem is in the type.  I don't know of
a convenient/lightweight way to make the type be sufficiently dynamic (it
seems it requires creating a new ad-hoc custom type or something).


        Stefan




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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-25 21:19 ` João Távora
  2022-10-25 22:48   ` Stefan Monnier
@ 2022-10-26  6:22   ` Stefan Kangas
  2022-10-26  9:05     ` Mattias Engdegård
  2022-10-26  7:44   ` Michael Albinus
  2 siblings, 1 reply; 12+ messages in thread
From: Stefan Kangas @ 2022-10-26  6:22 UTC (permalink / raw)
  To: João Távora, Mattias Engdegård, Stefan Monnier; +Cc: emacs-devel

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

> Is this test in the normal test suite executed by `make check`?  I ran
> that after the merge and the only failure I got was the usual
> tramp-something that I ignore.

I think you have to say "make check-expensive".



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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-25 21:19 ` João Távora
  2022-10-25 22:48   ` Stefan Monnier
  2022-10-26  6:22   ` Stefan Kangas
@ 2022-10-26  7:44   ` Michael Albinus
  2022-10-26  9:39     ` João Távora
  2 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2022-10-26  7:44 UTC (permalink / raw)
  To: João Távora; +Cc: Mattias Engdegård, Stefan Monnier, emacs-devel

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

Hi João,

> Is this test in the normal test suite executed by `make check`?  I ran
> that after
> the merge and the only failure I got was the usual tramp-something
> that I ignore.

What is the "usual tramp-something"? in your case?

> João

Best regards, Michael.



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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-26  6:22   ` Stefan Kangas
@ 2022-10-26  9:05     ` Mattias Engdegård
  2022-10-26 11:45       ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Mattias Engdegård @ 2022-10-26  9:05 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: João Távora, Stefan Monnier, emacs-devel

26 okt. 2022 kl. 08.22 skrev Stefan Kangas <stefankangas@gmail.com>:

> I think you have to say "make check-expensive".

The impatient can also run `make -C test test-custom-opts`.

I pushed a simple expedient (e54c395982) – not very elegant but it does the job for now.




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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-26  7:44   ` Michael Albinus
@ 2022-10-26  9:39     ` João Távora
  0 siblings, 0 replies; 12+ messages in thread
From: João Távora @ 2022-10-26  9:39 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Mattias Engdegård, Stefan Monnier, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

On Wed, Oct 26, 2022 at 8:44 AM Michael Albinus <michael.albinus@gmx.de>
wrote:

> João Távora <joaotavora@gmail.com> writes:
>
> Hi João,
>
> > Is this test in the normal test suite executed by `make check`?  I ran
> > that after
> > the merge and the only failure I got was the usual tramp-something
> > that I ignore.
>
> What is the "usual tramp-something"? in your case?
>

Whoops.  My bad.  It's some `esh` thing (eshell?):

 Test esh-var-test/alias/symbol-pair condition:
    (ert-test-failed
     ((should
       (eshell-match-output regexp))
      :form
      (eshell-match-output "Variable `ALIAS' is not settable\n")
      :value nil :explanation
      (mismatched-output
       (command "set ALIAS hello\n")
       (output "Variable ‘ALIAS’ is not settable\n")
       (regexp "Variable `ALIAS' is not settable\n"))))

Fancy quote stuff, apparently. Maybe already fixed, didn't check with the
very latest.

João Távora

[-- Attachment #2: Type: text/html, Size: 1580 bytes --]

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

* Re: cus-test fails from completion-category-overrides eglot adds
@ 2022-10-26 11:35 Mauro Aranda
  2022-10-26 12:18 ` Stefan Monnier
  2022-10-26 12:51 ` Mattias Engdegård
  0 siblings, 2 replies; 12+ messages in thread
From: Mauro Aranda @ 2022-10-26 11:35 UTC (permalink / raw)
  To: Mattias Engdegård
  Cc: Stefan Kangas, João Távora, Stefan Monnier, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

Mattias Engdegård <mattias.engdegard@gmail.com> writes:

 > 26 okt. 2022 kl. 08.22 skrev Stefan Kangas <stefankangas@gmail.com>:
 >
 >> I think you have to say "make check-expensive".
 >
 > The impatient can also run `make -C test test-custom-opts`.
 >
 > I pushed a simple expedient (e54c395982) – not very elegant but it
 > does the job for now.

Hmm, I think that change won't make all the choices available when
executing: M-x customize-option RET completion-category-overrides
Am I right?

If that's so, does the attached patch do what's desired here?


[-- Attachment #2: 0001-Make-completion-category-overrides-choices-dynamic.patch --]
[-- Type: text/x-patch, Size: 1572 bytes --]

From b179ecbb0bc5823077b11c8308ad9293dedc470f Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Wed, 26 Oct 2022 07:29:51 -0300
Subject: [PATCH] Make completion-category-overrides choices dynamic

See https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg01969.html

* lisp/minibuffer.el (completion--update-styles-options): New internal
function.

(completion--styles-type): Use it.
---
 lisp/minibuffer.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a9f72d600d..4898dfdb98 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -972,10 +972,18 @@ completion-styles-alist
 follow the calling convention of `completion-all-completions'),
 and DOC describes the way this style of completion works.")
 
+(defun completion--update-styles-options (widget)
+  "Function to keep updated the options in `completion-category-overrides'."
+  (let ((lst (mapcar (lambda (x)
+                       (list 'const (car x)))
+		     completion-styles-alist)))
+    (widget-put widget :args (mapcar #'widget-convert lst))
+    widget))
+
 (defconst completion--styles-type
   `(repeat :tag "insert a new menu to add more styles"
-           (choice ,@(mapcar (lambda (x) (list 'const (car x)))
-                             completion-styles-alist))))
+           (choice :convert-widget completion--update-styles-options)))
+
 (defconst completion--cycling-threshold-type
   '(choice (const :tag "No cycling" nil)
            (const :tag "Always cycle" t)
-- 
2.34.1


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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-26  9:05     ` Mattias Engdegård
@ 2022-10-26 11:45       ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2022-10-26 11:45 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: Stefan Kangas, João Távora, emacs-devel

>> I think you have to say "make check-expensive".
> The impatient can also run `make -C test test-custom-opts`.

Aka `make test/test-custom-opts'


        Stefan




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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-26 11:35 cus-test fails from completion-category-overrides eglot adds Mauro Aranda
@ 2022-10-26 12:18 ` Stefan Monnier
  2022-10-26 14:35   ` Mauro Aranda
  2022-10-26 12:51 ` Mattias Engdegård
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2022-10-26 12:18 UTC (permalink / raw)
  To: Mauro Aranda
  Cc: Mattias Engdegård, Stefan Kangas, João Távora,
	emacs-devel

Mauro Aranda [2022-10-26 08:35:54] wrote:
>  (defconst completion--styles-type
>    `(repeat :tag "insert a new menu to add more styles"
> -           (choice ,@(mapcar (lambda (x) (list 'const (car x)))
> -                             completion-styles-alist))))
> +           (choice :convert-widget completion--update-styles-options)))

Hmmm... didn't think of using this approach.
LGTM thanks,


        Stefan




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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-26 11:35 cus-test fails from completion-category-overrides eglot adds Mauro Aranda
  2022-10-26 12:18 ` Stefan Monnier
@ 2022-10-26 12:51 ` Mattias Engdegård
  1 sibling, 0 replies; 12+ messages in thread
From: Mattias Engdegård @ 2022-10-26 12:51 UTC (permalink / raw)
  To: Mauro Aranda
  Cc: Stefan Kangas, João Távora, Stefan Monnier, emacs-devel

26 okt. 2022 kl. 13.35 skrev Mauro Aranda <maurooaranda@gmail.com>:

> Hmm, I think that change won't make all the choices available when
> executing: M-x customize-option RET completion-category-overrides
> Am I right?

Quite so! Feel free to improve if you know what you are doing. (I just barely did.)




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

* Re: cus-test fails from completion-category-overrides eglot adds
  2022-10-26 12:18 ` Stefan Monnier
@ 2022-10-26 14:35   ` Mauro Aranda
  0 siblings, 0 replies; 12+ messages in thread
From: Mauro Aranda @ 2022-10-26 14:35 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Mattias Engdegård, Stefan Kangas, João Távora,
	emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

 > Mauro Aranda [2022-10-26 08:35:54] wrote:
 >>  (defconst completion--styles-type
 >>    `(repeat :tag "insert a new menu to add more styles"
 >> -           (choice ,@(mapcar (lambda (x) (list 'const (car x)))
 >> -                             completion-styles-alist))))
 >> +           (choice :convert-widget completion--update-styles-options)))
 >
 > Hmmm... didn't think of using this approach.
 > LGTM thanks,
 >
 >
 >         Stefan

Great, pushed.



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

end of thread, other threads:[~2022-10-26 14:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-26 11:35 cus-test fails from completion-category-overrides eglot adds Mauro Aranda
2022-10-26 12:18 ` Stefan Monnier
2022-10-26 14:35   ` Mauro Aranda
2022-10-26 12:51 ` Mattias Engdegård
  -- strict thread matches above, loose matches on Subject: below --
2022-10-25 19:47 Mattias Engdegård
2022-10-25 21:19 ` João Távora
2022-10-25 22:48   ` Stefan Monnier
2022-10-26  6:22   ` Stefan Kangas
2022-10-26  9:05     ` Mattias Engdegård
2022-10-26 11:45       ` Stefan Monnier
2022-10-26  7:44   ` Michael Albinus
2022-10-26  9:39     ` João Távora

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.