[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make \< and \> match symbol boundaries
From: |
Stefan Monnier |
Subject: |
Re: Make \< and \> match symbol boundaries |
Date: |
Sun, 28 Oct 2001 15:53:05 -0500 |
> Many characters have symbol syntax in text mode, including -.
> For this reason, the change you have requested would surely
> cause user confusion in that mode.
I don't think it would cause much confusion and we can simply
tell them to use \b in place of \< or \>.
The current situation not only causes confusion but makes it
surprisingly difficult to search for occurrences of the function
`foo' without also matching `bla_foo_bar'.
> I think it would be better to introduce some other way of
> specifying a symbol boundary search. Perhaps \[ amd \].
As Paul Eggert pointed out, this is already used. Also,
it's hard enough for people to remember the few existing
constructs without adding yet more.
Paul also said:
> Here's another idea: generalize the existing regexps \b, \B, etc. to
> support arbitrary classes and syntaxes, not just word syntax. For
> example, to generalize \b we could add the following regexps:
That's an idea. But note that what my new \< would match is
not "an empty string after a non-symbol char and before a symbol char"
but "an empty string after a `non-symbol, non-word' char and before
a `symbol or word' char".
So it would have to be specified with something like \-s^w_-w_-
(assuming the syntax used is \-s<before>-<after>- and the <before>
and <after> can use ^ for negation).
Things along those lines have already been discussed (there was
also a proposal to allow [:syntax:<...>:] as character classes),
but it's still not clear to me which is most useful, whereas
I know that changing \< and \> to match symbol boundaries rather than
word boundaries is a very simple change and it would be useful
in many situations.
Stefan
- Re: idea -> internal frames?, (continued)
- Re: idea -> internal frames?, Jason Rumney, 2001/10/26
- Re: idea -> internal frames?, Kevin A. Burton, 2001/10/24
- Make \< and \> match symbol boundaries, Stefan Monnier, 2001/10/25
- Re: Make \< and \> match symbol boundaries, Miles Bader, 2001/10/25
- Re: Make \< and \> match symbol boundaries, Richard Stallman, 2001/10/28
- Re: Make \< and \> match symbol boundaries, Paul Eggert, 2001/10/28
- Re: Make \< and \> match symbol boundaries, Richard Stallman, 2001/10/29
- Re: Make \< and \> match symbol boundaries, Miles Bader, 2001/10/29
- Re: Make \< and \> match symbol boundaries,
Stefan Monnier <=
- Re: Make \< and \> match symbol boundaries, Paul Eggert, 2001/10/28
- Re: Make \< and \> match symbol boundaries, Stefan Monnier, 2001/10/28
- Re: Make \< and \> match symbol boundaries, Miles Bader, 2001/10/29