mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2026-05-10 09:28:18 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 20e692ae03 | |||
| de3306066a |
@@ -69,7 +69,7 @@ You can [watch an intro to multiple-cursors at Emacs Rocks](http://emacsrocks.co
|
||||
- `mc/mark-all-like-this-in-defun`: Marks all parts of the current defun that matches the current region.
|
||||
- `mc/mark-all-words-like-this-in-defun`: Like `mc/mark-all-like-this-in-defun` but only for whole words.
|
||||
- `mc/mark-all-symbols-like-this-in-defun`: Like `mc/mark-all-like-this-in-defun` but only for whole symbols.
|
||||
- `mc/mark-all-dwim`: Tries to be smart about marking everything you want. Can be pressed multiple times.
|
||||
- `mc/mark-all-like-this-dwim`: Tries to be smart about marking everything you want. Can be pressed multiple times.
|
||||
|
||||
### Special
|
||||
|
||||
@@ -136,7 +136,7 @@ the location with:
|
||||
## Known limitations
|
||||
|
||||
* isearch-forward and isearch-backward aren't supported with multiple cursors.
|
||||
If you want this functionality, you can use [phi-search](https://github.com/zk-phi/phi-search).
|
||||
You should feel free to add a simplified version that can work with it.
|
||||
* Commands run with `M-x` won't be repeated for all cursors.
|
||||
* All key bindings that refer to lambdas are always run for all cursors. If you
|
||||
need to limit it, you will have to give it a name.
|
||||
@@ -170,7 +170,6 @@ Run the tests with:
|
||||
* [Ivan Andrus](https://github.com/gvol) added showing number of cursors in mode-line
|
||||
* [Fuco](https://github.com/Fuco1) added the first version of `mc/mark-all-like-this-dwim`
|
||||
* [Zach Kost-Smith](https://github.com/smithzvk) added `mc/mark-pop`
|
||||
* [Maciej Katafiasz](https://github.com/mathrick) added `mc/mark-all-dwim`
|
||||
|
||||
Thanks!
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
Feature: Mark all do-what-I-mean
|
||||
|
||||
Background:
|
||||
Scenario: Mark symbols in defun
|
||||
Given I turn on emacs-lisp-mode
|
||||
And I turn on delete-selection-mode
|
||||
And I insert:
|
||||
"""
|
||||
(defun abc (ghi) (message ghi))
|
||||
(defun def (ghi) (message some-other-ghi))
|
||||
|
||||
"""
|
||||
|
||||
Scenario: Mark symbols in defun
|
||||
When I go to the end of the word "abc"
|
||||
And I press "M-f"
|
||||
And I press "M-$"
|
||||
@@ -20,71 +17,22 @@ Feature: Mark all do-what-I-mean
|
||||
(defun abc (hmm) (message hmm))
|
||||
(defun def (ghi) (message some-other-ghi))
|
||||
"""
|
||||
When I press "C-g"
|
||||
And I go to the front of the word "hmm"
|
||||
And I press "C-$"
|
||||
And I type "foo"
|
||||
Then I should see:
|
||||
"""
|
||||
(defun abc (foo) (message foo))
|
||||
(defun def (ghi) (message some-other-ghi))
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Mark all symbols by pressing twice
|
||||
When I go to the end of the word "abc"
|
||||
And I press "M-f"
|
||||
And I press "M-$"
|
||||
And I press "M-$"
|
||||
And I type "hmm"
|
||||
Then I should see:
|
||||
"""
|
||||
(defun abc (hmm) (message hmm))
|
||||
(defun def (hmm) (message some-other-hmm))
|
||||
"""
|
||||
When I press "C-g"
|
||||
And I press "M->"
|
||||
Given I turn on emacs-lisp-mode
|
||||
And I turn on delete-selection-mode
|
||||
And I insert:
|
||||
"""
|
||||
(defun def (hmm-hmm) (message hmm))
|
||||
(defun abc (ghi) (message ghi))
|
||||
(defun def (ghi) (message ghi))
|
||||
"""
|
||||
And I go to the front of the word "hmm"
|
||||
And I press "C-$"
|
||||
And I press "C-$"
|
||||
And I type "humm"
|
||||
When I go to the end of the word "abc"
|
||||
And I press "M-f"
|
||||
And I press "M-$"
|
||||
And I press "M-$"
|
||||
And I type "hmm"
|
||||
Then I should see:
|
||||
"""
|
||||
(defun abc (humm) (message humm))
|
||||
(defun def (humm) (message some-other-humm))
|
||||
(defun def (humm-humm) (message humm))
|
||||
"""
|
||||
|
||||
Scenario: Mark dwim from selection
|
||||
When I press "M-<"
|
||||
And I press "S-M->"
|
||||
And I press "C-$ ghi RET"
|
||||
And I type "xyz"
|
||||
Then I should see:
|
||||
"""
|
||||
(defun abc (xyz) (message xyz))
|
||||
(defun def (xyz) (message some-other-xyz))
|
||||
"""
|
||||
When I press "C-g"
|
||||
And I go to the front of the word "xyz"
|
||||
And I press "C-M-SPC"
|
||||
And I press "C-$"
|
||||
And I type "foo"
|
||||
Then I should see:
|
||||
"""
|
||||
(defun abc (foo) (message foo))
|
||||
(defun def (xyz) (message some-other-xyz))
|
||||
"""
|
||||
When I press "C-g"
|
||||
And I press "M-<"
|
||||
And I press "S-M->"
|
||||
And I press "C-u C-$"
|
||||
And I type ";;"
|
||||
Then I should see:
|
||||
"""
|
||||
;;(defun abc (foo) (message foo))
|
||||
;;(defun def (xyz) (message some-other-xyz))
|
||||
(defun abc (hmm) (message hmm))
|
||||
(defun def (hmm) (message hmm))
|
||||
"""
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
(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)
|
||||
(global-set-key (kbd "C-$") 'mc/mark-all-dwim)
|
||||
(global-set-key (kbd "M-#") 'mc/mark-all-in-region)
|
||||
(global-set-key (kbd "H-0") 'mc/insert-numbers)
|
||||
(global-set-key (kbd "H-1") 'mc/reverse-regions)
|
||||
|
||||
+14
-38
@@ -173,9 +173,9 @@ With zero ARG, skip the last one and mark next."
|
||||
(dotimes (i num-lines)
|
||||
(mc/create-fake-cursor-at-point)
|
||||
(ecase direction
|
||||
(forwards (loop do (next-logical-line 1 nil)
|
||||
(forwards (loop do (next-line 1 nil)
|
||||
while (mc/all-fake-cursors (point) (1+ (point)))))
|
||||
(backwards (loop do (previous-logical-line 1 nil)
|
||||
(backwards (loop do (previous-line 1 nil)
|
||||
while (mc/all-fake-cursors (point) (1+ (point))))))))
|
||||
|
||||
;;;###autoload
|
||||
@@ -268,21 +268,18 @@ With zero ARG, skip the last one and mark next."
|
||||
(interactive "r")
|
||||
(let ((search (read-from-minibuffer "Mark all in region: "))
|
||||
(case-fold-search nil))
|
||||
(if (string= search "")
|
||||
(message "Mark aborted")
|
||||
(progn
|
||||
(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))))))
|
||||
(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)))
|
||||
|
||||
(when (not (fboundp 'set-temporary-overlay-map))
|
||||
;; Backport this function from newer emacs versions
|
||||
@@ -419,27 +416,6 @@ With prefix, it behaves the same as original `mc/mark-all-like-this'"
|
||||
(when (<= (mc/num-cursors) before)
|
||||
(mc/mark-all-like-this))))))
|
||||
|
||||
(defun mc/mark-all-dwim (arg)
|
||||
"Tries even harder to guess what you want to mark all of.
|
||||
|
||||
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
|
||||
`mc/mark-all-like-this-dwim'."
|
||||
(interactive "P")
|
||||
(if (and (use-region-p)
|
||||
(not (> (mc/num-cursors) 1))
|
||||
(not (= (line-number-at-pos (region-beginning))
|
||||
(line-number-at-pos (region-end)))))
|
||||
(if arg
|
||||
(call-interactively 'mc/edit-lines)
|
||||
(call-interactively 'mc/mark-all-in-region))
|
||||
(progn
|
||||
(setq this-command 'mc/mark-all-like-this-dwim)
|
||||
(mc/mark-all-like-this-dwim arg))))
|
||||
|
||||
(defun mc--in-defun ()
|
||||
(bounds-of-thing-at-point 'defun))
|
||||
|
||||
|
||||
+3
-2
@@ -4,8 +4,9 @@
|
||||
|
||||
;;;###autoload
|
||||
(defun mc/mark-pop ()
|
||||
"Add a cursor at the current point, pop off mark ring and jump
|
||||
to the popped mark."
|
||||
"Add one cursor to each line of the active region.
|
||||
Starts from mark and moves in straight down or up towards the
|
||||
line point is on."
|
||||
(interactive)
|
||||
;; If the mark happens to be at the current point, just pop that one off.
|
||||
(while (eql (mark) (point))
|
||||
|
||||
@@ -573,7 +573,6 @@ for running commands with multiple cursors.")
|
||||
mc/mark-all-words-like-this-in-defun
|
||||
mc/mark-all-symbols-like-this-in-defun
|
||||
mc/mark-all-like-this-dwim
|
||||
mc/mark-all-dwim
|
||||
mc/mark-sgml-tag-pair
|
||||
mc/insert-numbers
|
||||
mc/sort-regions
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
(define-package "multiple-cursors" "1.3.0"
|
||||
(define-package "multiple-cursors" "1.2.3"
|
||||
"Multiple cursors for Emacs.")
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
#!/bin/sh -e
|
||||
cask exec ecukes "$@" --no-win
|
||||
cask exec ecukes "$@"
|
||||
|
||||
Reference in New Issue
Block a user