|
From: | Kevin Rodgers |
Subject: | Re: newline doesn't have whitespace syntax? |
Date: | Fri, 12 May 2006 11:13:31 -0600 |
User-agent: | Thunderbird 1.5.0.2 (Windows/20060308) |
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 linefollowing 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
[Prev in Thread] | Current Thread | [Next in Thread] |