GNU bug report logs - #39600
[PATCH] Fix handling of non-exclusive non-prefix completion functions

Previous Next

Package: emacs;

Reported by: Amai Kinono <amaikinono <at> gmail.com>

Date: Fri, 14 Feb 2020 15:08:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Amai Kinono <amaikinono <at> gmail.com>
Cc: 39600 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#39600: [PATCH] Fix handling of non-exclusive non-prefix completion functions
Date: Sat, 08 Aug 2020 16:04:10 +0200
Amai Kinono <amaikinono <at> gmail.com> writes:

> Currently, with non-exclusive completion functions, Emacs will do
> `try-completion` on the current text, and decide whether to try next
> completion function based on that. This makes completion functions that
> can do non-prefix completions fails when the current text only occurs in
> the middle of the candidates. This is a problem I found in a FIXME in
> the code.
>
> # How does this work?
>
> I use `completion-all-completions` instead. As far as I know, this
> respects the `completion-styles`.

[...]

Stefan, how does this patch look to you?

> -               ;; 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))))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 306 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.