Function: execute-extended-command-for-buffer

execute-extended-command-for-buffer is an interactive and byte-compiled function defined in simple.el.gz.

Signature

(execute-extended-command-for-buffer PREFIXARG &optional COMMAND-NAME TYPED)

Documentation

Query user for a command relevant for the current mode, and then execute it.

This is like execute-extended-command, but it limits the completions to commands that are particularly relevant to the current buffer. This includes commands that have been marked as being specially designed for the current major mode (and enabled minor modes), as well as commands bound in the active local key maps.

View in manual

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun execute-extended-command-for-buffer (prefixarg &optional
                                                      command-name typed)
  "Query user for a command relevant for the current mode, and then execute it.
This is like `execute-extended-command', but it limits the
completions to commands that are particularly relevant to the
current buffer.  This includes commands that have been marked as
being specially designed for the current major mode (and enabled
minor modes), as well as commands bound in the active local key
maps."
  (declare (interactive-only command-execute))
  (interactive
   (let ((execute-extended-command--last-typed nil))
     (list current-prefix-arg
           (read-extended-command "M-X ")
           execute-extended-command--last-typed)))
  (with-suppressed-warnings ((interactive-only execute-extended-command))
    (execute-extended-command prefixarg command-name typed)))