From: Alex <agrambot@gmail.com>
To: emacs-devel@gnu.org
Subject: Separating completion candidates and filtering
Date: Fri, 18 Aug 2017 23:51:08 -0600 [thread overview]
Message-ID: <87a82whzqr.fsf@lylat> (raw)
[-- Attachment #1: Type: text/plain, Size: 1664 bytes --]
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]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: complete-with-action.diff --]
[-- Type: text/x-diff, Size: 383 bytes --]
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
next reply other threads:[~2017-08-19 5:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-19 5:51 Alex [this message]
2017-08-19 22:57 ` Separating completion candidates and filtering Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a82whzqr.fsf@lylat \
--to=agrambot@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).