mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 05:03:03 +00:00
Add multiple-cursors support to execute-extended-command
Also add three new tests for this functionality and adapt some existing tests as well as the testing harness.
This commit is contained in:
parent
558198239e
commit
351eb6cbb5
@ -57,6 +57,28 @@ Feature: Multiple cursors core
|
||||
And I press "C-!"
|
||||
Then I should see "This aatext contains the word text twice"
|
||||
|
||||
Scenario: Multiple supported M-x command (forward-word in this case)
|
||||
Given I have cursors at "text" in "This text contains the word text twice"
|
||||
And I type "("
|
||||
And I press "M-x forward-word"
|
||||
And I press "M-x forward-word"
|
||||
And I type ")"
|
||||
Then I should see "This (text contains) the word (text twice)"
|
||||
|
||||
Scenario: Unknown M-x command: yes, do for all
|
||||
Given I have cursors at "text" in "This text contains the word text twice"
|
||||
And I press "C-SPC"
|
||||
And I press "M-f"
|
||||
And I press "M-x upcase-dwim RET y"
|
||||
Then I should see "This TEXT contains the word TEXT twice"
|
||||
|
||||
Scenario: Unknown M-x command: no, don't do for all
|
||||
Given I have cursors at "text" in "This text contains the word text twice"
|
||||
And I press "C-SPC"
|
||||
And I press "M-f"
|
||||
And I press "M-x upcase-dwim RET n"
|
||||
Then I should see "This TEXT contains the word text twice"
|
||||
|
||||
Scenario: Undo
|
||||
Given I have cursors at "text" in "This text contains the word text twice"
|
||||
When I press "M-f"
|
||||
|
@ -8,6 +8,7 @@ Feature: Repeat last interactive command for fake cursors (mc/repeat-command)
|
||||
And I press "RET"
|
||||
And I type "21"
|
||||
And I press "RET"
|
||||
And I type "n"
|
||||
And I press "C-:"
|
||||
And I press "y"
|
||||
And I execute the action chain
|
||||
@ -27,6 +28,7 @@ Feature: Repeat last interactive command for fake cursors (mc/repeat-command)
|
||||
Scenario: Disable prompt
|
||||
Given I have cursors at "text" in "This text/0000 contains the word text/1111 thrice (text/2222)"
|
||||
When I set mc/always-repeat-command to t
|
||||
When I set mc/always-run-for-all to t
|
||||
When I start an action chain
|
||||
And I press "M-x"
|
||||
And I type "zap-to-char"
|
||||
|
@ -45,6 +45,8 @@
|
||||
(subword-mode 0)
|
||||
(wrap-region-mode 0)
|
||||
(setq set-mark-default-inactive nil)
|
||||
(deactivate-mark))
|
||||
(deactivate-mark)
|
||||
(setq mc/cmds-to-run-for-all nil)
|
||||
(setq mc/cmds-to-run-once nil))
|
||||
|
||||
(After)
|
||||
|
@ -664,6 +664,20 @@ from being executed if in multiple-cursors-mode."
|
||||
(overlay-put cursor 'kill-ring kill-ring)
|
||||
(overlay-put cursor 'kill-ring-yank-pointer kill-ring-yank-pointer)))))))
|
||||
|
||||
(defadvice execute-extended-command (after execute-extended-command-for-all-cursors () activate)
|
||||
(when multiple-cursors-mode
|
||||
(unless (or mc/always-run-for-all
|
||||
(not (symbolp this-command))
|
||||
(memq this-command mc/cmds-to-run-for-all)
|
||||
(memq this-command mc/cmds-to-run-once)
|
||||
(memq this-command mc--default-cmds-to-run-for-all)
|
||||
(memq this-command mc--default-cmds-to-run-once))
|
||||
(mc/prompt-for-inclusion-in-whitelist this-command))
|
||||
(when (or mc/always-run-for-all
|
||||
(memq this-command mc/cmds-to-run-for-all)
|
||||
(memq this-command mc--default-cmds-to-run-for-all))
|
||||
(mc/execute-command-for-all-fake-cursors this-command))))
|
||||
|
||||
(defcustom mc/list-file (locate-user-emacs-file ".mc-lists.el")
|
||||
"The position of the file that keeps track of your preferences
|
||||
for running commands with multiple cursors."
|
||||
|
Loading…
x
Reference in New Issue
Block a user