branch: externals/orderless
commit 1f1e0380e2a8cd4fc29b8cc2e00cb01b56d86fbc
Author: Omar Antolín <[email protected]>
Commit: Omar Antolín <[email protected]>
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