GNU bug report logs - #23610
25.0.94; c++-mode doesn't fontify typename... like typename

Previous Next

Packages: cc-mode, emacs;

Reported by: Ivan Andrus <darthandrus <at> gmail.com>

Date: Tue, 24 May 2016 17:02:02 UTC

Severity: minor

Found in version 25.0.94

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ivan Andrus <darthandrus <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 23610 <at> debbugs.gnu.org
Subject: bug#23610: 25.0.94; c++-mode doesn't fontify typename... like typename
Date: Wed, 22 Jun 2016 09:22:01 -0600
On Sun, Jun 19, 2016 at 3:14 PM, Alan Mackenzie <acm <at> muc.de> wrote:
> Hello, Ivan.
>
> In article <mailman.202.1464109329.1216.bug-gnu-emacs <at> gnu.org> you wrote:
>> Starting with emacs -Q, Y is not fontified in the snippet below, whereas
>> X is.
>
>> -Ivan
>
>
>> template <typename X, typename... Y>
>> class bob {
>
>> };
>
> [ .... ]
>
> The following patch is a first attempt to fontify parameter packs.  After
> applying it, please be sure either to recompile CC Mode entirely, or
> first to compile cc-langs.el (which contains macros), and then all three
> of cc-fonts.el, cc-engine.el, and cc-mode.el.
>
> It seems to fontify the "Y" above OK.  I've tried it on a stock example
> out of Wikipedia, and that works.  Could you try it out on your code,
> please, and let me know how well it works.

It looks pretty good.  I didn't notice this before, but the following example
from Wikipedia is fontified differently if the ... is removed from before the
`args`.  In that case args is fontified with `font-lock-variable-name-face`.

  template<typename... Args> inline void expand(Args&&... args) {
    pass( some_function(args)... );
  }

FWIW, I've seen similar mis-fontifications before (without ...) and it hasn't
bothered me too much.  I just found a reproducible case, so I guess I'll
open a bug for it.

Thanks for working on this.  The raw string support is awesome!

-Ivan




This bug report was last modified 8 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.