Function: kmacro-end-macro

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

Signature

(kmacro-end-macro ARG)

Documentation

Finish defining a keyboard macro.

The definition was started by C-x ( (kmacro-start-macro). The macro is now available for use via M-x kmacro-call-macro (kmacro-call-macro), or it can be given a name with C-x C-k n (kmacro-name-last-macro) and then invoked under that name.

With numeric arg, repeat macro now that many times, counting the definition just completed as the first repetition. An argument of zero means repeat until error.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/kmacro.el.gz
;;;###autoload
(defun kmacro-end-macro (arg)
  "Finish defining a keyboard macro.
The definition was started by \\[kmacro-start-macro].
The macro is now available for use via \\[kmacro-call-macro],
or it can be given a name with \\[kmacro-name-last-macro] and then invoked
under that name.

With numeric arg, repeat macro now that many times,
counting the definition just completed as the first repetition.
An argument of zero means repeat until error."
  (interactive "P")
   ;; Isearch may push the kmacro-end-macro key sequence onto the macro.
   ;; Just ignore it when executing the macro.
  (unless executing-kbd-macro
    (end-kbd-macro arg #'kmacro-loop-setup-function)
    (when (and last-kbd-macro (= (length last-kbd-macro) 0))
      (setq last-kbd-macro nil)
      (message "Ignore empty macro")
      ;; Don't call `kmacro-ring-empty-p' to avoid its messages.
      (while (and (null last-kbd-macro) kmacro-ring)
	(kmacro-pop-ring1)))))