[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 8703b19 350/434: Add mark-next-like-this-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 8703b19 350/434: Add mark-next-like-this-symbol function |
Date: |
Sat, 7 Aug 2021 09:20:57 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 8703b19872d12347bb91be5f70cb251244dae7b9
Author: Jules Tamagnan <jtamagnan@gmail.com>
Commit: Jules Tamagnan <jtamagnan@gmail.com>
Add mark-next-like-this-symbol function
* README.md: Update readme to include mark-next-like-this symbol
* features/step-definitions/multiple-cursors-steps.el: Add phrase for
mark-next-like-this-symbol
* features/support/env.el: Add keyboard shortcut for
mark-next-like-this-symbol and fix shortcut for
mark-next-like-this-word
* mc-mark-more.el: Add mc/mark-next-like-this-symbol function
* multiple-cursors-core.el: Add mc/mark-next-like-this-symbol to
functions to run only once
* multiple-cursors.el: Add to readme section.
---
README.md | 8 +++++---
features/step-definitions/multiple-cursors-steps.el | 3 +++
features/support/env.el | 3 ++-
mc-mark-more.el | 17 +++++++++++++++++
multiple-cursors-core.el | 1 +
multiple-cursors.el | 8 +++++---
6 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 541f2b1..145fe79 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) or (global-set-key
(kbd "C->") 'mc/mark-next-like-this-word)
+ (global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
@@ -50,6 +50,7 @@ You can [watch an intro to multiple-cursors at Emacs
Rocks](http://emacsrocks.co
- `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.
@@ -102,8 +103,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-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.
diff --git a/features/step-definitions/multiple-cursors-steps.el
b/features/step-definitions/multiple-cursors-steps.el
index a3864e5..4d3fc09 100644
--- a/features/step-definitions/multiple-cursors-steps.el
+++ b/features/step-definitions/multiple-cursors-steps.el
@@ -4,6 +4,9 @@
(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 b7dfaa6..35b9cd7 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -21,7 +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)
+ (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 ee5eb5f..68addce 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -156,6 +156,23 @@ With zero ARG, skip the last one and mark next."
(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)
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 23115df..7e919cc 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -597,6 +597,7 @@ for running commands with multiple cursors.")
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 c56f5c3..645c713 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) or (global-set-key
(kbd "C->") 'mc/mark-next-like-this-word)
+;; (global-set-key (kbd "C->") 'mc/mark-next-like-this)
;; (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
;; (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
@@ -62,6 +62,7 @@
;; - `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,8 +102,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-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.
;;
- [nongnu] elpa/multiple-cursors bf9e8e9 309/434: Added testcase for mc-hide-unmatched-lines-mode, (continued)
- [nongnu] elpa/multiple-cursors bf9e8e9 309/434: Added testcase for mc-hide-unmatched-lines-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7156651 313/434: fixed documentation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 19f842d 318/434: Undo after leaving mc mode will restore cursors as they was, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 40b1bad 319/434: Merge pull request #169 from lexa/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 82586a0 321/434: Consolidate contributor entries for Aleksey, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7d84398 327/434: Add missing require to mc-hide-unmatched-lines-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors cec48cc 328/434: Merge pull request #188 from iqbalansari/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 66b1127 336/434: Merge pull request #192 from uk-ar/add_search_word, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors c90bb62 339/434: Changed mc/furthest-cursor-after(before)-point to check if mark is active., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors cd967e7 343/434: Small optimization, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 8703b19 350/434: Add mark-next-like-this-symbol function,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 415e29f 352/434: Add @jtamagnan to contributors list, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1686630 369/434: try to implement blacklist, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d26cecd 381/434: added always-run-for-all, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 8e59a8a 390/434: Merge pull request #262 from AndreaOrru/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fa91dfb 397/434: Don't display message while loading mc/list-file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6f183a1 405/434: Merge pull request #304 from angadgill92/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 18f992b 403/434: Merge pull request #290 from raxod502/feat/silent-load, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 75dd6bf 413/434: Merge pull request #327 from notetiene/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 9c49874 415/434: Merge pull request #333 from drrlvn/patch-1, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6a7c3c0 418/434: Fix whitespace, ELPA Syncer, 2021/08/07