From 581dfb79bffc25a2ef8879aee4862817f6c21e79 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felici=C3=A1n=20N=C3=A9meth?= Date: Sat, 11 Jan 2020 20:12:26 +0100 Subject: [PATCH] Fix eglot-completion-at-point for multiple matches MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The test-completion case shouldn't return t when there are multiple matches. Similarly, the try-completion should return t only if the match is exact. See (info "(elisp)Programmed Completion"). * eglot.el (eglot-completion-at-point): Instead of testing memberships, use test-completion and try-completion suggested by (info "(elisp)Programmed Completion"). * eglot-tests.el (non-unique-completions): Add new test. Co-authored-by: João Távora GitHub-reference: fix https://github.com/joaotavora/eglot/issues/365 --- lisp/progmodes/eglot.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 0447bc85041..98fa4d9af6f 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2154,10 +2154,10 @@ is not active." (cond ((eq action 'metadata) metadata) ; metadata ((eq action 'lambda) ; test-completion - (member probe (funcall proxies))) + (test-completion probe (funcall proxies))) ((eq (car-safe action) 'boundaries) nil) ; boundaries - ((and (null action) ; try-completion - (member probe (funcall proxies)) t)) + ((null action) ; try-completion + (try-completion probe (funcall proxies))) ((eq action t) ; all-completions (cl-remove-if-not (lambda (proxy) -- 2.39.2