all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Bill Sacks <sacks@ucar.edu>, Eli Zaretskii <eliz@gnu.org>
Cc: 56818@debbugs.gnu.org
Subject: bug#56818: 28.1; c-mode font-lock issues in Emacs 28
Date: Fri, 29 Jul 2022 17:44:58 +0000	[thread overview]
Message-ID: <YuQcmm1BH92TVdk3@ACM> (raw)
In-Reply-To: <83edy48nsq.fsf@gnu.org>

Hello, Bill and Eli.

On Fri, Jul 29, 2022 at 08:56:21 +0300, Eli Zaretskii wrote:
> > From: Bill Sacks <sacks@ucar.edu>
> > Date: Thu, 28 Jul 2022 14:32:09 -0600

First of all (Bill), thanks for taking the trouble to report this bug,
and thanks even more for cutting the test case down to the short fragment
in your screenshots.

> > Starting with Emacs 28, I have been seeing font-lock issues when
> > editing C and C++ code. The situation where I see this the most
> > (though I'm not sure if it's the only situation) is when I am writing
> > a comment and currently have a space at the end of the comment line:
> > in this situation, the fontification of a variable name or function
> > name on the next line becomes broken until I type a non-space
> > character to end the current line.

> > The attached screen shots illustrate the problem: nospaces.png shows
> > the correct fontification; space_before_var.png and
> > space_before_function.png show that variable and function names lose
> > their fontification when there is a space at the end of the previous
> > comment line. Running M-x font-lock-fontify-buffer temporarily fixes
> > the issue.

> > The problem occurs even when using emacs -Q. I have tried the latest
> > emacs28 pretest and the latest nightly build available from
> > emacsformacosx (though with my customizations – NOT with emacs -Q)
> > and those also exhibit the problem. The latest emacs27 from
> > emacsformacosx does NOT have this issue.

This is a coding bug in an optimisation from March 2020, where the
complaint was that scrolling over a 2,000 line macro was slow.  The fix
neglected the possibility of spaces at the end of comment lines.

Could you please apply the following patch in your Emacs-28.1, byte
compile the file ..../lisp/progmodes/cc-engine.el, then try out the
result on your real code.  (If you want any help with the patching or
byte compiling, feel free to send me private mail.)  Then please confirm
that the bug is fixed, or tell us how it's not fixed.  Thanks!



diff -r 9c649274b259 cc-engine.el
--- a/cc-engine.el	Tue Jul 26 20:08:39 2022 +0000
+++ b/cc-engine.el	Fri Jul 29 17:25:16 2022 +0000
@@ -1679,9 +1679,13 @@
 Return the result of `forward-comment' if it gets called, nil otherwise."
   `(if (not comment-end-can-be-escaped)
        (forward-comment -1)
-     (when (and (< (skip-syntax-backward " >") 0)
-		(eq (char-after) ?\n))
-       (forward-char))
+     (let ((dist (skip-syntax-backward " >")))
+       (when (and
+	      (< dist 0)
+	      (progn
+		(skip-syntax-forward " " (- (point) dist 1))
+		(eq (char-after) ?\n)))
+	 (forward-char)))
      (cond
       ((and (eq (char-before) ?\n)
 	    (eq (char-before (1- (point))) ?\\))




> Alan, this seems to be a regression in Emacs 28, so could you please
> look into it?

Eli, Do I understand you want the fix in the release branch?

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2022-07-29 17:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 20:32 bug#56818: 28.1; c-mode font-lock issues in Emacs 28 Bill Sacks
2022-07-29  5:56 ` Eli Zaretskii
2022-07-29 17:44   ` Alan Mackenzie [this message]
2022-07-29 18:11     ` Eli Zaretskii
2022-07-29 20:23     ` Bill Sacks
2022-07-29 20:38       ` Bill Sacks
2022-07-30 13:18         ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YuQcmm1BH92TVdk3@ACM \
    --to=acm@muc.de \
    --cc=56818@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=sacks@ucar.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.