Show appropriate error messages on trying skipping/unmarking commands with no fake cursors

This commit is contained in:
Kouhei Yanagita 2014-01-03 13:00:13 +09:00
parent 75ece6884b
commit 00aea4c9d7

View File

@ -107,6 +107,8 @@ Use like case-fold-search, don't recommend setting it globally.")
(match-point-getter (ecase direction
(forwards 'match-beginning)
(backwards 'match-end))))
(if (and skip-last (not furthest-cursor))
(error "No cursors to be skipped")
(mc/save-excursion
(goto-char start-char)
(when skip-last
@ -117,7 +119,7 @@ Use like case-fold-search, don't recommend setting it globally.")
(when point-out-of-order
(exchange-point-and-mark))
(mc/create-fake-cursor-at-point))
(error "no more matches found.")))))
(error "no more matches found."))))))
;;;###autoload
(defun mc/mark-next-like-this (arg)
@ -127,7 +129,10 @@ With zero ARG, skip the last one and mark next."
(interactive "p")
(if (region-active-p)
(if (< arg 0)
(mc/remove-fake-cursor (mc/furthest-cursor-after-point))
(let ((cursor (mc/furthest-cursor-after-point)))
(if cursor
(mc/remove-fake-cursor cursor)
(error "No cursors to be unmarked")))
(mc/mark-more-like-this (= arg 0) 'forwards))
(mc/mark-lines arg 'forwards))
(mc/maybe-multiple-cursors-mode))
@ -152,7 +157,10 @@ With zero ARG, skip the last one and mark next."
(interactive "p")
(if (region-active-p)
(if (< arg 0)
(mc/remove-fake-cursor (mc/furthest-cursor-before-point))
(let ((cursor (mc/furthest-cursor-before-point)))
(if cursor
(mc/remove-fake-cursor cursor)
(error "No cursors to be unmarked")))
(mc/mark-more-like-this (= arg 0) 'backwards))
(mc/mark-lines arg 'backwards))
(mc/maybe-multiple-cursors-mode))