[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 8e59a8a 390/434: Merge pull request #262
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 8e59a8a 390/434: Merge pull request #262 from AndreaOrru/master |
Date: |
Sat, 7 Aug 2021 09:21:06 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 8e59a8a22693d14d97d76c0be1bf92ef2406030a
Merge: ad95d28 6d8c6fc
Author: Magnar Sveen <magnars@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #262 from AndreaOrru/master
mark-previous-like-this-word/symbol.
---
README.md | 2 ++
features/mark-more.feature | 16 ++++++++++
.../step-definitions/multiple-cursors-steps.el | 12 ++++++++
features/support/env.el | 2 ++
mc-mark-more.el | 36 ++++++++++++++++++++++
multiple-cursors-core.el | 2 ++
6 files changed, 70 insertions(+)
diff --git a/README.md b/README.md
index 10e7e4d..83a413f 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,8 @@ You can [watch an intro to multiple-cursors at Emacs
Rocks](http://emacsrocks.co
- `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.
+ - `mc/mark-previous-like-this-word`: Adds a cursor and region at the next
part of the buffer backwards that matches the current region, if no region is
selected it selects the word at the point.
+ - `mc/mark-previous-like-this-symbol`: Adds a cursor and region at the next
part of the buffer backwards that matches the current region, if no region is
selected it selects the symbol at the point.
- `mc/mark-previous-word-like-this`: Like `mc/mark-previous-like-this` but
only for whole words.
- `mc/mark-previous-symbol-like-this`: Like `mc/mark-previous-like-this` but
only for whole symbols.
- `mc/mark-more-like-this-extended`: Use arrow keys to quickly mark/skip
next/previous occurances.
diff --git a/features/mark-more.feature b/features/mark-more.feature
index d8d1025..f057678 100644
--- a/features/mark-more.feature
+++ b/features/mark-more.feature
@@ -14,6 +14,14 @@ Feature: Marking multiple parts of the buffer
And I type "sentence"
Then I should see "This sentence has the word sentence in it"
+ Scenario: Marking next like this, word
+ Given I turn on delete-selection-mode
+ When I insert "This text has the word text in it"
+ And I go to word "text"
+ And I press "C-S-c C->"
+ And I type "sentence"
+ Then I should see "This sentence has the word sentence in it"
+
Scenario: Skipping a mark
Given I turn on delete-selection-mode
When I insert "Here's text, text and text"
@@ -54,6 +62,14 @@ Feature: Marking multiple parts of the buffer
And I type "sentence"
Then I should see "This sentence has the word sentence in it"
+ Scenario: Marking prev like this, word
+ Given I turn on delete-selection-mode
+ When I insert "This text has the word text in it"
+ And I go to last word "text"
+ And I press "C-S-c C-<"
+ And I type "sentence"
+ Then I should see "This sentence has the word sentence in it"
+
Scenario: Skipping a prev mark
Given I turn on delete-selection-mode
When I insert "Here's text, text and text"
diff --git a/features/step-definitions/multiple-cursors-steps.el
b/features/step-definitions/multiple-cursors-steps.el
index b57bd03..2eb442e 100644
--- a/features/step-definitions/multiple-cursors-steps.el
+++ b/features/step-definitions/multiple-cursors-steps.el
@@ -12,6 +12,12 @@
(When "^I mark previous like this$"
(lambda () (call-interactively 'mc/mark-previous-like-this)))
+(When "^I mark previous like this word$"
+ (lambda () (call-interactively 'mc/mark-previous-like-this-word)))
+
+(When "^I mark previous like this symbol$"
+ (lambda () (call-interactively 'mc/mark-previous-like-this-symbol)))
+
(When "^I mark all like this$"
(lambda () (call-interactively 'mc/mark-all-like-this)))
@@ -144,6 +150,12 @@
(cl-assert search nil message word (espuds-buffer-contents))
(if (string-equal "front" pos) (backward-word)))))
+(When "^I go to last word \"\\(.+\\)\"$"
+ (lambda (text)
+ (goto-char (point-max))
+ (let ((search (re-search-backward text nil t)))
+ (cl-assert search nil "The text '%s' was not found in the current
buffer." text))))
+
(When "^I select the last \"\\(.+\\)\"$"
(lambda (text)
(goto-char (point-max))
diff --git a/features/support/env.el b/features/support/env.el
index 225c429..8410ca3 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -24,6 +24,8 @@
(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 "C-S-c C-<") 'mc/mark-previous-like-this-word)
+ (global-set-key (kbd "C-S-c M-<") 'mc/mark-previous-like-this-symbol)
(global-set-key (kbd "M-!") 'mc/mark-all-like-this)
(global-set-key (kbd "M-$") 'mc/mark-all-like-this-dwim)
(global-set-key (kbd "C-$") 'mc/mark-all-dwim)
diff --git a/mc-mark-more.el b/mc-mark-more.el
index 25f4ae3..27a84b7 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -226,6 +226,42 @@ With zero ARG, skip the last one and mark next."
(mc/maybe-multiple-cursors-mode))
;;;###autoload
+(defun mc/mark-previous-like-this-word (arg)
+ "Find and mark the previous part of the buffer matching the currently active
region
+If no region is active, mark the word at the point and find the previous match
+With negative ARG, delete the last one instead.
+With zero ARG, skip the last one and mark previous."
+ (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) 'backwards)
+ (mc--select-thing-at-point 'word)
+ (mc/mark-more-like-this (= arg 0) 'backwards)))
+ (mc/maybe-multiple-cursors-mode))
+
+(defun mc/mark-previous-like-this-symbol (arg)
+ "Find and mark the previous part of the buffer matching the currently active
region
+If no region is active, mark the symbol at the point and find the previous
match
+With negative ARG, delete the last one instead.
+With zero ARG, skip the last one and mark previous."
+ (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) 'backwards)
+ (mc--select-thing-at-point 'symbol)
+ (mc/mark-more-like-this (= arg 0) 'backwards)))
+ (mc/maybe-multiple-cursors-mode))
+
+
+;;;###autoload
(defun mc/mark-previous-word-like-this (arg)
"Find and mark the previous part of the buffer matching the currently active
region
The matching region must be a whole word to be a match
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 558b724..5e9ed76 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -621,6 +621,8 @@ for running commands with multiple cursors.")
mc/mark-next-word-like-this
mc/mark-next-symbol-like-this
mc/mark-previous-like-this
+ mc/mark-previous-like-this-word
+ mc/mark-previous-like-this-symbol
mc/mark-previous-word-like-this
mc/mark-previous-symbol-like-this
mc/mark-all-like-this
- [nongnu] elpa/multiple-cursors 82586a0 321/434: Consolidate contributor entries for Aleksey, (continued)
- [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, 2021/08/07
- [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 <=
- [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
- [nongnu] elpa/multiple-cursors b39e963 425/434: Faster line-number-at-pos calculation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors cb7a145 210/434: Release 1.2.0, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 25dd14d 219/434: Add more scenarios for mark-all-*-like-this, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors cc45842 241/434: Improved mc/mark-more-like-this-extended, ELPA Syncer, 2021/08/07