bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48572: 28.0.50; Add `passthrough` completion style to minibuffer.el


From: Stefan Monnier
Subject: bug#48572: 28.0.50; Add `passthrough` completion style to minibuffer.el
Date: Sat, 22 May 2021 19:20:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> (defun passthrough-all-completions (_str table pred _point)
>   "Passthrough completion function.
> See `completion-all-completions' for the arguments STR, TABLE, PRED and
> POINT."
>   (let ((completion-regexp-list))
>     (all-completions "" table pred)))

Clearly, this is not right: passthrough completion should pass the `str`
and `point` info to the completion table.  The completion table may opt
to ignore that information, but we shouldn't prevent them from using it.
I expect most passthrough uses will want to use `str`.

> (defun passthrough-try-completion (str table pred _point)
>   "Passthrough completion function.
> See `completion-try-completion' for the arguments STR, TABLE, PRED and
> POINT."
>   (let ((completion-regexp-list)
>         (completion (try-completion str table pred)))
>     (if (stringp completion)
>         (cons completion (length completion))
>       completion)))

Same here: I think it's better to pass `point` to the completion table
and let the completion table return the `cons` cell.

Furthermore, `all-completions` and `try-completion` on a completion
table is defined as returning only the prefix completion, so the above
code would force `table` to be a "broken" completion table that doesn't
obey the normal completion table API.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]