Replies: 3 comments 5 replies
-
I am not sure what is intended, but the error also occurs without Vertico on emacs -Q.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Hmm. That's odd. On my end, evaluating this (defvar my/test-list '(("Apples" (:location "refrigerator" :amount 3))
("Bananas" (:location "counter" :amount 6))
("Oranges" (:location "counter" :amount 0))))
(defun my/have-some-crm (item)
(> (plist-get (car (cdr (assoc item my/test-list))) :amount) 0)) and then (completing-read-multiple "Select some items: " my/test-list #'my/have-some-crm) allows me to type "Apples,Apples" and get, as a result, the list (EDIT: pressing M-RET doesn't do anything on my end with Here's what I get when I call
|
Beta Was this translation helpful? Give feedback.
5 replies
-
On 10/5/23 22:42, apc wrote:
Could this explain why I’m getting the error with |vertico-mode| on when
I try to just call |exit-minibuffer|?
Yes. Note that you actually invoke vertico-exit, which calls the
completion table in a similar way as minibuffer-force-complete.
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
apc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When a
PREDICATE
argument is passed tocompleting-read-multiple
, I get a bit of unexpected behavior whenvertico-mode
is on. I'm not quite sure how best to describe it, but what seems to be going on is this:completing-read-multiple
will use itsPREDICATE
argument to filter the possible completions after each time I insertcrm-separator
.vertico-mode
is on, the previously selected items (after inserting acrm-separator
) are prepended to possible completions before testing withPREDICATE
.There may be some conceptual confusion in my explanation above, so perhaps an example can help.
Consider the following minimal example, without using Vertico:
As expected, at first I'm only offered as completion "Apples" and "Bananas" ("Oranges" is not offered). After selecting one item and then entering a comma in the minibuffer, I'm again offered as possible completions "Apples" and "Bananas", not "Oranges".
If I enable
vertico-mode
, however, running the same code as above yields an error. Here's the beginning of the backtrace:I'm assuming something about the advice to
completing-read-multiple
seems to be making it test "Apples,Apples", rather than "Apples" withmy/have-some-crm
. I can fix this issue by defining a new function (I'm usingdash.el
here) and using it instead as the `PREDICATE' argument:Of course, this new function will work both with or without
vertico-mode
on, since the new test function is more general than the previous one. So in a sense I don't really need this issue addressed. But maybe I'm missing something?At this point I mostly wanted to know whether this is the intended behavior. If so, would it be helpful to document it somewhere?
Beta Was this translation helpful? Give feedback.
All reactions