[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors dd07bc5 351/434: Merge pull request #228
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors dd07bc5 351/434: Merge pull request #228 from jtamagnan/mark-next-like-this-word |
Date: |
Sat, 7 Aug 2021 09:20:58 -0400 (EDT) |
branch: elpa/multiple-cursors
commit dd07bc50ea20f2a3c877b184090a4edc2ea2b045
Merge: 97e5db1 8703b19
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Merge pull request #228 from jtamagnan/mark-next-like-this-word
Add alternative to mc/mark-next-like-this
---
README.md | 6 ++++
.../step-definitions/multiple-cursors-steps.el | 6 ++++
features/support/env.el | 2 ++
mc-mark-more.el | 39 +++++++++++++++++++++-
multiple-cursors-core.el | 2 ++
multiple-cursors.el | 6 ++++
6 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index d97345a..145fe79 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,8 @@ You can [watch an intro to multiple-cursors at Emacs
Rocks](http://emacsrocks.co
### Mark one more occurrence
- `mc/mark-next-like-this`: Adds a cursor and region at the next part of the
buffer forwards that matches the current region.
+ - `mc/mark-next-like-this-word`: Adds a cursor and region at the next part of
the buffer forwards that matches the current region, if no region is selected
it selects the word at the point.
+ - `mc/mark-next-like-this-symbol`: Adds a cursor and region at the next part
of the buffer forwards that matches the current region, if no region is
selected it selects the symbol at the point.
- `mc/mark-next-word-like-this`: Like `mc/mark-next-like-this` but only for
whole words.
- `mc/mark-next-symbol-like-this`: Like `mc/mark-next-like-this` but only for
whole symbols.
- `mc/mark-previous-like-this`: Adds a cursor and region at the next part of
the buffer backwards that matches the current region.
@@ -101,6 +103,10 @@ You can [watch an intro to multiple-cursors at Emacs
Rocks](http://emacsrocks.co
- Try pressing `mc/mark-next-like-this` with no region selected. It
will just add a cursor on the next line.
+- Try pressing `mc/mark-next-like-this-word` or
+ `mc/mark-next-like-this-symbol` with no region selected. It will
+ mark the word or symbol and add a cursor at the next occurance
+
- Try pressing `mc/mark-all-like-this-dwim` on a tagname in html-mode.
- Notice that the number of cursors active can be seen in the modeline.
diff --git a/features/step-definitions/multiple-cursors-steps.el
b/features/step-definitions/multiple-cursors-steps.el
index a5590b7..4d3fc09 100644
--- a/features/step-definitions/multiple-cursors-steps.el
+++ b/features/step-definitions/multiple-cursors-steps.el
@@ -1,6 +1,12 @@
(When "^I mark next like this$"
(lambda () (call-interactively 'mc/mark-next-like-this)))
+(When "^I mark next like this word$"
+ (lambda () (call-interactively 'mc/mark-next-like-this-word)))
+
+(When "^I mark next like this symbol$"
+ (lambda () (call-interactively 'mc/mark-next-like-this-symbol)))
+
(When "^I mark previous like this$"
(lambda () (call-interactively 'mc/mark-previous-like-this)))
diff --git a/features/support/env.el b/features/support/env.el
index 3ce7c91..35b9cd7 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -21,6 +21,8 @@
(multiple-cursors-mode 0)
(rectangular-region-mode 0)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
+ (global-set-key (kbd "C-S-c C->") 'mc/mark-next-like-this-word)
+ (global-set-key (kbd "C-S-c M->") 'mc/mark-next-like-this-symbol)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "M-!") 'mc/mark-all-like-this)
(global-set-key (kbd "M-$") 'mc/mark-all-like-this-dwim)
diff --git a/mc-mark-more.el b/mc-mark-more.el
index 1e87521..68addce 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -124,6 +124,7 @@ Use like case-fold-search, don't recommend setting it
globally.")
;;;###autoload
(defun mc/mark-next-like-this (arg)
"Find and mark the next part of the buffer matching the currently active
region
+If no region is active add a cursor on the next line
With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next."
(interactive "p")
@@ -138,6 +139,42 @@ With zero ARG, skip the last one and mark next."
(mc/maybe-multiple-cursors-mode))
;;;###autoload
+(defun mc/mark-next-like-this-word (arg)
+ "Find and mark the next part of the buffer matching the currently active
region
+If no region is active, mark the word at the point and find the next match
+With negative ARG, delete the last one instead.
+With zero ARG, skip the last one and mark next."
+ (interactive "p")
+ (if (< arg 0)
+ (let ((cursor (mc/furthest-cursor-after-point)))
+ (if cursor
+ (mc/remove-fake-cursor cursor)
+ (error "No cursors to be unmarked")))
+ (if (region-active-p)
+ (mc/mark-more-like-this (= arg 0) 'forwards)
+ (mc--select-thing-at-point 'word)
+ (mc/mark-more-like-this (= arg 0) 'forwards)))
+ (mc/maybe-multiple-cursors-mode))
+
+(defun mc/mark-next-like-this-symbol (arg)
+ "Find and mark the next part of the buffer matching the currently active
region
+If no region is active, mark the symbol at the point and find the next match
+With negative ARG, delete the last one instead.
+With zero ARG, skip the last one and mark next."
+ (interactive "p")
+ (if (< arg 0)
+ (let ((cursor (mc/furthest-cursor-after-point)))
+ (if cursor
+ (mc/remove-fake-cursor cursor)
+ (error "No cursors to be unmarked")))
+ (if (region-active-p)
+ (mc/mark-more-like-this (= arg 0) 'forwards)
+ (mc--select-thing-at-point 'symbol)
+ (mc/mark-more-like-this (= arg 0) 'forwards)))
+ (mc/maybe-multiple-cursors-mode))
+
+
+;;;###autoload
(defun mc/mark-next-word-like-this (arg)
(interactive "p")
(let ((mc/enclose-search-term 'words))
@@ -461,7 +498,7 @@ If the region is active and spans multiple lines, it will
behave
as if `mc/mark-all-in-region'. With the prefix ARG, it will call
`mc/edit-lines' instead.
-If the region is inactive or on a single line, it will behave like
+If the region is inactive or on a single line, it will behave like
`mc/mark-all-like-this-dwim'."
(interactive "P")
(if (and (use-region-p)
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 6602703..7e919cc 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -596,6 +596,8 @@ for running commands with multiple cursors.")
mc/edit-ends-of-lines
mc/edit-beginnings-of-lines
mc/mark-next-like-this
+ mc/mark-next-like-this-word
+ mc/mark-next-like-this-symbol
mc/mark-next-word-like-this
mc/mark-next-symbol-like-this
mc/mark-previous-like-this
diff --git a/multiple-cursors.el b/multiple-cursors.el
index 9c44db9..645c713 100644
--- a/multiple-cursors.el
+++ b/multiple-cursors.el
@@ -61,6 +61,8 @@
;; ### Mark one more occurrence
;; - `mc/mark-next-like-this`: Adds a cursor and region at the next part of
the buffer forwards that matches the current region.
+;; - `mc/mark-next-like-this-word`: Adds a cursor and region at the next part
of the buffer forwards that matches the current region, if no region is
selected it selects the word at the point.
+;; - `mc/mark-next-like-this-symbol`: Adds a cursor and region at the next
part of the buffer forwards that matches the current region, if no region is
selected it selects the symbol at the point.
;; - `mc/mark-next-word-like-this`: Like `mc/mark-next-like-this` but only
for whole words.
;; - `mc/mark-next-symbol-like-this`: Like `mc/mark-next-like-this` but only
for whole symbols.
;; - `mc/mark-previous-like-this`: Adds a cursor and region at the next part
of the buffer backwards that matches the current region.
@@ -100,6 +102,10 @@
;; - Try pressing `mc/mark-next-like-this` with no region selected. It will
just add a cursor
;; on the next line.
;;
+;; - Try pressing `mc/mark-next-like-this-word` or
+;; `mc/mark-next-like-this-symbol` with no region selected. It will
+;; mark the symbol and add a cursor at the next occurance
+;;
;; - Try pressing `mc/mark-all-like-this-dwim` on a tagname in html-mode.
;;
;; - Notice that the number of cursors active can be seen in the modeline.
- [nongnu] elpa/multiple-cursors 980a880 223/434: Merge pull request #63 from tkf/select-thing-at-point, (continued)
- [nongnu] elpa/multiple-cursors 980a880 223/434: Merge pull request #63 from tkf/select-thing-at-point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dce6c00 174/434: Add mc/cursor-specific-vars to handle vars that need to be tracked per cursor., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0a081a7 184/434: Move mc/maybe-multiple-cursors-mode to core., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 9a376a6 201/434: Add note about yank-rectangle, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e7605bb 194/434: Merge pull request #42 from purcell/cleanup, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d24ddc5 217/434: Default ECUKES_EMACS to $EMACS, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 94af074 240/434: Add some readability enhancing step definitions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 66ceb0b 246/434: Revert cursor specific pre- & post-command-hooks, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 725369c 253/434: Merge pull request #97 from knu/fix-mc-mark-pop-doc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors bbbe90d 349/434: Minor changes mark-next-like-this-word and readme, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dd07bc5 351/434: Merge pull request #228 from jtamagnan/mark-next-like-this-word,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 8297f1f 363/434: Merge pull request #241 from YoungFrog/fix-#230, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 3112e61 377/434: When cursor-type is bar, mc/cursors appear as bars, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 8413969 383/434: Merge pull request #253 from jtamagnan/fake-bar-cursor, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ddbe3ae 396/434: Merge pull request #278 from shlomme/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d2766bc 400/434: tips and tricks: add note about <return> and newlines; if it is not default, let it at least be more discoverable, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0e49fec 410/434: Merge pull request #326 from pstray/issue325, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1075270 407/434: Added mc/interactive-repeating-commands (#303), ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 038815b 414/434: Make "no more matches found." user-error, fix #218, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d27870d 421/434: Load mc/list-file as late as possible, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fc6a6a7 422/434: Merge pull request #355 from flatwhatson/lazy-list-file, ELPA Syncer, 2021/08/07