summaryrefslogtreecommitdiff
path: root/lisp/kmacro.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-05-17 22:16:42 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2021-05-17 22:16:54 -0400
commit7124598068ed267c34e1d70b49361f499fc31c9f (patch)
tree89cf66a4f21dcf605e16607004bb1465cc678241 /lisp/kmacro.el
parentd83db639d379df142482bf82d7eb020d2ec1ae73 (diff)
downloademacs-7124598068ed267c34e1d70b49361f499fc31c9f.tar.gz
* lisp/kmacro.el: Avoid the dynbound dialect of ELisp
(kmacro-call-macro, kmacro-lambda-form): Use proper closures. (kmacro-keymap): Prefer #' top quote function names.
Diffstat (limited to 'lisp/kmacro.el')
-rw-r--r--lisp/kmacro.el85
1 files changed, 43 insertions, 42 deletions
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 3a4ede403a4..4e92277d0f7 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -167,53 +167,53 @@ macro to be executed before appending to it."
(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
@@ -668,11 +668,13 @@ use \\[kmacro-name-last-macro]."
(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)))))
@@ -782,12 +784,11 @@ If kbd macro currently being defined end it before activating it."
;;;###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."