all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Separating completion candidates and filtering
@ 2017-08-19  5:51 Alex
  2017-08-19 22:57 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Alex @ 2017-08-19  5:51 UTC (permalink / raw)
  To: emacs-devel

[-- 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-19 22:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-19  5:51 Separating completion candidates and filtering Alex
2017-08-19 22:57 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.