(defvar kmacro-keymap
(let ((map (make-sparse-keymap)))
;; Start, end, execute macros
- (define-key map "s" 'kmacro-start-macro)
- (define-key map "\C-s" 'kmacro-start-macro)
- (define-key map "\C-k" 'kmacro-end-or-call-macro-repeat)
- (define-key map "r" 'apply-macro-to-region-lines)
- (define-key map "q" 'kbd-macro-query) ;; Like C-x q
- (define-key map "Q" 'kdb-macro-redisplay)
+ (define-key map "s" #'kmacro-start-macro)
+ (define-key map "\C-s" #'kmacro-start-macro)
+ (define-key map "\C-k" #'kmacro-end-or-call-macro-repeat)
+ (define-key map "r" #'apply-macro-to-region-lines)
+ (define-key map "q" #'kbd-macro-query) ;; Like C-x q
+ (define-key map "Q" #'kdb-macro-redisplay)
;; macro ring
- (define-key map "\C-n" 'kmacro-cycle-ring-next)
- (define-key map "\C-p" 'kmacro-cycle-ring-previous)
- (define-key map "\C-v" 'kmacro-view-macro-repeat)
- (define-key map "\C-d" 'kmacro-delete-ring-head)
- (define-key map "\C-t" 'kmacro-swap-ring)
- (define-key map "\C-l" 'kmacro-call-ring-2nd-repeat)
+ (define-key map "\C-n" #'kmacro-cycle-ring-next)
+ (define-key map "\C-p" #'kmacro-cycle-ring-previous)
+ (define-key map "\C-v" #'kmacro-view-macro-repeat)
+ (define-key map "\C-d" #'kmacro-delete-ring-head)
+ (define-key map "\C-t" #'kmacro-swap-ring)
+ (define-key map "\C-l" #'kmacro-call-ring-2nd-repeat)
;; macro counter
- (define-key map "\C-f" 'kmacro-set-format)
- (define-key map "\C-c" 'kmacro-set-counter)
- (define-key map "\C-i" 'kmacro-insert-counter)
- (define-key map "\C-a" 'kmacro-add-counter)
+ (define-key map "\C-f" #'kmacro-set-format)
+ (define-key map "\C-c" #'kmacro-set-counter)
+ (define-key map "\C-i" #'kmacro-insert-counter)
+ (define-key map "\C-a" #'kmacro-add-counter)
;; macro editing
- (define-key map "\C-e" 'kmacro-edit-macro-repeat)
- (define-key map "\r" 'kmacro-edit-macro)
- (define-key map "e" 'edit-kbd-macro)
- (define-key map "l" 'kmacro-edit-lossage)
- (define-key map " " 'kmacro-step-edit-macro)
+ (define-key map "\C-e" #'kmacro-edit-macro-repeat)
+ (define-key map "\r" #'kmacro-edit-macro)
+ (define-key map "e" #'edit-kbd-macro)
+ (define-key map "l" #'kmacro-edit-lossage)
+ (define-key map " " #'kmacro-step-edit-macro)
;; naming and binding
- (define-key map "b" 'kmacro-bind-to-key)
- (define-key map "n" 'kmacro-name-last-macro)
- (define-key map "x" 'kmacro-to-register)
+ (define-key map "b" #'kmacro-bind-to-key)
+ (define-key map "n" #'kmacro-name-last-macro)
+ (define-key map "x" #'kmacro-to-register)
map)
"Keymap for keyboard macro commands.")
(defalias 'kmacro-keymap kmacro-keymap)
;;; Provide some binding for startup:
-;;;###autoload (global-set-key "\C-x(" 'kmacro-start-macro)
-;;;###autoload (global-set-key "\C-x)" 'kmacro-end-macro)
-;;;###autoload (global-set-key "\C-xe" 'kmacro-end-and-call-macro)
-;;;###autoload (global-set-key [f3] 'kmacro-start-macro-or-insert-counter)
-;;;###autoload (global-set-key [f4] 'kmacro-end-or-call-macro)
-;;;###autoload (global-set-key "\C-x\C-k" 'kmacro-keymap)
+;;;###autoload (global-set-key "\C-x(" #'kmacro-start-macro)
+;;;###autoload (global-set-key "\C-x)" #'kmacro-end-macro)
+;;;###autoload (global-set-key "\C-xe" #'kmacro-end-and-call-macro)
+;;;###autoload (global-set-key [f3] #'kmacro-start-macro-or-insert-counter)
+;;;###autoload (global-set-key [f4] #'kmacro-end-or-call-macro)
+;;;###autoload (global-set-key "\C-x\C-k" #'kmacro-keymap)
;;;###autoload (autoload 'kmacro-keymap "kmacro" "Keymap for keyboard macro commands." t 'keymap)
(if kmacro-call-mouse-event
- (global-set-key (vector kmacro-call-mouse-event) 'kmacro-end-call-mouse))
+ (global-set-key (vector kmacro-call-mouse-event) #'kmacro-end-call-mouse))
;;; Called from keyboard-quit
(set-transient-map
(let ((map (make-sparse-keymap)))
(define-key map (vector repeat-key)
- `(lambda () (interactive)
- (kmacro-call-macro ,(and kmacro-call-repeat-with-arg arg)
- 'repeating nil ,(if end-macro
- last-kbd-macro
- (or macro last-kbd-macro)))))
+ (let ((ra (and kmacro-call-repeat-with-arg arg))
+ (m (if end-macro
+ last-kbd-macro
+ (or macro last-kbd-macro))))
+ (lambda ()
+ (interactive)
+ (kmacro-call-macro ra 'repeating nil m))))
map)))))
;;;###autoload
(defun kmacro-lambda-form (mac &optional counter format)
"Create lambda form for macro bound to symbol or key."
- (if counter
- (setq mac (list mac counter format)))
- `(lambda (&optional arg)
- "Keyboard macro."
- (interactive "p")
- (kmacro-exec-ring-item ',mac arg)))
+ (let ((mac (if counter (list mac counter format) mac)))
+ (lambda (&optional arg)
+ "Keyboard macro."
+ (interactive "p")
+ (kmacro-exec-ring-item mac arg))))
(defun kmacro-extract-lambda (mac)
"Extract kmacro from a kmacro lambda form."