unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5373: Example in font-lock-add-keywords should use shy subgroup
@ 2010-01-13 10:26 Lennart Borgman
  2010-01-13 15:18 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2010-01-13 10:26 UTC (permalink / raw)
  To: emacs-pretest-bug

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.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5373: Example in font-lock-add-keywords should use shy subgroup
  2010-01-13 10:26 bug#5373: Example in font-lock-add-keywords should use shy subgroup Lennart Borgman
@ 2010-01-13 15:18 ` Stefan Monnier
  2010-01-13 15:19   ` Lennart Borgman
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2010-01-13 15:18 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 5373

> 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






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5373: Example in font-lock-add-keywords should use shy subgroup
  2010-01-13 15:18 ` Stefan Monnier
@ 2010-01-13 15:19   ` Lennart Borgman
  2010-01-13 16:01     ` Chong Yidong
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2010-01-13 15:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 5373

On Wed, Jan 13, 2010 at 4:18 PM, Stefan Monnier
<monnier@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?






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5373: Example in font-lock-add-keywords should use shy subgroup
  2010-01-13 15:19   ` Lennart Borgman
@ 2010-01-13 16:01     ` Chong Yidong
  2010-01-13 16:08       ` Lennart Borgman
  0 siblings, 1 reply; 6+ messages in thread
From: Chong Yidong @ 2010-01-13 16:01 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 5373

Lennart Borgman <lennart.borgman@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.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5373: Example in font-lock-add-keywords should use shy subgroup
  2010-01-13 16:01     ` Chong Yidong
@ 2010-01-13 16:08       ` Lennart Borgman
  2010-01-13 18:58         ` bug#5373: Example in font-lock-add-keywords should use shy Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2010-01-13 16:08 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 5373

On Wed, Jan 13, 2010 at 5:01 PM, Chong Yidong <cyd@stupidchicken.com> wrote:
> Lennart Borgman <lennart.borgman@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.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5373: Example in font-lock-add-keywords should use shy
  2010-01-13 16:08       ` Lennart Borgman
@ 2010-01-13 18:58         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2010-01-13 18:58 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Chong Yidong, 5373

>>>> 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






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-01-13 18:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 10:26 bug#5373: Example in font-lock-add-keywords should use shy subgroup Lennart Borgman
2010-01-13 15:18 ` Stefan Monnier
2010-01-13 15:19   ` Lennart Borgman
2010-01-13 16:01     ` Chong Yidong
2010-01-13 16:08       ` Lennart Borgman
2010-01-13 18:58         ` bug#5373: Example in font-lock-add-keywords should use shy Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).