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

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

[elpa] externals/orderless 1f1e0380e2 122/204: Test for match before hig


From: ELPA Syncer
Subject: [elpa] externals/orderless 1f1e0380e2 122/204: Test for match before highlighting it
Date: Tue, 11 Jan 2022 12:58:23 -0500 (EST)

branch: externals/orderless
commit 1f1e0380e2a8cd4fc29b8cc2e00cb01b56d86fbc
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>

    Test for match before highlighting it
    
    I wasn't checking for the matches before highlighting them assuming
    that the regexps would indeed always match, but it turns out
    incomplete TRAMP paths can sometimes violate that assumption.
---
 orderless.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/orderless.el b/orderless.el
index 977651a83d..6fbf12a2fc 100644
--- a/orderless.el
+++ b/orderless.el
@@ -310,11 +310,10 @@ at a word boundary in the candidate.  This is similar to 
the
 ;;; Highlighting matches
 
 (defun orderless--highlight (regexps string)
-  "Propertize STRING to highlight a match of each of the REGEXPS.
-Warning: only use this if you know all REGEXPs match!"
+  "Propertize STRING to highlight a match of each of the REGEXPS."
   (cl-loop with n = (length orderless-match-faces)
-           for regexp in regexps and i from 0 do
-           (string-match regexp string)
+           for regexp in regexps and i from 0
+           when (string-match regexp string) do
            (cl-loop
             for (x y) on (or (cddr (match-data)) (match-data)) by #'cddr
             when x do



reply via email to

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