From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#28098: 26.0.50; bad C fontification Date: 16 Aug 2017 20:57:22 -0000 Organization: muc.de e.V. Message-ID: <20170816205722.954.qmail@mail.muc.de> References: NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1502917098 1960 195.159.176.226 (16 Aug 2017 20:58:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 16 Aug 2017 20:58:18 +0000 (UTC) User-Agent: tin/2.4.1-20161224 ("Daill") (UNIX) (FreeBSD/11.0-RELEASE-p2 (amd64)) Cc: 28098@debbugs.gnu.org To: Marti Bolivar Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 16 22:58:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1di5OE-000082-Pi for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Aug 2017 22:58:10 +0200 Original-Received: from localhost ([::1]:49544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1di5OL-0005Bi-7k for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Aug 2017 16:58:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1di5OB-0005AF-Un for bug-gnu-emacs@gnu.org; Wed, 16 Aug 2017 16:58:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1di5OA-0006MC-OL for bug-gnu-emacs@gnu.org; Wed, 16 Aug 2017 16:58:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:32932) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1di5O6-0006Jd-Gn; Wed, 16 Aug 2017 16:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1di5O6-00033t-AA; Wed, 16 Aug 2017 16:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 16 Aug 2017 20:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28098 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 28098-submit@debbugs.gnu.org id=B28098.150291704711663 (code B ref 28098); Wed, 16 Aug 2017 20:58:02 +0000 Original-Received: (at 28098) by debbugs.gnu.org; 16 Aug 2017 20:57:27 +0000 Original-Received: from localhost ([127.0.0.1]:41611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1di5NX-000322-An for submit@debbugs.gnu.org; Wed, 16 Aug 2017 16:57:27 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:50300 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1di5NU-00031l-5F for 28098@debbugs.gnu.org; Wed, 16 Aug 2017 16:57:24 -0400 Original-Received: (qmail 955 invoked by uid 3782); 16 Aug 2017 20:57:22 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135844 Archived-At: Hello again, Marti. In article you wrote: > [-- text/plain, encoding 7bit, charset: UTF-8, 98 lines --] > 1. From emacs -Q, open this file: > https://github.com/zephyrproject-rtos/zephyr/blob/2de59023dc726e61244eb7cca17252294016c65a/subsys/net/lib/http/http_client.c > 2. Observe incorrect syntax highlighting at beginning of file. Screenshot: > https://postimg.org/image/tzy8qgjjz/ > (Note that loading a C file with just the #ifdefs and initial > comment which fail to highlight above doesn't reproduce the issue.) I think the following patch should fix the bug. Would you please apply it, try it out, and either confirm to me that it fixes the bug, or tell me what's still wrong: diff -r 9533dc4cbda3 cc-mode.el --- a/cc-mode.el Thu Jul 27 17:37:02 2017 +0000 +++ b/cc-mode.el Wed Aug 16 20:48:54 2017 +0000 @@ -1529,10 +1529,13 @@ (c-backward-syntactic-ws) (when (setq pos1 (c-on-identifier)) (goto-char pos1) - (when (and (c-forward-declarator) - (eq (c-forward-token-2) 0)) - (c-backward-syntactic-ws) - (point))))) + (let ((lim (save-excursion + (and (c-beginning-of-macro) + (progn (c-end-of-macro) (point)))))) + (when (and (c-forward-declarator lim) + (eq (c-forward-token-2 1 nil lim) 0)) + (c-backward-syntactic-ws) + (point)))))) (defun c-change-expand-fl-region (beg end old-len) ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock Thanks for taking the trouble to report this bug. > In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) > of 2017-08-10 built on plop > Repository revision: 81656add8117e8d1b7faab18b330d0706462b433 > Windowing system distributor 'The X.Org Foundation', version 11.0.11903000 > System Description: Ubuntu 17.04 -- Alan Mackenzie (Nuremberg, Germany).