Function: kmacro-start-macro-or-insert-counter

kmacro-start-macro-or-insert-counter is an autoloaded, interactive and byte-compiled function defined in kmacro.el.gz.

Signature

(kmacro-start-macro-or-insert-counter ARG)

Documentation

Record subsequent keyboard input, defining a keyboard macro.

The commands are recorded even as they are executed.

Initializes the macro's kmacro-counter to ARG (or 0 if no prefix arg) before defining the macro.

With C-u (universal-argument), appends to current keyboard macro (keeping the current value of kmacro-counter).

When used during defining/executing a macro, inserts the current value of kmacro-counter and increments the counter value by ARG (or by 1 if no prefix argument). With just C-u (universal-argument), inserts the previous value of kmacro-counter, and does not modify the counter; this is different from incrementing the counter by zero. (The previous value of the counter is the one it had before the last increment.)

The macro counter can be set directly via C-x C-k C-c (kmacro-set-counter) and C-x C-k C-a (kmacro-add-counter). The format of the inserted value of the counter can be controlled via C-x C-k C-f (kmacro-set-format).

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/kmacro.el.gz
;;; Combined function key bindings:

;;;###autoload
(defun kmacro-start-macro-or-insert-counter (arg)
  "Record subsequent keyboard input, defining a keyboard macro.
The commands are recorded even as they are executed.

Initializes the macro's `kmacro-counter' to ARG (or 0 if no prefix arg)
before defining the macro.

With \\[universal-argument], appends to current keyboard macro (keeping
the current value of `kmacro-counter').

When used during defining/executing a macro, inserts the current value
of `kmacro-counter' and increments the counter value by ARG (or by 1 if no
prefix argument).  With just \\[universal-argument], inserts the previous
value of `kmacro-counter', and does not modify the counter; this is
different from incrementing the counter by zero.  (The previous value
of the counter is the one it had before the last increment.)

The macro counter can be set directly via \\[kmacro-set-counter] and \\[kmacro-add-counter].
The format of the inserted value of the counter can be controlled
via \\[kmacro-set-format]."
  (interactive "P")
  (if (or defining-kbd-macro executing-kbd-macro)
      (kmacro-insert-counter arg)
    (kmacro-start-macro arg)))