Unrevert "Support unmarking with no region. Change mc/mark-lines to preserve point."

This reverts commit 2588ccef6939b77896105f23642483c30c4a4e06.
This commit is contained in:
Justin Dove 2015-06-08 09:20:46 -04:00
parent 49c9f7f6bf
commit 5d677f765c

View File

@ -127,14 +127,14 @@ Use like case-fold-search, don't recommend setting it globally.")
With negative ARG, delete the last one instead. With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next." With zero ARG, skip the last one and mark next."
(interactive "p") (interactive "p")
(if (region-active-p)
(if (< arg 0) (if (< arg 0)
(let ((cursor (mc/furthest-cursor-after-point))) (let ((cursor (mc/furthest-cursor-after-point)))
(if cursor (if cursor
(mc/remove-fake-cursor cursor) (mc/remove-fake-cursor cursor)
(error "No cursors to be unmarked"))) (error "No cursors to be unmarked")))
(mc/mark-more-like-this (= arg 0) 'forwards)) (if (region-active-p)
(mc/mark-lines arg 'forwards)) (mc/mark-more-like-this (= arg 0) 'forwards)
(mc/mark-lines arg 'forwards)))
(mc/maybe-multiple-cursors-mode)) (mc/maybe-multiple-cursors-mode))
;;;###autoload ;;;###autoload
@ -155,14 +155,14 @@ With zero ARG, skip the last one and mark next."
With negative ARG, delete the last one instead. With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next." With zero ARG, skip the last one and mark next."
(interactive "p") (interactive "p")
(if (region-active-p)
(if (< arg 0) (if (< arg 0)
(let ((cursor (mc/furthest-cursor-before-point))) (let ((cursor (mc/furthest-cursor-before-point)))
(if cursor (if cursor
(mc/remove-fake-cursor cursor) (mc/remove-fake-cursor cursor)
(error "No cursors to be unmarked"))) (error "No cursors to be unmarked")))
(mc/mark-more-like-this (= arg 0) 'backwards)) (if (region-active-p)
(mc/mark-lines arg 'backwards)) (mc/mark-more-like-this (= arg 0) 'backwards)
(mc/mark-lines arg 'backwards)))
(mc/maybe-multiple-cursors-mode)) (mc/maybe-multiple-cursors-mode))
;;;###autoload ;;;###autoload
@ -179,12 +179,16 @@ With zero ARG, skip the last one and mark next."
(defun mc/mark-lines (num-lines direction) (defun mc/mark-lines (num-lines direction)
(dotimes (i num-lines) (dotimes (i num-lines)
(mc/create-fake-cursor-at-point) (mc/save-excursion
(let ((furthest-cursor (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))))
(ecase direction (ecase direction
(forwards (loop do (next-logical-line 1 nil) (forwards (next-logical-line 1 nil))
while (mc/all-fake-cursors (point) (1+ (point))))) (backwards (previous-logical-line 1 nil)))
(backwards (loop do (previous-logical-line 1 nil) (mc/create-fake-cursor-at-point))))
while (mc/all-fake-cursors (point) (1+ (point))))))))
;;;###autoload ;;;###autoload
(defun mc/mark-next-lines (arg) (defun mc/mark-next-lines (arg)