From 7cb18b8aec7206e7b610069ae42e76bc1fb1be30 Mon Sep 17 00:00:00 2001 From: Josh Hunsaker Date: Thu, 29 Jun 2017 16:30:04 -0700 Subject: [PATCH] Fix bug in mc/mark-all-in-region-regexp. Fixes #293 --- mc-mark-more.el | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mc-mark-more.el b/mc-mark-more.el index 27a84b7..2ab7ec7 100644 --- a/mc-mark-more.el +++ b/mc-mark-more.el @@ -423,16 +423,13 @@ With zero ARG, skip the last one and mark next." (setq lastmatch (point)) (when (= (point) (match-beginning 0)) (forward-char))) - (when lastmatch (goto-char lastmatch))) - (when (> (mc/num-cursors) 0) - (goto-char (match-end 0))) - (let ((first (mc/furthest-cursor-before-point))) - (if (not first) - (error "Search failed for %S" search) - (mc/pop-state-from-overlay first))) - (if (> (mc/num-cursors) 1) - (multiple-cursors-mode 1) - (multiple-cursors-mode 0)))))) + (unless lastmatch + (error "Search failed for %S" search))) + (goto-char (match-end 0)) + (if (< (mc/num-cursors) 3) + (multiple-cursors-mode 0) + (mc/pop-state-from-overlay (mc/furthest-cursor-before-point)) + (multiple-cursors-mode 1)))))) (when (not (fboundp 'set-temporary-overlay-map)) ;; Backport this function from newer emacs versions