GNU bug report logs - #39578
27.0.50; [rainbow-mode] #define is colored in c++-mode

Previous Next

Package: emacs;

Reported by: tastytea <tastytea <at> tastytea.de>

Date: Wed, 12 Feb 2020 15:33:02 UTC

Severity: minor

Tags: confirmed

Merged with 37681

Found in version 27.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39578 in the body.
You can then email your comments to 39578 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39578; Package emacs. (Wed, 12 Feb 2020 15:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to tastytea <tastytea <at> tastytea.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 12 Feb 2020 15:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: tastytea <tastytea <at> tastytea.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; [rainbow-mode] #define is colored in c++-mode
Date: Wed, 12 Feb 2020 16:06:53 +0100
[Message part 1 (text/plain, inline)]
Hi,
I found a little bug in rainbow-mode 1.0.3. In c-mode and c++-mode it
colors the “#def” in #define.

Minimal init.el (assuming that rainbow-mode is installed):
(package-initialize)
(require 'rainbow-mode)

Minimal C++ example:
#define XYZ
int main() {}

Kind regards, tastytea
[screenshot_rainbow_define.png (image/png, attachment)]
[Message part 3 (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39578; Package emacs. (Tue, 27 Oct 2020 18:36:02 GMT) Full text and rfc822 format available.

Message #8 received at 39578 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: tastytea <tastytea <at> tastytea.de>
Cc: Julien Danjou <julien <at> danjou.info>, 39578 <at> debbugs.gnu.org
Subject: Re: bug#39578: 27.0.50; [rainbow-mode] #define is colored in c++-mode
Date: Tue, 27 Oct 2020 19:35:35 +0100
tastytea <tastytea <at> tastytea.de> writes:

> I found a little bug in rainbow-mode 1.0.3. In c-mode and c++-mode it
> colors the “#def” in #define.
>
> Minimal init.el (assuming that rainbow-mode is installed):
> (package-initialize)
> (require 'rainbow-mode)
>
> Minimal C++ example:
> #define XYZ
> int main() {}

I can confirm that the bug is still present in the current ELPA
package.  Perhaps Julien has some insight here?  (Cc'd.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) confirmed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 27 Oct 2020 18:36:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39578; Package emacs. (Thu, 29 Oct 2020 11:47:02 GMT) Full text and rfc822 format available.

Message #13 received at 39578 <at> debbugs.gnu.org (full text, mbox):

From: Julien Danjou <julien <at> danjou.info>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: tastytea <tastytea <at> tastytea.de>, 39578 <at> debbugs.gnu.org
Subject: Re: bug#39578: 27.0.50; [rainbow-mode] #define is colored in c++-mode
Date: Thu, 29 Oct 2020 12:45:55 +0100
On Tue, Oct 27 2020, Lars Ingebrigtsen wrote:

Hi there,

> I can confirm that the bug is still present in the current ELPA
> package.  Perhaps Julien has some insight here?  (Cc'd.)

It's not a bug per say since it matches the regexp.
We just need to add even more code to avoid matching languages'
keywords.

-- 
Julien Danjou
;; Free Software hacker
;; https://julien.danjou.info




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39578; Package emacs. (Fri, 30 Oct 2020 12:01:01 GMT) Full text and rfc822 format available.

Message #16 received at 39578 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Julien Danjou <julien <at> danjou.info>
Cc: tastytea <tastytea <at> tastytea.de>, 39578 <at> debbugs.gnu.org
Subject: Re: bug#39578: 27.0.50; [rainbow-mode] #define is colored in c++-mode
Date: Fri, 30 Oct 2020 13:00:26 +0100
Julien Danjou <julien <at> danjou.info> writes:

> It's not a bug per say since it matches the regexp.
> We just need to add even more code to avoid matching languages'
> keywords.

It seems like a more general problem to me.  That is, "#def" should be
colourized, but "#defi" should not?

So would checking for a word boundary after the regexp be sufficient?
Or are there places where #000000foobar makes sense and we really want
to colourize that #000000 bit?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39578; Package emacs. (Fri, 30 Oct 2020 15:54:01 GMT) Full text and rfc822 format available.

Message #19 received at 39578 <at> debbugs.gnu.org (full text, mbox):

From: Julien Danjou <julien <at> danjou.info>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: tastytea <tastytea <at> tastytea.de>, 39578 <at> debbugs.gnu.org
Subject: Re: bug#39578: 27.0.50; [rainbow-mode] #define is colored in c++-mode
Date: Fri, 30 Oct 2020 16:53:05 +0100
On Fri, Oct 30 2020, Lars Ingebrigtsen wrote:

> It seems like a more general problem to me.  That is, "#def" should be
> colourized, but "#defi" should not?
>
> So would checking for a word boundary after the regexp be sufficient?
> Or are there places where #000000foobar makes sense and we really want
> to colourize that #000000 bit?

It might be. It's hard to say since I don't have a good memory and there
is no unit test. :(

-- 
Julien Danjou
/* Free Software hacker
   https://julien.danjou.info */




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39578; Package emacs. (Sun, 01 Nov 2020 12:23:01 GMT) Full text and rfc822 format available.

Message #22 received at 39578 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Julien Danjou <julien <at> danjou.info>
Cc: tastytea <tastytea <at> tastytea.de>, 39578 <at> debbugs.gnu.org
Subject: Re: bug#39578: 27.0.50; [rainbow-mode] #define is colored in c++-mode
Date: Sun, 01 Nov 2020 13:22:47 +0100
Julien Danjou <julien <at> danjou.info> writes:

>> So would checking for a word boundary after the regexp be sufficient?
>> Or are there places where #000000foobar makes sense and we really want
>> to colourize that #000000 bit?
>
> It might be. It's hard to say since I don't have a good memory and there
> is no unit test. :(

Right.  I guess this one will just have to wait until somebody that uses
it tries such a change and sees what the results are...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Forcibly Merged 37681 39578. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 30 Jan 2021 07:22:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39578; Package emacs. (Sun, 01 May 2022 09:25:01 GMT) Full text and rfc822 format available.

Message #27 received at 39578 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Julien Danjou <julien <at> danjou.info>
Cc: tastytea <tastytea <at> tastytea.de>, 39578 <at> debbugs.gnu.org
Subject: Re: bug#39578: 27.0.50; [rainbow-mode] #define is colored in c++-mode
Date: Sun, 01 May 2022 11:24:30 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> So would checking for a word boundary after the regexp be sufficient?
> Or are there places where #000000foobar makes sense and we really want
> to colourize that #000000 bit?

I've now made this change in rainbow-mode for the ^#... matches, which
should probably be correct for most things.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 39578 <at> debbugs.gnu.org and tastytea <tastytea <at> tastytea.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 01 May 2022 09:25:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 29 May 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 20 days ago.

Previous Next


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