mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
Added mc-version of mark-all-in-region
This commit is contained in:
parent
0d89125f60
commit
f42e467bf8
@ -85,3 +85,12 @@ Feature: Marking multiple parts of the buffer
|
||||
And I select "text"
|
||||
And I press "M-!"
|
||||
Then I should have 3 cursors
|
||||
|
||||
Scenario: Marking in region
|
||||
Given I turn on delete-selection-mode
|
||||
When I insert "Here's text, text and text"
|
||||
And I select "text, text"
|
||||
And I press "M-# text <return>"
|
||||
And I type "more"
|
||||
Then I should have 2 cursors
|
||||
And I should see "Here's more, more and text"
|
||||
|
@ -23,6 +23,7 @@
|
||||
(global-set-key (kbd "M->") 'mc/mark-next-like-this)
|
||||
(global-set-key (kbd "M-<") 'mc/mark-previous-like-this)
|
||||
(global-set-key (kbd "M-!") 'mc/mark-all-like-this)
|
||||
(global-set-key (kbd "M-#") 'mc/mark-all-in-region)
|
||||
(global-set-key (kbd "H-SPC") 'set-rectangular-region-anchor)
|
||||
(switch-to-buffer
|
||||
(get-buffer-create "*multiple-cursors*"))
|
||||
|
@ -129,4 +129,25 @@ With zero ARG, skip the last one and mark next."
|
||||
(multiple-cursors-mode 1)
|
||||
(multiple-cursors-mode 0)))
|
||||
|
||||
;;;###autoload
|
||||
(defun mc/mark-all-in-region (beg end)
|
||||
"Find and mark all the parts in the region matching the given search"
|
||||
(interactive "r")
|
||||
(let ((search (read-from-minibuffer "Mark all in region: "))
|
||||
(case-fold-search nil))
|
||||
(mc/remove-fake-cursors)
|
||||
(goto-char beg)
|
||||
(while (search-forward search end t)
|
||||
(push-mark (match-beginning 0))
|
||||
(mc/create-fake-cursor-at-point))
|
||||
(let ((first (mc/furthest-cursor-before-point)))
|
||||
(if (not first)
|
||||
(error "Search failed for %S" search)
|
||||
(mc/pop-state-from-overlay first))))
|
||||
(if (> (mc/num-cursors) 1)
|
||||
(multiple-cursors-mode 1)
|
||||
(multiple-cursors-mode 0)))
|
||||
|
||||
|
||||
|
||||
(provide 'mc-mark-more)
|
||||
|
4
todo.org
4
todo.org
@ -10,9 +10,7 @@
|
||||
Possible to do C-s ...
|
||||
Any way to make M-z just prompt for letter once?
|
||||
** TODO mark-multiple-mode
|
||||
mark-multiple has some advantages
|
||||
-> simpler visuals, no extra cursors (matter of taste?)
|
||||
-> moving out of the marked area quits the mode
|
||||
mark-multiple has some advantages -> moving out of the marked area quits the mode
|
||||
** DONE unknown command: Do for (a)ll, (o)nce or (i)gnore -> (did that work ok? (k)eep doing that or (d)on't)
|
||||
unknown-command ran once - what now? (o)nce is enough, repeat for (a)ll, (u)ndo - that did NOT work.
|
||||
unknown-command ran for all - did that work as expected? (y)es, (n)o
|
||||
|
Loading…
x
Reference in New Issue
Block a user