From 4dd4d58d56c111eb1ba482119c07134b85591747 Mon Sep 17 00:00:00 2001 From: AmaiKinono Date: Fri, 14 Feb 2020 14:52:55 +0800 Subject: [PATCH] Fix handling for non-exclusive non-prefix completion functions * lisp/minibuffer.el (completion--capf-wrapper): use completion-all-completions to do the test. --- lisp/minibuffer.el | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 49daabc..f811a5f 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2244,18 +2244,11 @@ completion--capf-wrapper (unless (member fun completion--capf-safe-funs) (push fun completion--capf-safe-funs)) (and (eq 'no (plist-get (nthcdr 3 res) :exclusive)) - ;; FIXME: Here we'd need to decide whether there are - ;; valid completions against the current text. But this depends - ;; on the actual completion UI (e.g. with the default completion - ;; it depends on completion-style) ;-( - ;; We approximate this result by checking whether prefix - ;; completion might work, which means that non-prefix completion - ;; will not work (or not right) for completion functions that - ;; are non-exclusive. - (null (try-completion (buffer-substring-no-properties - (car res) (point)) - (nth 2 res) - (plist-get (nthcdr 3 res) :predicate))) + (null (completion-all-completions + (buffer-substring-no-properties (car res) (point)) + (nth 2 res) + (plist-get (nthcdr 3 res) :predicate) + (- (point) (car res)))) (setq res nil))) ((not (or (listp res) (functionp res))) (unless (member fun completion--capf-misbehave-funs) -- 2.25.0