branch: elpa/swift-mode commit 5597eafa55934c67185e627c362663753f695865 Author: taku0 <mxxouy6x3m_git...@tatapa.org> Commit: taku0 <mxxouy6x3m_git...@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.