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

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

flush-lines and regexp problems with emacs 22.0.x


From: Vincent Lefevre
Subject: flush-lines and regexp problems with emacs 22.0.x
Date: Tue, 16 Jan 2007 05:03:27 +0100
User-agent: Mutt/1.5.13-vl-r14963 (2007-01-09)

Hi,

I get strange results with flush-lines. The first one may be due to
a lack of clear documentation, but I'm pretty sure the second one is
a bug.

The following tests have been done with GNU Emacs 22.0.50.1 under
Mac OS X (MacPorts) and with GNU Emacs 22.0.92.1 under GNU/Linux
(Debian package emacs-snapshot).

1. Consider the following file:

--------------------
> test 1
> foo
  
blah
> test 2
> foo
> foobar

blah
--------------------

where the cursor is a the top. I evaluate (with "M-:") the following:

  (flush-lines "^\\(> \n\\)*> foo\n\\(\n?> .*\\)*")

and I get:

--------------------
> test 1
blah
> test 2

blah
--------------------

instead of

--------------------
> test 1

blah
> test 2

blah
--------------------

I'd say that the blank line shouldn't be deleted because nothing is
matched on it. But the end point is on this line, so I'm not sure.
The flush-lines documentation is not clear about that.

2. Now consider the following file:

--------------------
> test 1
> foo

blah
> test 2
> foo
> bar
> foobar

blah
> test 3
> foobar

blah
--------------------

(flush-lines "^\\(> \n\\)*> foo$\\(\n> .*\\)*") has no effect on it.
(flush-lines "^\\(> \n\\)*> foo\\($\\|\\(\n> .*\\)+\\)") doesn't have
any effect either, but if I permute the both sides of the "|", i.e.

  (flush-lines "^\\(> \n\\)*> foo\\(\\(\n> .*\\)+\\|$\\)")

then I get:

--------------------
> test 1

blah
> test 2

blah
> test 3
> foobar

blah
--------------------

as expected.

Regards,

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)




reply via email to

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