Function: embark-become

embark-become is an autoloaded, interactive and byte-compiled function defined in embark.el.

Signature

(embark-become &optional FULL)

Documentation

Make current command become a different command.

Take the current minibuffer input as initial input for new command. The new command can be run normally using key bindings or M-x (execute-extended-command), but if the current command is found in a keymap in embark-become-keymaps, that keymap is activated to provide convenient access to the other commands in it.

If FULL is non-nil (interactively, if called with a prefix argument), the entire minibuffer contents are used as the initial input of the new command. By default only the part of the minibuffer contents between the current completion boundaries is taken. What this means is fairly technical, but (1) usually there is no difference: the completion boundaries include the entire minibuffer contents, and (2) the most common case where these notions differ is file completion, in which case the completion boundaries single out the path component containing point.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
;;;###autoload
(defun embark-become (&optional full)
  "Make current command become a different command.
Take the current minibuffer input as initial input for new
command.  The new command can be run normally using key bindings or
\\[execute-extended-command], but if the current command is found in a keymap in
`embark-become-keymaps', that keymap is activated to provide
convenient access to the other commands in it.

If FULL is non-nil (interactively, if called with a prefix
argument), the entire minibuffer contents are used as the initial
input of the new command.  By default only the part of the
minibuffer contents between the current completion boundaries is
taken.  What this means is fairly technical, but (1) usually
there is no difference: the completion boundaries include the
entire minibuffer contents, and (2) the most common case where
these notions differ is file completion, in which case the
completion boundaries single out the path component containing
point."
  (interactive "P")
  (unless (minibufferp)
    (user-error "Not in a minibuffer"))
  (let* ((target (embark--display-string ; remove invisible portions
                  (if full
                      (minibuffer-contents)
                    (pcase-let ((`(,beg . ,end) (embark--boundaries)))
                      (substring (minibuffer-contents) beg
                                 (+ end (embark--minibuffer-point)))))))
         (keymap (embark--become-keymap))
         (targets `((:type embark-become :target ,target)))
         (indicators (mapcar #'funcall embark-indicators))
         (become (unwind-protect
                     (embark--prompt indicators keymap targets)
                   (mapc #'funcall indicators))))
    (unless become
      (user-error "Canceled"))
    (embark--become-command become target)))