mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 21:03:05 +00:00
Merge pull request #109 from mathrick/fix-mark-all-in-region-hang
Guard against empty search pattern in 'mc/mark-all-in-region', otherwise...
This commit is contained in:
commit
68dfa461f1
@ -268,6 +268,9 @@ With zero ARG, skip the last one and mark next."
|
|||||||
(interactive "r")
|
(interactive "r")
|
||||||
(let ((search (read-from-minibuffer "Mark all in region: "))
|
(let ((search (read-from-minibuffer "Mark all in region: "))
|
||||||
(case-fold-search nil))
|
(case-fold-search nil))
|
||||||
|
(if (string= search "")
|
||||||
|
(message "Mark aborted")
|
||||||
|
(progn
|
||||||
(mc/remove-fake-cursors)
|
(mc/remove-fake-cursors)
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
(while (search-forward search end t)
|
(while (search-forward search end t)
|
||||||
@ -276,10 +279,10 @@ With zero ARG, skip the last one and mark next."
|
|||||||
(let ((first (mc/furthest-cursor-before-point)))
|
(let ((first (mc/furthest-cursor-before-point)))
|
||||||
(if (not first)
|
(if (not first)
|
||||||
(error "Search failed for %S" search)
|
(error "Search failed for %S" search)
|
||||||
(mc/pop-state-from-overlay first))))
|
(mc/pop-state-from-overlay first)))
|
||||||
(if (> (mc/num-cursors) 1)
|
(if (> (mc/num-cursors) 1)
|
||||||
(multiple-cursors-mode 1)
|
(multiple-cursors-mode 1)
|
||||||
(multiple-cursors-mode 0)))
|
(multiple-cursors-mode 0))))))
|
||||||
|
|
||||||
(when (not (fboundp 'set-temporary-overlay-map))
|
(when (not (fboundp 'set-temporary-overlay-map))
|
||||||
;; Backport this function from newer emacs versions
|
;; Backport this function from newer emacs versions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user