Function: kmacro-lambda-form

kmacro-lambda-form is an autoloaded and byte-compiled function defined in kmacro.el.gz.

Signature

(kmacro-lambda-form MAC &optional COUNTER FORMAT)

Documentation

Create lambda form for macro bound to symbol or key.

Source Code

;; Defined in /usr/src/emacs/lisp/kmacro.el.gz
;;; Misc. commands

;; An idea for macro bindings:
;; Create a separate keymap installed as a minor-mode keymap (e.g. in
;; the emulation-mode-map-alists) in which macro bindings are made
;; independent of any other bindings.  When first binding is made,
;; the keymap is created, installed, and enabled.  Key seq. C-x C-k +
;; can then be used to toggle the use of this keymap on and off.
;; This means that it would be safe(r) to bind ordinary keys like
;; letters and digits, provided that we inhibit the keymap while
;; executing the macro later on (but that's controversial...)

;;;###autoload
(defun kmacro-lambda-form (mac &optional counter format)
  "Create lambda form for macro bound to symbol or key."
  ;; Apparently, there are two different ways this is called:
  ;; either `counter' and `format' are both provided and `mac' is a vector,
  ;; or only `mac' is provided, as a list (MAC COUNTER FORMAT).
  ;; The first is used from `insert-kbd-macro' and `edmacro-finish-edit',
  ;; while the second is used from within this file.
  (let ((mac (if counter (list mac counter format) mac)))
    ;; FIXME: This should be a "funcallable struct"!
    (lambda (&optional arg)
      "Keyboard macro."
      ;; We put an "unused prompt" as a special marker so
      ;; `kmacro-extract-lambda' can see it's "one of us".
      (interactive "pkmacro")
      (if (eq arg 'kmacro--extract-lambda)
          (cons 'kmacro--extract-lambda mac)
        (kmacro-exec-ring-item mac arg)))))