help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newline doesn't have whitespace syntax?


From: David Hansen
Subject: Re: newline doesn't have whitespace syntax?
Date: Fri, 12 May 2006 17:13:34 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]