mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 21:03:05 +00:00
Merge pull request #122 from kyanagi/appropriate-error-messages-when-no-fake-cursors-exist
Show appropriate error messages on trying skipping/unmarking commands with no fake cursors
This commit is contained in:
commit
3cfae1dac2
@ -107,17 +107,19 @@ Use like case-fold-search, don't recommend setting it globally.")
|
|||||||
(match-point-getter (ecase direction
|
(match-point-getter (ecase direction
|
||||||
(forwards 'match-beginning)
|
(forwards 'match-beginning)
|
||||||
(backwards 'match-end))))
|
(backwards 'match-end))))
|
||||||
(mc/save-excursion
|
(if (and skip-last (not furthest-cursor))
|
||||||
(goto-char start-char)
|
(error "No cursors to be skipped")
|
||||||
(when skip-last
|
(mc/save-excursion
|
||||||
(mc/remove-fake-cursor furthest-cursor))
|
(goto-char start-char)
|
||||||
(if (funcall search-function re nil t)
|
(when skip-last
|
||||||
(progn
|
(mc/remove-fake-cursor furthest-cursor))
|
||||||
(push-mark (funcall match-point-getter 0))
|
(if (funcall search-function re nil t)
|
||||||
(when point-out-of-order
|
(progn
|
||||||
(exchange-point-and-mark))
|
(push-mark (funcall match-point-getter 0))
|
||||||
(mc/create-fake-cursor-at-point))
|
(when point-out-of-order
|
||||||
(error "no more matches found.")))))
|
(exchange-point-and-mark))
|
||||||
|
(mc/create-fake-cursor-at-point))
|
||||||
|
(error "no more matches found."))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-next-like-this (arg)
|
(defun mc/mark-next-like-this (arg)
|
||||||
@ -127,7 +129,10 @@ With zero ARG, skip the last one and mark next."
|
|||||||
(interactive "p")
|
(interactive "p")
|
||||||
(if (region-active-p)
|
(if (region-active-p)
|
||||||
(if (< arg 0)
|
(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-more-like-this (= arg 0) 'forwards))
|
||||||
(mc/mark-lines arg 'forwards))
|
(mc/mark-lines arg 'forwards))
|
||||||
(mc/maybe-multiple-cursors-mode))
|
(mc/maybe-multiple-cursors-mode))
|
||||||
@ -152,7 +157,10 @@ With zero ARG, skip the last one and mark next."
|
|||||||
(interactive "p")
|
(interactive "p")
|
||||||
(if (region-active-p)
|
(if (region-active-p)
|
||||||
(if (< arg 0)
|
(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-more-like-this (= arg 0) 'backwards))
|
||||||
(mc/mark-lines arg 'backwards))
|
(mc/mark-lines arg 'backwards))
|
||||||
(mc/maybe-multiple-cursors-mode))
|
(mc/maybe-multiple-cursors-mode))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user