From: Alan Mackenzie Date: Sat, 21 Sep 2024 16:46:32 +0000 (+0000) Subject: CC Mode: fix minor errors in the fontification of enums. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2155363c1dac65c911cba73a35913f1566ef0c7c;p=emacs.git CC Mode: fix minor errors in the fontification of enums. 1: Fix the typing of a space on the { line in an enum specification which is the first item in a buffer. This defontified the enum's identifiers. 2: Fix the typing of a space on the line of the enum's last identifier. This defontified that identifier for jit-lock-context-time. * lisp/progmodes/cc-engine.el (c-forward-declarator): Cease rejecting the identifier if there are no further tokens before LIMIT. * lisp/progmodes/cc-mode.el (c-fl-decl-start): Accept a backward search as succeeding if it hits point-min. (cherry picked from commit 086cb1b590251ca353fec5a841ea882cdf9cbcb2) --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 1ffca7365ea..30006054de7 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10044,7 +10044,7 @@ point unchanged and return nil." (defun c-forward-declarator (&optional limit accept-anon not-top) ;; Assuming point is at the start of a declarator, move forward over it, ;; leaving point at the next token after it (e.g. a ) or a ; or a ,), or at - ;; end of buffer if there is no such token. + ;; LIMIT (or end of buffer) if that comes first. ;; ;; Return a list (ID-START ID-END BRACKETS-AFTER-ID GOT-INIT DECORATED ;; ARGLIST), where ID-START and ID-END are the bounds of the declarator's @@ -10177,9 +10177,6 @@ point unchanged and return nil." (c-safe (goto-char (scan-lists (point) 1 paren-depth))) (c-forward-syntactic-ws))) - (or (eq (point) (point-max)) ; No token after identifier. - (< (point) limit)) - ;; Skip over any trailing bit, such as "__attribute__". (progn (while (cond diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 93bfad1df39..a10a41e82b6 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2453,7 +2453,7 @@ with // and /*, not more generic line and block comments." (backward-char) (setq pseudo (c-cheap-inside-bracelist-p (c-parse-state))))))) (goto-char pseudo)) - (or pseudo (> (point) bod-lim))) + (or pseudo (bobp) (> (point) bod-lim))) ;; Move forward to the start of the next declaration. (progn (c-forward-syntactic-ws) ;; Have we got stuck in a comment at EOB?