Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bb2020 2016-06-09 22:45:19 +03:00
commit 2329611a41
10 changed files with 67 additions and 16 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
elpa
*.elc
/.ecukes-failing-scenarios

View File

@ -8,8 +8,7 @@ great success and much merriment.
I highly recommend installing multiple-cursors through `package.el`.
It's available on [marmalade](http://marmalade-repo.org/) and
[melpa](http://melpa.milkbox.net/):
It's available on [MELPA](http://melpa.org/) and [MELPA Stable](http://stable.melpa.org):
M-x package-install multiple-cursors
@ -204,7 +203,7 @@ Thanks!
## License
Copyright (C) 2012 Magnar Sveen
Copyright (C) 2012-2016 Magnar Sveen
Author: Magnar Sveen <magnars@gmail.com>
Keywords: editing cursors

View File

@ -17,3 +17,24 @@ Feature: Insert increasing numbers
When I press "C-u H-0"
And I press "SPC"
Then I should see "This 4 text contains the word 5 text thrice (6 text)"
Scenario: Three cursors, 0-1-2, default
Given I have cursors at "text" in "This text contains the word text thrice (text)"
When I set mc/insert-numbers-default to 1
And I press "H-0"
And I press "SPC"
Then I should see "This 1 text contains the word 2 text thrice (3 text)"
Scenario: Three cursors, 9-10-11, default
Given I have cursors at "text" in "This text contains the word text thrice (text)"
When I set mc/insert-numbers-default to 1
And I press "C-9 H-0"
And I press "SPC"
Then I should see "This 9 text contains the word 10 text thrice (11 text)"
Scenario: Three cursors, 9-10-11, default
Given I have cursors at "text" in "This text contains the word text thrice (text)"
When I set mc/insert-numbers-default to 1
And I press "C-u H-0"
And I press "SPC"
Then I should see "This 4 text contains the word 5 text thrice (6 text)"

View File

@ -1,6 +1,6 @@
;;; mc-cycle-cursors.el
;; Copyright (C) 2012 Magnar Sveen
;; Copyright (C) 2012-2016 Magnar Sveen
;; Author: Magnar Sveen <magnars@gmail.com>
;; Keywords: editing cursors

View File

@ -1,6 +1,6 @@
;;; mc-edit-lines.el
;; Copyright (C) 2012 Magnar Sveen
;; Copyright (C) 2012-2016 Magnar Sveen
;; Author: Magnar Sveen <magnars@gmail.com>
;; Keywords: editing cursors

View File

@ -1,6 +1,6 @@
;;; mc-mark-more.el
;; Copyright (C) 2012 Magnar Sveen
;; Copyright (C) 2012-2016 Magnar Sveen
;; Author: Magnar Sveen <magnars@gmail.com>
;; Keywords: editing cursors
@ -188,12 +188,22 @@ With zero ARG, skip the last one and mark next."
;;;###autoload
(defun mc/mark-next-word-like-this (arg)
"Find and mark the next word of the buffer matching the currently active region
The matching region must be a whole word to be a match
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")
(let ((mc/enclose-search-term 'words))
(mc/mark-next-like-this arg)))
;;;###autoload
(defun mc/mark-next-symbol-like-this (arg)
"Find and mark the next symbol of the buffer matching the currently active region
The matching region must be a whole symbol to be a match
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")
(let ((mc/enclose-search-term 'symbols))
(mc/mark-next-like-this arg)))
@ -201,6 +211,7 @@ With zero ARG, skip the last one and mark next."
;;;###autoload
(defun mc/mark-previous-like-this (arg)
"Find and mark the previous part of the buffer matching the currently active region
If no region is active add a cursor on the previous line
With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next."
(interactive "p")
@ -216,24 +227,36 @@ With zero ARG, skip the last one and mark next."
;;;###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
If no region is active add a cursor on the previous line
With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next."
(interactive "p")
(let ((mc/enclose-search-term 'words))
(mc/mark-previous-like-this arg)))
;;;###autoload
(defun mc/mark-previous-symbol-like-this (arg)
"Find and mark the previous part of the buffer matching the currently active region
The matching region must be a whole symbol to be a match
If no region is active add a cursor on the previous line
With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next."
(interactive "p")
(let ((mc/enclose-search-term 'symbols))
(mc/mark-previous-like-this arg)))
(defun mc/mark-lines (num-lines direction)
(dotimes (i num-lines)
(dotimes (i (if (= num-lines 0) 1 num-lines))
(mc/save-excursion
(let ((furthest-cursor (cl-ecase direction
(forwards (mc/furthest-cursor-after-point))
(backwards (mc/furthest-cursor-before-point)))))
(if (overlayp furthest-cursor)
(goto-char (overlay-get furthest-cursor 'point))))
(when (overlayp furthest-cursor)
(goto-char (overlay-get furthest-cursor 'point))
(when (= num-lines 0)
(mc/remove-fake-cursor furthest-cursor))))
(cl-ecase direction
(forwards (next-logical-line 1 nil))
(backwards (previous-logical-line 1 nil)))

View File

@ -1,6 +1,6 @@
;;; mc-separate-operations.el - functions that work differently on each cursor
;; Copyright (C) 2012 Magnar Sveen
;; Copyright (C) 2012-2016 Magnar Sveen
;; Author: Magnar Sveen <magnars@gmail.com>
;; Keywords: editing cursors
@ -31,13 +31,20 @@
;;;###autoload
(defun mc/insert-numbers (arg)
"Insert increasing numbers for each cursor, starting at 0 or ARG."
"Insert increasing numbers for each cursor, starting at
`mc/insert-numbers-default' or ARG."
(interactive "P")
(setq mc--insert-numbers-number (or (and arg (prefix-numeric-value arg))
0))
mc/insert-numbers-default))
(mc/for-each-cursor-ordered
(mc/execute-command-for-fake-cursor 'mc--insert-number-and-increase cursor)))
(defcustom mc/insert-numbers-default 0
"The default number at which to start counting for
`mc/insert-numbers'"
:type 'integer
:group 'multiple-cursors)
(defvar mc--insert-numbers-number 0)
(defun mc--insert-number-and-increase ()

View File

@ -1,6 +1,6 @@
;;; multiple-cursors-core.el --- An experiment in multiple cursors for emacs.
;; Copyright (C) 2012 Magnar Sveen
;; Copyright (C) 2012-2016 Magnar Sveen
;; Author: Magnar Sveen <magnars@gmail.com>
;; Keywords: editing cursors

View File

@ -1,9 +1,9 @@
;;; multiple-cursors.el --- Multiple cursors for emacs.
;; Copyright (C) 2012-2013 Magnar Sveen
;; Copyright (C) 2012-2016 Magnar Sveen
;; Author: Magnar Sveen <magnars@gmail.com>
;; Version: 1.2.2
;; Version: 1.4.0
;; Keywords: editing cursors
;; This program is free software; you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
;;; rectangular-region-mode.el
;; Copyright (C) 2012 Magnar Sveen
;; Copyright (C) 2012-2016 Magnar Sveen
;; Author: Magnar Sveen <magnars@gmail.com>
;; Keywords: editing cursors