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

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

[nongnu] elpa/swift-mode 5597eaf 467/496: Avoid max-lisp-eval-depth in f


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode 5597eaf 467/496: Avoid max-lisp-eval-depth in font-lock-match-expr
Date: Sun, 29 Aug 2021 11:34:29 -0400 (EDT)

branch: elpa/swift-mode
commit 5597eafa55934c67185e627c362663753f695865
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>

    Avoid max-lisp-eval-depth in font-lock-match-expr
---
 swift-mode-font-lock.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/swift-mode-font-lock.el b/swift-mode-font-lock.el
index 4a07158..c0a6320 100644
--- a/swift-mode-font-lock.el
+++ b/swift-mode-font-lock.el
@@ -358,14 +358,16 @@ Return nil otherwise.
 The predicate MATCH-P is called with two arguments:
 - the position of the identifier, and
 - the limit of search functions."
-  (and
-   (< (point) limit)
-   (re-search-forward "\\<\\(\\sw\\|\\s_\\)+\\>" limit t)
-   (or
-    (save-excursion
-      (save-match-data
-        (funcall match-p (match-beginning 0) limit)))
-    (swift-mode:font-lock-match-expr limit match-p))))
+  (let ((result nil))
+    (while (and
+            (< (point) limit)
+            (re-search-forward "\\<\\(\\sw\\|\\s_\\)+\\>" limit t)
+            (not result))
+      (when (save-excursion
+              (save-match-data
+                (funcall match-p (match-beginning 0) limit)))
+        (setq result t)))
+    result))
 
 (defun swift-mode:font-lock-match-declared-function-names (limit)
   "Move the cursor just after a function name or others.



reply via email to

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