Function: embark--command-name

embark--command-name is a byte-compiled function defined in embark.el.

Signature

(embark--command-name CMD)

Documentation

Return an appropriate name for CMD.

If CMD is a symbol, use its symbol name; for lambdas, use the first line of the documentation string; for keyboard macros use key-description; otherwise use the word "unnamed".

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark--command-name (cmd)
  "Return an appropriate name for CMD.
If CMD is a symbol, use its symbol name; for lambdas, use the
first line of the documentation string; for keyboard macros use
`key-description'; otherwise use the word \"unnamed\"."
  (concat ; fresh copy, so we can freely add text properties
   (cond
    ((or (stringp cmd) (vectorp cmd)) (key-description cmd))
    ((stringp (car-safe cmd)) (car cmd))
    ((eq (car-safe cmd) 'menu-item) (eval (cadr cmd)))
    ((keymapp cmd)
     (propertize (if (symbolp cmd) (format "+%s" cmd) "<keymap>")
                 'face 'embark-keymap))
    ((symbolp cmd)
     (let ((name (symbol-name cmd)))
       (if (string-prefix-p "embark-action--" name) ; direct action mode
           (format "(%s)" (string-remove-prefix "embark-action--" name))
         name)))
    ((when-let* ((doc (and (functionp cmd) (ignore-errors (documentation cmd)))))
       (save-match-data
         (when (string-match "^\\(.*\\)$" doc)
           (match-string 1 doc)))))
    (t "<unnamed>"))))