* newline doesn't have whitespace syntax?
@ 2006-05-12 14:22 John Conrad
2006-05-12 15:13 ` David Hansen
0 siblings, 1 reply; 3+ messages in thread
From: John Conrad @ 2006-05-12 14:22 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 456 bytes --]
When I read this in the elisp manual:
"Space, tab, newline and formfeed are classified as whitespace in almost all
major modes."
(35.2.1 Table of Syntax Classes)
I assumed that this re-search-forward expression would match the line
following it, but no dice.
(re-search-forward "abcd[[:space:]]")
abcd
I've tried several different modes, including fundamental mode. Am I missing
something?
Using Emacs 22.0.50.1
John Emerson Conrad
[-- Attachment #1.2: Type: text/html, Size: 546 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: newline doesn't have whitespace syntax?
2006-05-12 14:22 newline doesn't have whitespace syntax? John Conrad
@ 2006-05-12 15:13 ` David Hansen
2006-05-12 17:13 ` Kevin Rodgers
0 siblings, 1 reply; 3+ messages in thread
From: David Hansen @ 2006-05-12 15:13 UTC (permalink / raw)
On Fri, 12 May 2006 10:22:37 -0400 John Conrad wrote:
> When I read this in the elisp manual:
>
> "Space, tab, newline and formfeed are classified as whitespace in
> almost all major modes."
> (35.2.1 Table of Syntax Classes)
>
> I assumed that this re-search-forward expression would match the line
> following it, but no dice.
>
> (re-search-forward "abcd[[:space:]]")
> abcd
>
> I've tried several different modes, including fundamental mode. Am I
> missing something?
Sounds like an Emacs bug to me "\\s " is working (in
fundamental-mode). Anyway newline isn't whitespace in
"most" modes. In quite a lot of languages a newline ends a
comment. To make your regexp reliable i would use something
like "abcd\\(\\s \\|$\\)" (note that this will match "abcd"
at the end of the buffer too w/o a final newline).
BTW: M-: (syntax-after (point)) RET may be useful.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: newline doesn't have whitespace syntax?
2006-05-12 15:13 ` David Hansen
@ 2006-05-12 17:13 ` Kevin Rodgers
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2006-05-12 17:13 UTC (permalink / raw)
David Hansen wrote:
> On Fri, 12 May 2006 10:22:37 -0400 John Conrad wrote:
>
>> When I read this in the elisp manual:
>>
>> "Space, tab, newline and formfeed are classified as whitespace in
>> almost all major modes."
>> (35.2.1 Table of Syntax Classes)
>>
>> I assumed that this re-search-forward expression would match the line
>> following it, but no dice.
>>
>> (re-search-forward "abcd[[:space:]]")
>> abcd
>>
>> I've tried several different modes, including fundamental mode. Am I
>> missing something?
>
> Sounds like an Emacs bug to me "\\s " is working (in
> fundamental-mode). Anyway newline isn't whitespace in
> "most" modes. In quite a lot of languages a newline ends a
> comment.
Right! But in Fundamental and Text modes, newline should have
whitespace syntax (unless there is a syntax-table text property
on it that specifies some other class).
> To make your regexp reliable i would use something
> like "abcd\\(\\s \\|$\\)" (note that this will match "abcd"
> at the end of the buffer too w/o a final newline).
"abcd\\>" or "abcd\\b" might be closer to what John wants,
although the trailing whitespace (if any) would not be included
in the match.
> BTW: M-: (syntax-after (point)) RET may be useful.
C-u C-x =
--
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-05-12 17:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-12 14:22 newline doesn't have whitespace syntax? John Conrad
2006-05-12 15:13 ` David Hansen
2006-05-12 17:13 ` Kevin Rodgers
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).