[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 36b7025 348/434: Add alternative to mc/ma
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 36b7025 348/434: Add alternative to mc/mark-next-like-this |
Date: |
Sat, 7 Aug 2021 09:20:57 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 36b7025a350ccdf9036a7ca8c16aec6f204fcd88
Author: Jules Tamagnan <jtamagnan@gmail.com>
Commit: Jules Tamagnan <jtamagnan@gmail.com>
Add alternative to mc/mark-next-like-this
* README.md: Add mc/mark-next-like-this-word tidbits to readme.
* features/step-definitions/multiple-cursors-steps.el: Add
mc/mark-next-like-this-word call.
* features/support/env.el: Add shortcut for mc/mark-next-like-this-word
as "C-S-c C->".
* mc-mark-more.el: Add to mc/mark-next-like-this description to explain
what happens when no region is selected. Add
mc/mark-next-like-this-word function.
* multiple-cursors-core.el: Add mc/mark-next-like-this-word to commands
to run once.
* multiple-cursors.el: Add information about mc/mark-next-like-this-word.
---
README.md | 8 ++++++--
.../step-definitions/multiple-cursors-steps.el | 3 +++
features/support/env.el | 1 +
mc-mark-more.el | 22 +++++++++++++++++++++-
multiple-cursors-core.el | 1 +
multiple-cursors.el | 6 +++++-
6 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index d97345a..dfc8ad1 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ add a cursor to each line:
When you want to add multiple cursors not based on continuous lines, but based
on
keywords in the buffer, use:
- (global-set-key (kbd "C->") 'mc/mark-next-like-this)
+ (global-set-key (kbd "C->") 'mc/mark-next-like-this) or (global-set-key
(kbd "C->") 'mc/mark-next-like-this-word)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
@@ -49,6 +49,7 @@ 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-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 +102,9 @@ 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` with no region selected. It will
mark the word 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.
@@ -118,7 +122,7 @@ You can [watch an intro to multiple-cursors at Emacs
Rocks](http://emacsrocks.co
- If you would like to keep the global bindings clean, and get custom
keybindings
when the region is active, you can try
[region-bindings-mode](https://github.com/fgallina/region-bindings-mode).
-BTW, I highly recommend adding `mc/mark-next-like-this` to a key binding that's
+BTW, I highly recommend adding `mc/mark-next-like-this` or
`mc/mark-next-like-this-word` to a key binding that's
right next to the key for `er/expand-region`.
### Binding mouse events
diff --git a/features/step-definitions/multiple-cursors-steps.el
b/features/step-definitions/multiple-cursors-steps.el
index a5590b7..a3864e5 100644
--- a/features/step-definitions/multiple-cursors-steps.el
+++ b/features/step-definitions/multiple-cursors-steps.el
@@ -1,6 +1,9 @@
(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 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..b7dfaa6 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -21,6 +21,7 @@
(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)
(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..a25c16c 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,25 @@ 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)
+ (mark-word)
+ (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 +481,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..23115df 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -596,6 +596,7 @@ 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-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..c56f5c3 100644
--- a/multiple-cursors.el
+++ b/multiple-cursors.el
@@ -42,7 +42,7 @@
;; When you want to add multiple cursors not based on continuous lines, but
based on
;; keywords in the buffer, use:
-;; (global-set-key (kbd "C->") 'mc/mark-next-like-this)
+;; (global-set-key (kbd "C->") 'mc/mark-next-like-this) or (global-set-key
(kbd "C->") 'mc/mark-next-like-this-word)
;; (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
;; (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
@@ -61,6 +61,7 @@
;; ### 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-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 +101,9 @@
;; - 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` with no region selected. It
will mark the word 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 6339657 192/434: Fix byte-compilation warnings, and avoid unnecessary use of "eval", (continued)
- [nongnu] elpa/multiple-cursors 6339657 192/434: Fix byte-compilation warnings, and avoid unnecessary use of "eval", ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 641eb68 212/434: Can use mc/reverse-regions w/o region or cursors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0ee76bf 214/434: Add mc/add-cursor-on-click, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 16589a5 224/434: Update README.md, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 5c60757 216/434: export ECUKES_EMACS in run-travis-ci.sh, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6467fe2 277/434: Add mc/mark-all-dwim to autoloads, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors c69be0e 282/434: Travis CI: Update location of cask install, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4da58ea 302/434: Merge pull request #146 from bling/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f0dcd06 323/434: Merge pull request #175 from lexa/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 2d6ffce 330/434: Support unmarking with no region. Change mc/mark-lines to preserve point., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 36b7025 348/434: Add alternative to mc/mark-next-like-this,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors a393384 353/434: Merge pull request #227 from jtamagnan/insert_letters, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e17851e 359/434: Fix click-toggling and make it robust (address all PR #239 comments), ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 8ac4ad3 361/434: Update README.md, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 9f4cdd0 368/434: Modified mc/mark-lines to allow skipping, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fb0e71a 371/434: Remove mention of marmalade, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors be4fbc7 373/434: Mention MELPA Stable, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dfaf621 392/434: Fix #254; remove mc/mark-next-like-this-extended, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 67d6579 388/434: Updated tests, README., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 277aef4 393/434: Make mc/list-file into defcustom, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6327681 394/434: Merge pull request #267 from Fuco1/master, ELPA Syncer, 2021/08/07