diff options
| author | Stefan Kangas | 2022-06-19 03:29:04 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-06-19 14:32:13 +0200 |
| commit | 491fb413b1a44c7a3ac1eb101a8b1b7cd2ba04cf (patch) | |
| tree | f157a31d72f9d9a208fce81ba855aed4c7b470f5 | |
| parent | d181e410fcb26a293e8345fad54507d275fc807c (diff) | |
| download | emacs-491fb413b1a44c7a3ac1eb101a8b1b7cd2ba04cf.tar.gz emacs-491fb413b1a44c7a3ac1eb101a8b1b7cd2ba04cf.zip | |
Prefer defvar-keymap in kmacro.el
* lisp/kmacro.el (kmacro-keymap, kmacro-step-edit-map): Prefer
defvar-keymap.
| -rw-r--r-- | lisp/kmacro.el | 120 |
1 files changed, 57 insertions, 63 deletions
diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 5746b770a2e..ea60bc35f2b 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el | |||
| @@ -164,43 +164,41 @@ macro to be executed before appending to it." | |||
| 164 | 164 | ||
| 165 | ;; Keymap | 165 | ;; Keymap |
| 166 | 166 | ||
| 167 | (defvar kmacro-keymap | 167 | (defvar-keymap kmacro-keymap |
| 168 | (let ((map (make-sparse-keymap))) | 168 | :doc "Keymap for keyboard macro commands." |
| 169 | ;; Start, end, execute macros | 169 | ;; Start, end, execute macros |
| 170 | (define-key map "s" #'kmacro-start-macro) | 170 | "s" #'kmacro-start-macro |
| 171 | (define-key map "\C-s" #'kmacro-start-macro) | 171 | "C-s" #'kmacro-start-macro |
| 172 | (define-key map "\C-k" #'kmacro-end-or-call-macro-repeat) | 172 | "C-k" #'kmacro-end-or-call-macro-repeat |
| 173 | (define-key map "r" #'apply-macro-to-region-lines) | 173 | "r" #'apply-macro-to-region-lines |
| 174 | (define-key map "q" #'kbd-macro-query) ;; Like C-x q | 174 | "q" #'kbd-macro-query ;; Like C-x q |
| 175 | (define-key map "d" #'kmacro-redisplay) | 175 | "d" #'kmacro-redisplay |
| 176 | 176 | ||
| 177 | ;; macro ring | 177 | ;; macro ring |
| 178 | (define-key map "\C-n" #'kmacro-cycle-ring-next) | 178 | "C-n" #'kmacro-cycle-ring-next |
| 179 | (define-key map "\C-p" #'kmacro-cycle-ring-previous) | 179 | "C-p" #'kmacro-cycle-ring-previous |
| 180 | (define-key map "\C-v" #'kmacro-view-macro-repeat) | 180 | "C-v" #'kmacro-view-macro-repeat |
| 181 | (define-key map "\C-d" #'kmacro-delete-ring-head) | 181 | "C-d" #'kmacro-delete-ring-head |
| 182 | (define-key map "\C-t" #'kmacro-swap-ring) | 182 | "C-t" #'kmacro-swap-ring |
| 183 | (define-key map "\C-l" #'kmacro-call-ring-2nd-repeat) | 183 | "C-l" #'kmacro-call-ring-2nd-repeat |
| 184 | 184 | ||
| 185 | ;; macro counter | 185 | ;; macro counter |
| 186 | (define-key map "\C-f" #'kmacro-set-format) | 186 | "C-f" #'kmacro-set-format |
| 187 | (define-key map "\C-c" #'kmacro-set-counter) | 187 | "C-c" #'kmacro-set-counter |
| 188 | (define-key map "\C-i" #'kmacro-insert-counter) | 188 | "C-i" #'kmacro-insert-counter |
| 189 | (define-key map "\C-a" #'kmacro-add-counter) | 189 | "C-a" #'kmacro-add-counter |
| 190 | 190 | ||
| 191 | ;; macro editing | 191 | ;; macro editing |
| 192 | (define-key map "\C-e" #'kmacro-edit-macro-repeat) | 192 | "C-e" #'kmacro-edit-macro-repeat |
| 193 | (define-key map "\r" #'kmacro-edit-macro) | 193 | "RET" #'kmacro-edit-macro |
| 194 | (define-key map "e" #'edit-kbd-macro) | 194 | "e" #'edit-kbd-macro |
| 195 | (define-key map "l" #'kmacro-edit-lossage) | 195 | "l" #'kmacro-edit-lossage |
| 196 | (define-key map " " #'kmacro-step-edit-macro) | 196 | "SPC" #'kmacro-step-edit-macro |
| 197 | 197 | ||
| 198 | ;; naming and binding | 198 | ;; naming and binding |
| 199 | (define-key map "b" #'kmacro-bind-to-key) | 199 | "b" #'kmacro-bind-to-key |
| 200 | (define-key map "n" #'kmacro-name-last-macro) | 200 | "n" #'kmacro-name-last-macro |
| 201 | (define-key map "x" #'kmacro-to-register) | 201 | "x" #'kmacro-to-register) |
| 202 | map) | ||
| 203 | "Keymap for keyboard macro commands.") | ||
| 204 | (defalias 'kmacro-keymap kmacro-keymap) | 202 | (defalias 'kmacro-keymap kmacro-keymap) |
| 205 | 203 | ||
| 206 | ;;; Provide some binding for startup: | 204 | ;;; Provide some binding for startup: |
| @@ -1049,34 +1047,30 @@ without repeating the prefix." | |||
| 1049 | (defvar kmacro-step-edit-help) ;; kmacro step edit help enabled | 1047 | (defvar kmacro-step-edit-help) ;; kmacro step edit help enabled |
| 1050 | (defvar kmacro-step-edit-num-input-keys) ;; to ignore duplicate pre-command hook | 1048 | (defvar kmacro-step-edit-num-input-keys) ;; to ignore duplicate pre-command hook |
| 1051 | 1049 | ||
| 1052 | (defvar kmacro-step-edit-map | 1050 | (defvar-keymap kmacro-step-edit-map |
| 1053 | (let ((map (make-sparse-keymap))) | 1051 | :doc "Keymap that defines the responses to questions in `kmacro-step-edit-macro'. |
| 1054 | ;; query-replace-map answers include: `act', `skip', `act-and-show', | ||
| 1055 | ;; `exit', `act-and-exit', `edit', `delete-and-edit', `recenter', | ||
| 1056 | ;; `automatic', `backup', `exit-prefix', and `help'.") | ||
| 1057 | ;; Also: `quit', `edit-replacement' | ||
| 1058 | |||
| 1059 | (set-keymap-parent map query-replace-map) | ||
| 1060 | |||
| 1061 | (define-key map "\t" 'act-repeat) | ||
| 1062 | (define-key map [tab] 'act-repeat) | ||
| 1063 | (define-key map "\C-k" 'skip-rest) | ||
| 1064 | (define-key map "c" 'automatic) | ||
| 1065 | (define-key map "f" 'skip-keep) | ||
| 1066 | (define-key map "q" 'quit) | ||
| 1067 | (define-key map "d" 'skip) | ||
| 1068 | (define-key map "\C-d" 'skip) | ||
| 1069 | (define-key map "i" 'insert) | ||
| 1070 | (define-key map "I" 'insert-1) | ||
| 1071 | (define-key map "r" 'replace) | ||
| 1072 | (define-key map "R" 'replace-1) | ||
| 1073 | (define-key map "a" 'append) | ||
| 1074 | (define-key map "A" 'append-end) | ||
| 1075 | map) | ||
| 1076 | "Keymap that defines the responses to questions in `kmacro-step-edit-macro'. | ||
| 1077 | This keymap is an extension to the `query-replace-map', allowing the | 1052 | This keymap is an extension to the `query-replace-map', allowing the |
| 1078 | following additional answers: `insert', `insert-1', `replace', `replace-1', | 1053 | following additional answers: `insert', `insert-1', `replace', `replace-1', |
| 1079 | `append', `append-end', `act-repeat', `skip-end', `skip-keep'.") | 1054 | `append', `append-end', `act-repeat', `skip-end', `skip-keep'." |
| 1055 | ;; query-replace-map answers include: `act', `skip', `act-and-show', | ||
| 1056 | ;; `exit', `act-and-exit', `edit', `delete-and-edit', `recenter', | ||
| 1057 | ;; `automatic', `backup', `exit-prefix', and `help'.") | ||
| 1058 | ;; Also: `quit', `edit-replacement' | ||
| 1059 | :parent query-replace-map | ||
| 1060 | "TAB" 'act-repeat | ||
| 1061 | "<tab>" 'act-repeat | ||
| 1062 | "C-k" 'skip-rest | ||
| 1063 | "c" 'automatic | ||
| 1064 | "f" 'skip-keep | ||
| 1065 | "q" 'quit | ||
| 1066 | "d" 'skip | ||
| 1067 | "C-d" 'skip | ||
| 1068 | "i" 'insert | ||
| 1069 | "I" 'insert-1 | ||
| 1070 | "r" 'replace | ||
| 1071 | "R" 'replace-1 | ||
| 1072 | "a" 'append | ||
| 1073 | "A" 'append-end) | ||
| 1080 | 1074 | ||
| 1081 | (defun kmacro-step-edit-prompt (macro index) | 1075 | (defun kmacro-step-edit-prompt (macro index) |
| 1082 | ;; Show step-edit prompt | 1076 | ;; Show step-edit prompt |