Function: kmacro-name-last-macro

kmacro-name-last-macro is an autoloaded, interactive and byte-compiled function defined in kmacro.el.gz.

Signature

(kmacro-name-last-macro SYMBOL)

Documentation

Assign a name to the last keyboard macro defined.

Argument SYMBOL is the name to define. The symbol's function definition becomes the keyboard macro string. Such a "function" cannot be called from Lisp, but it is a valid editor command.

View in manual

Key Bindings

Aliases

name-last-kbd-macro

Source Code

;; Defined in /usr/src/emacs/lisp/kmacro.el.gz
;;;###autoload
(defun kmacro-name-last-macro (symbol)
  "Assign a name to the last keyboard macro defined.
Argument SYMBOL is the name to define.
The symbol's function definition becomes the keyboard macro string.
Such a \"function\" cannot be called from Lisp, but it is a valid editor command."
  (interactive "SName for last kbd macro: ")
  (or last-kbd-macro
      (error "No keyboard macro defined"))
  (and (fboundp symbol)
       (not (kmacro-keyboard-macro-p symbol))
       (error "Function %s is already defined and not a keyboard macro"
	      symbol))
  (if (string-equal symbol "")
      (error "No command name given"))
  (fset symbol (kmacro-ring-head))
  ;; This used to be used to detect when a symbol corresponds to a kmacro.
  ;; Nowadays it's unused because we used `kmacro-p' instead to see if the
  ;; symbol's function definition matches that of a kmacro, which is more
  ;; reliable.
  (put symbol 'kmacro t))