diff --git a/.gitignore b/.gitignore index 6d7875c..056d1bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ elpa *.elc +/.ecukes-failing-scenarios diff --git a/README.md b/README.md index 3efcbe4..8516da5 100644 --- a/README.md +++ b/README.md @@ -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 Keywords: editing cursors diff --git a/features/insert-numbers.feature b/features/insert-numbers.feature index 59db91f..191150e 100644 --- a/features/insert-numbers.feature +++ b/features/insert-numbers.feature @@ -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)" diff --git a/mc-cycle-cursors.el b/mc-cycle-cursors.el index 01597ac..85af352 100644 --- a/mc-cycle-cursors.el +++ b/mc-cycle-cursors.el @@ -1,6 +1,6 @@ ;;; mc-cycle-cursors.el -;; Copyright (C) 2012 Magnar Sveen +;; Copyright (C) 2012-2016 Magnar Sveen ;; Author: Magnar Sveen ;; Keywords: editing cursors diff --git a/mc-edit-lines.el b/mc-edit-lines.el index 20668cf..e38d1c1 100644 --- a/mc-edit-lines.el +++ b/mc-edit-lines.el @@ -1,6 +1,6 @@ ;;; mc-edit-lines.el -;; Copyright (C) 2012 Magnar Sveen +;; Copyright (C) 2012-2016 Magnar Sveen ;; Author: Magnar Sveen ;; Keywords: editing cursors diff --git a/mc-mark-more.el b/mc-mark-more.el index be4f1d9..25f4ae3 100644 --- a/mc-mark-more.el +++ b/mc-mark-more.el @@ -1,6 +1,6 @@ ;;; mc-mark-more.el -;; Copyright (C) 2012 Magnar Sveen +;; Copyright (C) 2012-2016 Magnar Sveen ;; Author: Magnar Sveen ;; 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))) diff --git a/mc-separate-operations.el b/mc-separate-operations.el index 487a650..ca10775 100644 --- a/mc-separate-operations.el +++ b/mc-separate-operations.el @@ -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 ;; 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 () diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el index 1b933aa..b48e88c 100644 --- a/multiple-cursors-core.el +++ b/multiple-cursors-core.el @@ -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 ;; Keywords: editing cursors diff --git a/multiple-cursors.el b/multiple-cursors.el index 675cf38..4a05dcc 100644 --- a/multiple-cursors.el +++ b/multiple-cursors.el @@ -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 -;; Version: 1.2.2 +;; Version: 1.4.0 ;; Keywords: editing cursors ;; This program is free software; you can redistribute it and/or modify diff --git a/rectangular-region-mode.el b/rectangular-region-mode.el index 8cbe1de..01a078d 100644 --- a/rectangular-region-mode.el +++ b/rectangular-region-mode.el @@ -1,6 +1,6 @@ ;;; rectangular-region-mode.el -;; Copyright (C) 2012 Magnar Sveen +;; Copyright (C) 2012-2016 Magnar Sveen ;; Author: Magnar Sveen ;; Keywords: editing cursors