592 |
kmacro-call-repeat-key))) |
kmacro-call-repeat-key))) |
593 |
(setq repeat-key-str (format-kbd-macro (vector repeat-key) nil)) |
(setq repeat-key-str (format-kbd-macro (vector repeat-key) nil)) |
594 |
(while repeat-key |
(while repeat-key |
595 |
(message "Repeat macro %swith `%s'..." |
(message "(Type %s to repeat macro%s)" |
596 |
|
repeat-key-str |
597 |
(if (and kmacro-call-repeat-with-arg |
(if (and kmacro-call-repeat-with-arg |
598 |
arg (> arg 1)) |
arg (> arg 1)) |
599 |
(format "%d times " arg) "") |
(format " %d times" arg) "")) |
|
repeat-key-str) |
|
600 |
(if (equal repeat-key (read-event)) |
(if (equal repeat-key (read-event)) |
601 |
(progn |
(progn |
602 |
(clear-this-command-keys t) |
(clear-this-command-keys t) |
752 |
(defvar kmacro-step-edit-map (make-sparse-keymap) |
(defvar kmacro-step-edit-map (make-sparse-keymap) |
753 |
"Keymap that defines the responses to questions in `kmacro-step-edit-macro'. |
"Keymap that defines the responses to questions in `kmacro-step-edit-macro'. |
754 |
This keymap is an extension to the `query-replace-map', allowing the |
This keymap is an extension to the `query-replace-map', allowing the |
755 |
following additional answers: `insert-1', `insert', `append-1', |
following additional answers: `insert', `insert-1', `replace', `replace-1', |
756 |
`append', `replace-1', `replace', `act-repeat', `skip-rest', |
`append', `append-end', `act-repeat', `skip-end', `skip-keep'.") |
|
`skip-keep'.") |
|
757 |
|
|
758 |
;; query-replace-map answers include: `act', `skip', `act-and-show', |
;; query-replace-map answers include: `act', `skip', `act-and-show', |
759 |
;; `exit', `act-and-exit', `edit', `delete-and-edit', `recenter', |
;; `exit', `act-and-exit', `edit', `delete-and-edit', `recenter', |
774 |
(define-key kmacro-step-edit-map "r" 'replace) |
(define-key kmacro-step-edit-map "r" 'replace) |
775 |
(define-key kmacro-step-edit-map "R" 'replace-1) |
(define-key kmacro-step-edit-map "R" 'replace-1) |
776 |
(define-key kmacro-step-edit-map "a" 'append) |
(define-key kmacro-step-edit-map "a" 'append) |
777 |
(define-key kmacro-step-edit-map "A" 'append-1) |
(define-key kmacro-step-edit-map "A" 'append-end) |
778 |
|
|
779 |
(defvar kmacro-step-edit-prefix-commands |
(defvar kmacro-step-edit-prefix-commands |
780 |
'(universal-argument universal-argument-more universal-argument-minus |
'(universal-argument universal-argument-more universal-argument-minus |
827 |
(propertize |
(propertize |
828 |
(format "Type key sequence%s to insert and execute%s: " |
(format "Type key sequence%s to insert and execute%s: " |
829 |
(if (numberp kmacro-step-edit-inserting) "" "s") |
(if (numberp kmacro-step-edit-inserting) "" "s") |
830 |
(if (numberp kmacro-step-edit-inserting) "" "[end with C-j]")) |
(if (numberp kmacro-step-edit-inserting) "" " (end with C-j)")) |
831 |
'face 'bold)))))) |
'face 'bold)))))) |
832 |
|
|
833 |
(defun kmacro-step-edit-query () |
(defun kmacro-step-edit-query () |
931 |
(setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
(setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
932 |
kmacro-step-edit-appending t)) |
kmacro-step-edit-appending t)) |
933 |
nil) |
nil) |
934 |
((member act '(append-1 append)) |
((eq act 'append) |
935 |
(setq kmacro-step-edit-inserting (if (eq act 'append-1) 1 t)) |
(setq kmacro-step-edit-inserting t) |
936 |
(if (= executing-macro-index (length executing-kbd-macro)) |
(if (= executing-macro-index (length executing-kbd-macro)) |
937 |
(setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
(setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
938 |
kmacro-step-edit-appending t)) |
kmacro-step-edit-appending t)) |
939 |
t) |
t) |
940 |
|
((eq act 'append-end) |
941 |
|
(if (= executing-macro-index (length executing-kbd-macro)) |
942 |
|
(setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
943 |
|
kmacro-step-edit-inserting t |
944 |
|
kmacro-step-edit-appending t) |
945 |
|
(setq kmacro-step-edit-active 'append-end)) |
946 |
|
(setq act t) |
947 |
|
t) |
948 |
((eq act 'help) |
((eq act 'help) |
949 |
(setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) |
(setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) |
950 |
(setq kmacro-step-edit-help (not kmacro-step-edit-help)) |
(setq kmacro-step-edit-help (not kmacro-step-edit-help)) |
1038 |
(cond |
(cond |
1039 |
((eq kmacro-step-edit-active 'ignore) |
((eq kmacro-step-edit-active 'ignore) |
1040 |
(setq this-command 'ignore)) |
(setq this-command 'ignore)) |
1041 |
|
((eq kmacro-step-edit-active 'append-end) |
1042 |
|
(if (= executing-macro-index (length executing-kbd-macro)) |
1043 |
|
(setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
1044 |
|
kmacro-step-edit-inserting t |
1045 |
|
kmacro-step-edit-appending t |
1046 |
|
kmacro-step-edit-active t))) |
1047 |
((/= kmacro-step-edit-num-input-keys num-input-keys) |
((/= kmacro-step-edit-num-input-keys num-input-keys) |
1048 |
(if kmacro-step-edit-inserting |
(if kmacro-step-edit-inserting |
1049 |
(kmacro-step-edit-insert) |
(kmacro-step-edit-insert) |