GNU bug report logs -
#72705
31.0.50; eglot--dumb-tryc Filters out too much
Previous Next
Reported by: Dmitry Gutov <dmitry <at> gutov.dev>
Date: Mon, 19 Aug 2024 01:53:02 UTC
Severity: normal
Found in version 31.0.50
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 25/08/2024 12:53, João Távora wrote:
> Dmitry Gutov <dmitry <at> gutov.dev> writes:
>
>> On 23/08/2024 13:23, João Távora wrote:
>>
>> I see what you're saying, but insofar that current completion is
>> mostly working out well, adding the special logic for parens would
>> improve a lot of cases, and keep others the same degree of broken (the
>> email-sending ones, for sure). So it might be worth a try.
>
> No, it's not. It's the kind of complexity Eglot isn't after. It's a
> losing game with the growing number of servers who aren't bound by these
> rules in any way.
>
>> Anyway, stopping any partial completion (at first I didn't understand
>> that you meant a more general notion that the partial-completion
>> c-style) should be similarly easy to what the current patch does. You
>> would just drop the second clause in eglot--dumb-tryc, I think. Or
>> maybe both the first and the second.
>
> If it's easy, then we should definitely do it.
The corresponding change probably looks like this:
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 844fc634be9..fcf4e586ead 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3147,20 +3147,10 @@ eglot--dumb-flex
(defun eglot--dumb-allc (pat table pred _point) (funcall table pat
pred t))
(defun eglot--dumb-tryc (pat table pred point)
- (let ((probe (funcall table pat pred nil)))
- (cond ((eq probe t) t)
- (probe
- (if (and (not (equal probe pat))
- (cl-every
- (lambda (s) (string-prefix-p probe s
completion-ignore-case))
- (funcall table pat pred t)))
- (cons probe (length probe))
- (cons pat point)))
- (t
- ;; Match ignoring suffix: if there are any completions for
- ;; the current prefix at least, keep the current input.
- (and (funcall table (substring pat 0 point) pred t)
- (cons pat point))))))
+ ;; Match ignoring suffix: if there are any completions for
+ ;; the current prefix at least, keep the current input.
+ (and (funcall table (substring pat 0 point) pred t)
+ (cons pat point)))
(add-to-list 'completion-category-defaults '(eglot-capf (styles
eglot--dumb-flex)))
(add-to-list 'completion-styles-alist '(eglot--dumb-flex
eglot--dumb-tryc eglot--dumb-allc))
But I'd prefer to hold off on it until specific issues come up.
>> This works:
>>
>> (when (buffer-live-p "*Completions*")
>> (kill-buffer "*Completions*"))
>> (completion-at-point)
>> (should (looking-back "foo"))
>> (should (looking-at "123"))
>> (should (get-buffer "*Completions*"))
>>
>> Is that better?
>
> It's half-decent, I think. Please use that.
Okay.
>> 1) Completions are not filtered by suffix, ever.
>> 2) Completing count_ones() does not delete the suffix ("1234"
>> remains).
>
> Interesting, I thought deleting the 1234 was part of the edit, but the
> user of that bug report was after some Emacs specific behaviour.
> Anyway, I don't think the test is too brittle, and I think I'd like to
> know anyway if something about that breaks anyway. Maybe you can just
> add a comment saying ";; this test might be a bit too brittle, but
> interesting nonetheless".
Pushed to emacs-30 as two parts: new tests for existing behavior and the
fix with its own tests (096730510cd, 713069dd7a8).
This bug report was last modified 267 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.