I've finally jumped on the #vertico & co. bandwagon (I was using Ivy before). Here are some impressions.

I see some small quality-of-life improvements, like:
- `vertico-multiform' enabling `vertico-quick' and `vertico-grid' for telega.el emojis (Fig. 1).
- Grouping entries by file in `consult-ripgrep' (Fig. 2).
- Using `embark-collect' to create a buffer with current completion candidates and act on them separately. Unlike `ivy-occur', the embark version works on more commands.

I had to switch to `citar' [1] from `ivy-bibtex' for citations. Thankfully, `org-ref' can use the former with custom `org-ref-insert-cite-function' (just call `citar-insert-citation' there) [2].

Also, setting up custom embark actions is reasonably simple, although I wish setting completion metadata in Emacs was more straightforward [3].

And a few quirks:
- Embark actions take two keystrokes (in my case, M-e s), whereas in Ivy I had just M-s. But embark is more versatile, so I'll get used to it, I guess.
- I had to manually execute (run-hooks 'post-command-hook) after `completing-read' in my password typing package to refocus the EXWM frame. Otherwise, the first keystrokes got lost somewhere.

Links:
1. https://github.com/emacs-citar/citar
2. https://github.com/jkitchin/org-ref?tab=readme-ov-file#what-about-org-cite
3. https://github.com/oantolin/embark?tab=readme-ov-file#defining-actions-for-new-categories-of-targets

#emacs

GitHub - emacs-citar/citar: Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.

Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents. - emacs-citar/citar

GitHub

@sqrtminusone

> Embark actions take two keystrokes (in my case, M-e s), whereas in Ivy I had just M-s.

Could you explain why you need two keystrokes here instead of one?

@karthink To call `embark-act' with M-e and then the required embark keybinding. Or is there a faster way?

@sqrtminusone

It's not clear what you have set M-e s to do.

If it's running embark-collect or embark-export (the equivalent of ivy-occur), then you can just bind them directly in minibuffer-local-completion-map (or vertico-map).

If it's running a specific embark action, I imagine you would need two keys to run a specific ivy action too?

@karthink If you're curious, I've bound s to a command to type the login and password for the selected password-store record with xdotool :-)

Ivy allows passing the `:keymap' parameter to `ivy-read', which is joined with `ivy-minibuffer-map'. So adding a custom command is as simple as:

(defun my/test-command ()
(interactive)
(ivy-exit-with-action
(lambda (entry)
(message "Selected: %s" entry))))

(defvar my/test-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "M-t") #'my/test-command)
map))

(ivy-read "Foo: " '("foo" "bar" "baz")
:keymap my/test-map)

Pressing M-t in the completion buffer will invoke the lambda inside `my/test-command' on the selected entry. However, it will also continue the normal execution flow after `ivy-read'.

I probably wasn't specific enough; `ivy-read' also has the `:action' parameter, entries of which take two keystrokes to invoke: one for `ivy-read-action' and one for the action itself, much like Embark. The `:keymap' functionality is distinct from this, although packages usually configure both `:action' and `:keymap' to one set of keys and commands.

Well, now it seems I don't need that knowledge anymore :-) I'll probably go with binding `kmacro' for now, as @oantolin suggested. And then try to hack something more general.

@sqrtminusone you can do this for completing-read too but AFAIK, it involves using use-local-map+minibuffer-with-setup-hook.

@karthink @oantolin

@sqrtminusone @karthink This is Emacs! Nobody can force you to type two keystrokes if you want to type only one!

(define-key minibuffer-local-map "M-s" (kmacro "M-e s"))