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

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

[nongnu] elpa/anzu d3650160d7 161/288: Don't search if input regexp is n


From: ELPA Syncer
Subject: [nongnu] elpa/anzu d3650160d7 161/288: Don't search if input regexp is not valid yet.
Date: Thu, 6 Jan 2022 03:58:49 -0500 (EST)

branch: elpa/anzu
commit d3650160d72cacd716dee4e626258b895bc1cc86
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>

    Don't search if input regexp is not valid yet.
    
    Input regexp may be invalid when users are inputting it.
---
 anzu.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/anzu.el b/anzu.el
index 53a0278239..8b078e5dd9 100644
--- a/anzu.el
+++ b/anzu.el
@@ -355,13 +355,14 @@
 
 (defun anzu--search-outside-visible (buf input beg end use-regexp)
   (let ((searchfn (if use-regexp 're-search-forward 'search-forward)))
-    (with-selected-window (get-buffer-window buf)
-      (goto-char beg)
-      (when (funcall searchfn input end t)
-        (setq anzu--outside-point (match-beginning 0))
-        (let ((overlay-limit (anzu--overlay-limit)))
-          (anzu--count-and-highlight-matched buf input beg end use-regexp
-                                             overlay-limit nil))))))
+    (when (or (not use-regexp) (anzu--validate-regexp input))
+      (with-selected-window (get-buffer-window buf)
+        (goto-char beg)
+        (when (funcall searchfn input end t)
+          (setq anzu--outside-point (match-beginning 0))
+          (let ((overlay-limit (anzu--overlay-limit)))
+            (anzu--count-and-highlight-matched buf input beg end use-regexp
+                                               overlay-limit nil)))))))
 
 (defun anzu--check-minibuffer-input (buf beg end use-regexp overlay-limit)
   (let* ((content (minibuffer-contents))



reply via email to

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