GNU bug report logs - #5373
Example in font-lock-add-keywords should use shy subgroup

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Wed, 13 Jan 2010 10:27:01 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

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 5373 in the body.
You can then email your comments to 5373 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5373; Package emacs. (Wed, 13 Jan 2010 10:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 13 Jan 2010 10:27:01 GMT) Full text and rfc822 format available.

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

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: emacs-pretest-bug <at> gnu.org
Subject: Example in font-lock-add-keywords should use shy subgroup
Date: Wed, 13 Jan 2010 11:26:03 +0100
Should not the second regexp in

 (font-lock-add-keywords 'c-mode
  '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
    ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))

use a shy subgroup like in

 (font-lock-add-keywords 'c-mode
  '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
    ("\\<\\(?:and\\|or\\|not\\)\\>" . font-lock-keyword-face)))



Same problem with the second example.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5373; Package emacs. (Wed, 13 Jan 2010 15:19:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 5373 <at> debbugs.gnu.org
Subject: Re: bug#5373: Example in font-lock-add-keywords should use shy
	subgroup
Date: Wed, 13 Jan 2010 10:18:08 -0500
> Should not the second regexp in

>  (font-lock-add-keywords 'c-mode
>   '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
>     ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))

> use a shy subgroup like in

>  (font-lock-add-keywords 'c-mode
>   '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
>     ("\\<\\(?:and\\|or\\|not\\)\\>" . font-lock-keyword-face)))

It could.  But the use of a normal group is harmless.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5373; Package emacs. (Wed, 13 Jan 2010 15:21:02 GMT) Full text and rfc822 format available.

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

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 5373 <at> debbugs.gnu.org
Subject: Re: bug#5373: Example in font-lock-add-keywords should use shy 
	subgroup
Date: Wed, 13 Jan 2010 16:19:33 +0100
On Wed, Jan 13, 2010 at 4:18 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> Should not the second regexp in
>
>>  (font-lock-add-keywords 'c-mode
>>   '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
>>     ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))
>
>> use a shy subgroup like in
>
>>  (font-lock-add-keywords 'c-mode
>>   '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
>>     ("\\<\\(?:and\\|or\\|not\\)\\>" . font-lock-keyword-face)))
>
> It could.  But the use of a normal group is harmless.


I thought it was slower?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5373; Package emacs. (Wed, 13 Jan 2010 16:02:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 5373 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#5373: Example in font-lock-add-keywords should use shy
	subgroup
Date: Wed, 13 Jan 2010 11:01:19 -0500
Lennart Borgman <lennart.borgman <at> gmail.com> writes:

>> It could.  But the use of a normal group is harmless.
>
> I thought it was slower?

No, it's not.  Maybe you're thinking about greedy matching?  Anyway, I'm
going to close this bug.




bug closed, send any further explanations to Lennart Borgman <lennart.borgman <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Wed, 13 Jan 2010 16:02:03 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5373; Package emacs. (Wed, 13 Jan 2010 16:09:01 GMT) Full text and rfc822 format available.

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

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 5373 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#5373: Example in font-lock-add-keywords should use shy 
	subgroup
Date: Wed, 13 Jan 2010 17:08:12 +0100
On Wed, Jan 13, 2010 at 5:01 PM, Chong Yidong <cyd <at> stupidchicken.com> wrote:
> Lennart Borgman <lennart.borgman <at> gmail.com> writes:
>
>>> It could.  But the use of a normal group is harmless.
>>
>> I thought it was slower?
>
> No, it's not.  Maybe you're thinking about greedy matching?  Anyway, I'm
> going to close this bug.


No, I was not. I just thought finding the extra match data was a bit slower.

Thanks for telling.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5373; Package emacs. (Wed, 13 Jan 2010 18:59:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 5373 <at> debbugs.gnu.org
Subject: Re: bug#5373: Example in font-lock-add-keywords should use shy
Date: Wed, 13 Jan 2010 13:58:50 -0500
>>>> It could.  But the use of a normal group is harmless.
>>> I thought it was slower?
>> No, it's not.  Maybe you're thinking about greedy matching?  Anyway, I'm
>> going to close this bug.
> No, I was not. I just thought finding the extra match data was a bit slower.
> Thanks for telling.

Well, it is marginally slower, but you'd be hard pressed to measure
the difference.


        Stefan




bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 11 Feb 2010 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 210 days ago.

Previous Next


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