[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#39600: [PATCH] Fix handling of non-exclusive non-prefix completion f
bug#39600: [PATCH] Fix handling of non-exclusive non-prefix completion functions
Sat, 08 Aug 2020 16:04:10 +0200
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Amai Kinono <firstname.lastname@example.org> 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
> - ;; on the actual completion UI (e.g. with the default
> - ;; it depends on completion-style) ;-(
> - ;; We approximate this result by checking whether prefix
> - ;; completion might work, which means that non-prefix
> - ;; 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
- bug#39600: [PATCH] Fix handling of non-exclusive non-prefix completion functions,
Lars Ingebrigtsen <=