unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15006: 24.3; emacs manual comment-start-skip example grouping
@ 2013-08-02  0:48 Kevin Ryde
  2013-08-02  1:34 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2013-08-02  0:48 UTC (permalink / raw)
  To: 15006

In the emacs manual info node "(emacs)Options for Comments" an example
comment-start-skip is given

    "\\(//+\\|/\\*+\\)\\s *"

If I understand the comment-start-skip docstring correctly a \(..\)
group is for extra distinguishing text preceding the comment.  Should
that example be a shy group, or perhaps expanded out to ungroup like
vera-mode.el has?

    "/\\*+ *\\|//+ *"

I also wondered whether the whitespace "\\s *" in the example was a
little too loose since it matches \n and leading whitespace of the next
line too.  Does that matter to anything?



In GNU Emacs 24.3.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2013-05-29 on blah.blah, modified by Debian
System Description:	Debian GNU/Linux 7.0 (wheezy)

Configured using:
 `configure '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=lucid' '--with-toolkit-scroll-bars' '--without-gconf'
 'build_alias=i486-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'LDFLAGS=-Wl,-z,relro -Wl,-znocombreloc'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_AU
  locale-coding-system: iso-latin-1-unix
  default enable-multibyte-characters: t





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

* bug#15006: 24.3; emacs manual comment-start-skip example grouping
  2013-08-02  0:48 bug#15006: 24.3; emacs manual comment-start-skip example grouping Kevin Ryde
@ 2013-08-02  1:34 ` Stefan Monnier
  2013-08-02  1:50   ` Kevin Ryde
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2013-08-02  1:34 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: 15006

> If I understand the comment-start-skip docstring correctly a \(..\)
> group is for extra distinguishing text preceding the comment.  Should
> that example be a shy group,

Indeed, thank you.

> I also wondered whether the whitespace "\\s *" in the example was a
> little too loose since it matches \n and leading whitespace of the next
> line too.  Does that matter to anything?

Yes, I prefer to stay away from "whitepace syntax" for that reason and
would recommend [ \t]* in its stead.


        Stefan





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

* bug#15006: 24.3; emacs manual comment-start-skip example grouping
  2013-08-02  1:34 ` Stefan Monnier
@ 2013-08-02  1:50   ` Kevin Ryde
  2013-08-02  2:30     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2013-08-02  1:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15006

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> If I understand the comment-start-skip docstring correctly a \(..\)
>> group is for extra distinguishing text preceding the comment.  Should
>> that example be a shy group,
>
> Indeed, thank you.

Actually I see the cc-mode code uses it with a group.  And js.el too
(perhaps copying cc-mode).  Does it have some subtle effect of skipping
the /*, or is it outright wrong?

> Yes, I prefer to stay away from "whitepace syntax" for that reason and
> would recommend [ \t]* in its stead.

I suppose the intention is to pick up non-breaking spaces or whatever
other flavours of whitespace.  Unlikely to arise in practice in
programming language stuff.  Is there an obvious ill effect?





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

* bug#15006: 24.3; emacs manual comment-start-skip example grouping
  2013-08-02  1:50   ` Kevin Ryde
@ 2013-08-02  2:30     ` Stefan Monnier
  2021-08-21 14:08       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2013-08-02  2:30 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: 15006

> Actually I see the cc-mode code uses it with a group.  And js.el too
> (perhaps copying cc-mode).  Does it have some subtle effect of skipping
> the /*, or is it outright wrong?

It's wrong.  But cc-mode likes to reinvent the wheel, so maybe
it doesn't use much of that code anyway.

>> Yes, I prefer to stay away from "whitepace syntax" for that reason and
>> would recommend [ \t]* in its stead.
> I suppose the intention is to pick up non-breaking spaces or whatever
> other flavours of whitespace.  Unlikely to arise in practice in
> programming language stuff.  Is there an obvious ill effect?

You can get things like (re-search-forward comment-start-skip) and end
up with (match-end 0) past the end of the matched comment (e.g. when
matching "//\n").


        Stefan





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

* bug#15006: 24.3; emacs manual comment-start-skip example grouping
  2013-08-02  2:30     ` Stefan Monnier
@ 2021-08-21 14:08       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-21 14:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15006, Kevin Ryde

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I suppose the intention is to pick up non-breaking spaces or whatever
>> other flavours of whitespace.  Unlikely to arise in practice in
>> programming language stuff.  Is there an obvious ill effect?
>
> You can get things like (re-search-forward comment-start-skip) and end
> up with (match-end 0) past the end of the matched comment (e.g. when
> matching "//\n").

I've now updated the example in the manual (as well as rearranged the
\\| to match the order of the description of the regexp) in Emacs 28.

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





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

end of thread, other threads:[~2021-08-21 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02  0:48 bug#15006: 24.3; emacs manual comment-start-skip example grouping Kevin Ryde
2013-08-02  1:34 ` Stefan Monnier
2013-08-02  1:50   ` Kevin Ryde
2013-08-02  2:30     ` Stefan Monnier
2021-08-21 14:08       ` Lars Ingebrigtsen

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