[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 b3aec9e: CC Mode: Fix unstable fontification of doc strings.
From: |
Alan Mackenzie |
Subject: |
emacs-27 b3aec9e: CC Mode: Fix unstable fontification of doc strings. |
Date: |
Sun, 15 Aug 2021 14:14:28 -0400 (EDT) |
branch: emacs-27
commit b3aec9ee483c82aa23e604ea61ce0777e9ef2ebd
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>
CC Mode: Fix unstable fontification of doc strings.
Also optimize a loop over several line doc-comments.
* lisp/progmodes/cc-fonts.el (c-font-lock-doc-comments): New variable
comment-mid, used as the starting point for applying c-doc-face-name in a
line comments. In block comments, apply this face not from `comment-beg'
but
from `region-beg', no earlier than the start of the fontification region.
---
lisp/progmodes/cc-fonts.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index fd00d65..5f3e2ea 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -2733,13 +2733,14 @@ need for `pike-font-lock-extra-types'.")
;;
;; This function might do hidden buffer changes.
- (let (comment-beg region-beg)
+ (let (comment-beg region-beg comment-mid)
(if (memq (get-text-property (point) 'face)
'(font-lock-comment-face font-lock-comment-delimiter-face))
;; Handle the case when the fontified region starts inside a
;; comment.
(let ((start (c-literal-start)))
- (setq region-beg (point))
+ (setq region-beg (point)
+ comment-mid (point))
(when start
(goto-char start))
(when (looking-at prefix)
@@ -2765,7 +2766,8 @@ need for `pike-font-lock-extra-types'.")
(goto-char comment-beg)
(c-in-literal)))))
(setq comment-beg nil))
- (setq region-beg comment-beg))
+ (setq region-beg comment-beg
+ comment-mid comment-beg))
(if (elt (parse-partial-sexp comment-beg (+ comment-beg 2)) 7)
;; Collect a sequence of doc style line comments.
@@ -2773,15 +2775,16 @@ need for `pike-font-lock-extra-types'.")
(goto-char comment-beg)
(while (and (progn
(c-forward-single-comment)
- (c-put-font-lock-face comment-beg (point)
+ (c-put-font-lock-face comment-mid (point)
c-doc-face-name)
(skip-syntax-forward " ")
- (setq comment-beg (point))
+ (setq comment-beg (point)
+ comment-mid (point))
(< (point) limit))
(looking-at prefix))))
(goto-char comment-beg)
(c-forward-single-comment)
- (c-put-font-lock-face comment-beg (point) c-doc-face-name))
+ (c-put-font-lock-face region-beg (point) c-doc-face-name))
(if (> (point) limit) (goto-char limit))
(setq comment-beg nil)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-27 b3aec9e: CC Mode: Fix unstable fontification of doc strings.,
Alan Mackenzie <=