Replies: 4 comments 8 replies
-
Yes, we could add a |
Beta Was this translation helpful? Give feedback.
2 replies
-
Mathew ***@***.***> writes:
This works fairly well. The only issue I've faced while doing this is that if
you use an `:annotate` function, it gets the `multi-category` value rather than
the candidate string itself, so now you need to figure out a way for it to get
the candidate from that value. I resolved this by having an alist of
`multi-category` values to their strings. Overall, it's still an improvement,
though.
You could also attach a text property to the actual candidate string
(the cdr of the multi-category property).
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Mathew ***@***.***> writes:
That works for the filename case I was originally describing, but now I'm
writing a source that handles org-agenda headings with `consult--jump-state`
similar to how `consult-org-heading` does. So the cdrs are markers from
`org-marker`, not strings. (`consult-org-heading` uses the `:lookup` approach.)
Oh, this is not correct. The multi-category cdr must be a string.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Mathew ***@***.***> writes:
...oh. So, am I back to wrapping `consult--jump-state`, then?
Yes. But your original suggestion (of a lookup function or transform
function) wouldn't work either. There you would transform the candidate
to a marker and then again lose access to the metadata needed by the
annotation function.
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When defining a source, it might make sense to reuse existing state functions (eg.
consult--file-state
if the source is a list of file names). However, we might also want to display the candidates in a different form than what is passed to the state function (eg. abbreviate the file names). Inconsult--read
, the:lookup
property enables this; inconsult--multi
, we are forced to create new state functions that wrap the--preview
and--action
functions used in existing state functions, calling the function that would normally be passed through:lookup
on each candidate before passing it to the wrapped functions.Since this is rather inelegant, and difficult to get right, would it be possible to support
:lookup
inconsult--multi
?Beta Was this translation helpful? Give feedback.
All reactions