Switching to a different command without losing what you’ve typed
Embark also has the ‘embark-become’ command which is useful for when you run a command, start typing at the minibuffer and realize you meant a different command. The most common case for me is that I run ‘switch-to-buffer’, start typing a buffer name and realize I haven’t opened the file I had in mind yet! I’ll use this situation as a running example to illustrate ‘embark-become’. When this happens I can, of course, press ‘C-g’ and then run ‘find-file’ and open the file, but this requires retyping the portion of the file name you already typed. This process can be streamlined with ‘embark-become’: while still in the ‘switch-to-buffer’ you can run ‘embark-become’ and effectively make the ‘switch-to-buffer’ command become ‘find-file’ for this run.
You can bind ‘embark-become’ to a key in ‘minibuffer-local-map’, but it is also available as an action under the letter ‘B’ (uppercase), so you don’t need a binding if you already have one for ‘embark-act’. So, assuming I have ‘embark-act’ bound to, say, ‘C-.’, once I realize I haven’t open the file I can type ‘C-. B C-x C-f’ to have ‘switch-to-buffer’ become ‘find-file’ without losing what I have already typed in the minibuffer.
But for even more convenience, ‘embark-become’ offers shorter key bindings for commands you are likely to want the current command to become. When you use ‘embark-become’ it looks for the current command in all keymaps named in the list ‘embark-become-keymaps’ and then activates all keymaps that contain it. For example, the default value of ‘embark-become-keymaps’ contains a keymap ‘embark-become-file+buffer-map’ with bindings for several commands related to files and buffers, in particular, it binds ‘switch-to-buffer’ to ‘b’ and ‘find-file’ to ‘f’. So when I accidentally try to switch to a buffer for a file I haven’t opened yet, ‘embark-become’ finds that the command I ran, ‘switch-to-buffer’, is in the keymap ‘embark-become-file+buffer-map’, so it activates that keymap (and any others that also contain a binding for ‘switch-to-buffer’). The end result is that I can type ‘C-. B f’ to switch to ‘find-file’.