[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Separating completion candidates and filtering
From: |
Alex |
Subject: |
Separating completion candidates and filtering |
Date: |
Fri, 18 Aug 2017 23:51:08 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Hello everyone,
I'd like to know if there's currently a way for a `completing-read'
procedure to instruct to a `minibuffer-completion-table' procedure that
it should not do any filtering via, e.g.,
`completion-table-with-context'.
Here is my specific use case: For some reason, I'm looking at making a
nicer interface for completing "key=value" pairs in Emacs, which uses
AUCTeX's `multi-prompt-key-value'[1]. This nicer interface is mainly for
certain 3rd-party completion backends, such as Helm[2] and Ivy[3].
I got the system working more or less how I'd like it (I plan on posting
it in the near future), but one issue I'm having is that the procedure
`multi-prompt-key-value-collection-fn' uses
`completion-table-with-context', which filters the candidates using
simple prefix completion (when used with `all-completions').
AFAIU, completion backends such as Helm and Ivy essentially call the
`minibuffer-completion-table' mainly to get the list of candidates, and
then does the filtering on its own. As it stands, candidates are being
filtered by `m-p-k-v-c-f' and by Helm/Ivy's own filtering mechanisms,
leading to suboptimal (though not wrong) results.
One possible solution to this is adding a new value option for `action'
in `complete-with-action' that instructs `completion-table-with-context'
to just return the table. I've included a diff that does this[4] below.
I'm not very familiar with the contents of minibuffer.el, so I'm sorry
if I'm missing something obvious.
Footnotes:
[1] https://git.savannah.gnu.org/cgit/auctex.git/tree/multi-prompt.el#n188
[2] https://github.com/emacs-helm/helm
[3] https://github.com/abo-abo/swiper
[4]
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index e5b1029c01..105e7f36e5 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -164,6 +164,7 @@ complete-with-action
((functionp table) (funcall table string pred action))
((eq (car-safe action) 'boundaries) nil)
((eq action 'metadata) nil)
+ ((eq action 'identity) table)
(t
(funcall
(cond
- Separating completion candidates and filtering,
Alex <=