[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors f42e467 090/434: Added mc-version of mark
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors f42e467 090/434: Added mc-version of mark-all-in-region |
Date: |
Sat, 7 Aug 2021 09:20:01 -0400 (EDT) |
branch: elpa/multiple-cursors
commit f42e467bf8688c763d34d28000a5a40c7ff040ed
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Added mc-version of mark-all-in-region
---
features/mark-more.feature | 9 +++++++++
features/support/env.el | 1 +
mc-mark-more.el | 21 +++++++++++++++++++++
todo.org | 4 +---
4 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/features/mark-more.feature b/features/mark-more.feature
index d8196f0..625fbbb 100644
--- a/features/mark-more.feature
+++ b/features/mark-more.feature
@@ -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"
diff --git a/features/support/env.el b/features/support/env.el
index d1534dc..51adda1 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -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*"))
diff --git a/mc-mark-more.el b/mc-mark-more.el
index 534052e..fdffc78 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -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)
diff --git a/todo.org b/todo.org
index 3687b23..dcf7553 100644
--- a/todo.org
+++ b/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
- [nongnu] elpa/multiple-cursors adf86bd 320/434: Add @lexa to list of contributors, (continued)
- [nongnu] elpa/multiple-cursors adf86bd 320/434: Add @lexa to list of contributors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ff0ac1f 322/434: Add function to disable mc undo into undo-list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 952877f 324/434: Revert undo-feature for multiple-cursors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 72b4bf3 329/434: Enable to specify search word in mc/mark-all-in-region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 97f7b1d 332/434: Merge pull request #197 from kissge/user-emacs-directory, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 533e157 335/434: Merge pull request #160 from P-Seebauer/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ccdc025 079/434: Run prefix argument commands just once., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors df5f83a 082/434: Add more common commands to run only once., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 576bf90 087/434: mc version of mark-previous-like-this, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0d89125 089/434: Added mc-version of mark-all-like-this, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f42e467 090/434: Added mc-version of mark-all-in-region,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors b912bf8 096/434: Always require multiple-cursors-core, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0233ba8 092/434: Add commands to run-once-list, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ef2226b 116/434: Consolidate kill-ring entries when exiting multiple-cursors-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d5a9d57 132/434: Add minibuffer-complete-and-exit to default run-once list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors b48e2b7 137/434: mc/edit-lines: Don't include the 'invisible' line, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ae0033f 140/434: Protect post-command-hook from errors to avoids undead cursors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fcbb7a4 152/434: Make mc/cycle-forward and mc/cycle-backward loop around by default., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 876937b 153/434: Use (interactive "P") instead of the weird (but equivalent) (interactive (list prefix-arg)), ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1ec78e1 162/434: Don't let mc/mark-lines create 'double' cursors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1074c88 178/434: Added mc/mark-all-like-this-dwim, ELPA Syncer, 2021/08/07