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#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument. Date: Wed, 17 Aug 2016 18:21:21 +0000 Message-ID: <20160817182121.GB5258@acm.fritz.box> References: <86inv0ph8m.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1471458143 17380 195.159.176.226 (17 Aug 2016 18:22:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 17 Aug 2016 18:22:23 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: 24246@debbugs.gnu.org To: Arash Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 17 20:22:18 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 1ba5Tl-0004Jc-N7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Aug 2016 20:22:17 +0200 Original-Received: from localhost ([::1]:49120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba5Ti-0001nZ-U9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Aug 2016 14:22:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba5Tc-0001nQ-6U for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2016 14:22:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ba5TW-0007zp-6H for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2016 14:22:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba5TW-0007zl-39; Wed, 17 Aug 2016 14:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ba5TV-0007tt-Vt; Wed, 17 Aug 2016 14:22: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, 17 Aug 2016 18:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24246 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 24246-submit@debbugs.gnu.org id=B24246.147145811230351 (code B ref 24246); Wed, 17 Aug 2016 18:22:01 +0000 Original-Received: (at 24246) by debbugs.gnu.org; 17 Aug 2016 18:21:52 +0000 Original-Received: from localhost ([127.0.0.1]:60517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba5TM-0007tT-FH for submit@debbugs.gnu.org; Wed, 17 Aug 2016 14:21:52 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:43790) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba5TL-0007tL-AI for 24246@debbugs.gnu.org; Wed, 17 Aug 2016 14:21:51 -0400 Original-Received: (qmail 26416 invoked by uid 3782); 17 Aug 2016 18:21:50 -0000 Original-Received: from acm.muc.de (p548C62EC.dip0.t-ipconnect.de [84.140.98.236]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 17 Aug 2016 20:21:49 +0200 Original-Received: (qmail 9070 invoked by uid 1000); 17 Aug 2016 18:21:21 -0000 Content-Disposition: inline In-Reply-To: <86inv0ph8m.fsf@gmail.com> 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:122331 Archived-At: Hello again, Arash. On Wed, Aug 17, 2016 at 01:24:17AM +0430, Arash wrote: > $ emacs -Q ab.cc > typedef int int32; > namespace wrapper { > enum type { a, b, c }; > } > // int32 doesn't get highlighted as a type. > void test(wrapper::type A, int32 B); > typedef wrapper::type wtype; > // here it works, so double colon is the problem? > void test(wtype A, int32 B); Thanks indeed for this bug report, and thanks even more for cutting it down to a nice, crisp, manageable file. The fontification code was not handling "::" in declarations correctly. I think I have corrected this, and I have committed it to our master branch at savannah. I see you're on the emacs-25 branch. Could you please patch your Emacs with the following patch (the file is in directory .../lisp/progmodes), rebuild CC Mode (a single $ emacs -Q -batch -f batch-byte-compile .../lisp/progmodes/cc-engine.el should suffice), reload CC Mode into your Emacs (or restart Emacs), then try out the new system on your real code. Then please let me know whether the problem has been truly fixed, and if not, what is still wrong. If everything is OK, I will close the bug. Here's the patch: # HG changeset patch # User Alan Mackenzie # Date 1471456447 0 # Wed Aug 17 17:54:07 2016 +0000 # Node ID 85afa8e79cc145c4ab61d8c8f180587d85c71bec # Parent 0e89dd90ade9cd6f5f4ca07cb57cba6f8e1335a5 Fontify constructs following "::" in C++ argument lists correctly. This fixes bug #24246. * cc-engine.el (c-find-decl-prefix-search): In the "pseudo match" loop, test a found string for a match with c-opt-identifier-concat-key (e.g. with "::"). * arglist-23.{cc,face}: New test files. diff -r 0e89dd90ade9 -r 85afa8e79cc1 cc-engine.el --- a/cc-engine.el Wed Aug 17 17:53:10 2016 +0000 +++ b/cc-engine.el Wed Aug 17 17:54:07 2016 +0000 @@ -5171,6 +5171,13 @@ (and (< (point) cfd-limit) (c-got-face-at (point) c-literal-faces)))) t) ; Continue the loop over pseudo matches. + ((and c-opt-identifier-concat-key + (match-string 1) + (save-excursion + (goto-char (match-beginning 1)) + (looking-at c-opt-identifier-concat-key))) + ;; Found, e.g., "::" in C++ + t) ((and (match-string 1) (string= (match-string 1) ":") (save-excursion -- Alan Mackenzie (Nuremberg, Germany).