[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Whitespace search and regex.c
From: |
Juri Linkov |
Subject: |
Re: Whitespace search and regex.c |
Date: |
Sun, 05 Dec 2004 17:33:18 +0200 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
I have no strong opinion on whether changing regex.c was a good thing
or not (after all, Perl already entered on the same path where its regexp
engine is modified every time someone fells a need to add a new feature.
BTW, setting `search-spaces-regexp' to the empty string would allow
to improve Emacs regexp readability similar to the /x modifier in Perl
regexps. I won't elaborate on how useful it is, but I always wished
that Emacs regexps would use features of Perl regexps).
Anyhow, I want to note that there is a bug in the current
implementation of `search-spaces-regexp' feature. The space
at the end of a regexp is interpreted literally, not as a whitespace
specified by `search-spaces-regexp'. Whereas the space in the
middle or at the beginning of a regexp is interpreted correctly
(i.e. as a special whitespace character).
Test case:
(let ((search-spaces-regexp "\\s-+")) (re-search-forward "a b"))
finds the first line in the test text below (CORRECT).
(let ((search-spaces-regexp "\\s-+")) (re-search-forward "a "))
finds the second line in the test text below (INCORRECT, it should find
the first line).
Test text:
a b (has TAB between `a' and `b')
a b (has SPC between `a' and `b')
--
Juri Linkov
http://www.jurta.org/emacs/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Whitespace search and regex.c,
Juri Linkov <=