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#24132: 25.1.50; Missing fontification for header names in C++ mode Date: Wed, 3 Aug 2016 20:44:57 +0000 Message-ID: <20160803204457.GA11252@acm.fritz.box> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1470257187 18050 195.159.176.226 (3 Aug 2016 20:46:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 3 Aug 2016 20:46:27 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: 24132@debbugs.gnu.org To: Phil Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 03 22:46:23 2016 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 1bV33W-0003uj-GR for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Aug 2016 22:46:22 +0200 Original-Received: from localhost ([::1]:36621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bV33T-0005Kz-4L for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Aug 2016 16:46:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bV33J-0005Ih-I7 for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2016 16:46:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bV33H-0001Id-HA for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2016 16:46:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bV33C-0001Hl-JU; Wed, 03 Aug 2016 16:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bV33C-000728-Fb; Wed, 03 Aug 2016 16:46: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, 03 Aug 2016 20:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24132 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 24132-submit@debbugs.gnu.org id=B24132.147025714026987 (code B ref 24132); Wed, 03 Aug 2016 20:46:02 +0000 Original-Received: (at 24132) by debbugs.gnu.org; 3 Aug 2016 20:45:40 +0000 Original-Received: from localhost ([127.0.0.1]:54980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bV32p-00071D-SV for submit@debbugs.gnu.org; Wed, 03 Aug 2016 16:45:40 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:11053) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bV32n-000710-KU for 24132@debbugs.gnu.org; Wed, 03 Aug 2016 16:45:38 -0400 Original-Received: (qmail 68202 invoked by uid 3782); 3 Aug 2016 20:45:35 -0000 Original-Received: from acm.muc.de (p4FC46285.dip0.t-ipconnect.de [79.196.98.133]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 03 Aug 2016 22:45:34 +0200 Original-Received: (qmail 13275 invoked by uid 1000); 3 Aug 2016 20:44:58 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:121806 Archived-At: Hello, Phil. On Tue, Aug 02, 2016 at 11:17:06AM -0400, Phil wrote: > src/emacs -Q -eval '(progn (insert "#include \"foo/bar.h\"")(c++-mode)(backward-char 11)(delete-char 1) (insert "\""))' > Expected: The header name "foo/bar.h" is fontified as string. > Actual: the header name isn't fontified. Thanks for taking the trouble to report this. Could you please try out the following patch to CC Mode, and either confirm that it solves the problem, or tell me what's still not working properly. Thanks in advance! (The file to patch is in directory .../lisp/progmodes.) > In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) > of 2016-08-02 built on unknown > Repository revision: 53917616b0aca43b9ca85531d4dcb426885bdb73 > Windowing system distributor 'The X.Org Foundation', version 11.0.11702000 > System Description: Ubuntu 14.04 LTS [ .... ] > Major mode: C++/l > Minor modes in effect: > tooltip-mode: t > global-eldoc-mode: t > electric-indent-mode: t > mouse-wheel-mode: t > tool-bar-mode: t > menu-bar-mode: t > file-name-shadow-mode: t > global-font-lock-mode: t > font-lock-mode: t > blink-cursor-mode: t > auto-composition-mode: t > auto-encryption-mode: t > auto-compression-mode: t > line-number-mode: t > transient-mark-mode: t > abbrev-mode: t [ .... ] diff -r df6a39556cd1 cc-mode.el --- a/cc-mode.el Sat Jul 23 14:46:28 2016 +0000 +++ b/cc-mode.el Wed Aug 03 19:56:05 2016 +0000 @@ -874,24 +874,31 @@ ;; This function is in the C/C++/ObjC values of ;; `c-get-state-before-change-functions' and is called exclusively as a ;; before change function. - (c-save-buffer-state () + (c-save-buffer-state (m-beg ss-found) (goto-char c-new-BEG) (while (and (< (point) beg) - (search-forward-regexp c-anchored-cpp-prefix beg t)) + (search-forward-regexp c-anchored-cpp-prefix beg 'bound)) (goto-char (match-beginning 1)) - (let ((m-beg (point))) - (c-end-of-macro) - (c-clear-char-property-with-value - m-beg (min (point) beg) 'syntax-table '(1)))) + (setq m-beg (point)) + (c-end-of-macro) + (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1))) - (goto-char end) + (while (and (< (point) end) + (setq ss-found + (search-forward-regexp c-anchored-cpp-prefix end 'bound))) + (goto-char (match-beginning 1)) + (setq m-beg (point)) + (c-end-of-macro)) + (if (and ss-found (> (point) end)) + (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1))) + (while (and (< (point) c-new-END) - (search-forward-regexp c-anchored-cpp-prefix c-new-END t)) + (search-forward-regexp c-anchored-cpp-prefix c-new-END 'bound)) (goto-char (match-beginning 1)) - (let ((m-beg (point))) - (c-end-of-macro) - (c-clear-char-property-with-value - m-beg (min (point) c-new-END) 'syntax-table '(1)))))) + (setq m-beg (point)) + (c-end-of-macro) + (c-clear-char-property-with-value + m-beg (point) 'syntax-table '(1))))) (defun c-extend-region-for-CPP (beg end) ;; Adjust `c-new-BEG', `c-new-END' respectively to the beginning and end of -- Alan Mackenzie (Nuremberg, Germany).