From: Vincent Lefevre <vincent@vinc17.org>
Subject: flush-lines and regexp problems with emacs 22.0.x
Date: Tue, 16 Jan 2007 05:03:27 +0100 [thread overview]
Message-ID: <20070116040327.GP10583@prunille.vinc17.org> (raw)
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)
next reply other threads:[~2007-01-16 4:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-16 4:03 Vincent Lefevre [this message]
2007-01-17 2:18 ` flush-lines and regexp problems with emacs 22.0.x Richard Stallman
2007-01-17 4:26 ` Vincent Lefevre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070116040327.GP10583@prunille.vinc17.org \
--to=vincent@vinc17.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).