From: Alan Mackenzie Date: Tue, 4 Jul 2023 12:43:31 +0000 (+0000) Subject: objc-mode: Fix exceptions in fontification. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=793a416653af0e4be5b6adec9323a1dafd1545eb;p=emacs.git objc-mode: Fix exceptions in fontification. These exceptions ("Invalid search bound (wrong side of point)") were observed in test suite file class-24.m when moving point up and down a line at a time. * lisp/progmodes/cc-engine.el (c-forward-declarator): In the c-syntactic-re-search-forward ~30 lines from the end of the function amend the regexp for objc-mode such that "@end" terminates the search, but "<" doesn't. * lisp/progmodes/cc-fonts.el (c-make-font-lock-search-function): supply a non-nil CHECK-POINT argument to c-make-font-lock-search-form. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 721daf9d53f..abcc20fcb82 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10219,7 +10219,11 @@ point unchanged and return nil." (prog1 (setq found (c-syntactic-re-search-forward - "[;:,]\\|\\(=\\|\\s(\\)" + ;; Consider making the next regexp a + ;; c-lang-defvar (2023-07-04). + (if (c-major-mode-is 'objc-mode) + "\\(?:@end\\)\\|[;:,]\\|\\(=\\|[[(]\\)" + "[;:,]\\|\\(=\\|\\s(\\)") limit 'limit t)) (setq got-init (and found (match-beginning 1)))) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index afbf841bcb1..5d5ada4c99d 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -387,7 +387,7 @@ (parse-sexp-lookup-properties (cc-eval-when-compile (boundp 'parse-sexp-lookup-properties)))) - ,(c-make-font-lock-search-form regexp highlights)) + ,(c-make-font-lock-search-form regexp highlights t)) nil))) (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights)