emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/multiple-cursors 68dfa46 271/434: Merge pull request #109


From: ELPA Syncer
Subject: [nongnu] elpa/multiple-cursors 68dfa46 271/434: Merge pull request #109 from mathrick/fix-mark-all-in-region-hang
Date: Sat, 7 Aug 2021 09:20:40 -0400 (EDT)

branch: elpa/multiple-cursors
commit 68dfa461f1fe2ad45728f8631d8492139a6c203b
Merge: d8c5227 a86daa7
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>

    Merge pull request #109 from mathrick/fix-mark-all-in-region-hang
    
    Guard against empty search pattern in 'mc/mark-all-in-region', otherwise...
---
 mc-mark-more.el | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/mc-mark-more.el b/mc-mark-more.el
index 7e240a1..627b401 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -268,18 +268,21 @@ With zero ARG, skip the last one and mark next."
   (interactive "r")
   (let ((search (read-from-minibuffer "Mark all in region: "))
         (case-fold-search nil))
-    (mc/remove-fake-cursors)
-    (goto-char beg)
-    (while (search-forward search end t)
-      (push-mark (match-beginning 0))
-      (mc/create-fake-cursor-at-point))
-    (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)))
+    (if (string= search "")
+        (message "Mark aborted")
+      (progn
+        (mc/remove-fake-cursors)
+        (goto-char beg)
+        (while (search-forward search end t)
+          (push-mark (match-beginning 0))
+          (mc/create-fake-cursor-at-point))
+        (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))))))
 
 (when (not (fboundp 'set-temporary-overlay-map))
   ;; Backport this function from newer emacs versions



reply via email to

[Prev in Thread] Current Thread [Next in Thread]