[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regexp does not work as documented
From: |
Chong Yidong |
Subject: |
Re: regexp does not work as documented |
Date: |
Tue, 06 May 2008 00:20:31 -0400 |
> $ emacs fr.po
> M-x highlight-regexp
>
> Regexp to highlight (enter this with Ctrl-Q Ctrl-J for each of the two
> newlines):
>
> ^msgstr\(\[[0-9]\]\)?.*
> \(".*
> \)*
>
> Highlight using face: hi-yellow
>
> Then move around in the buffer and look which lines are highlighted.
> In the first match already, only 5 out of 11 lines are highlighted.
I believe this bug arises because highlight-regexp uses font-lock to
highlight the regular expression, and the font-lock engine is
intentionally limiting the region to search for the multi-line regular
expression.
OTOH, I don't see what we can do about this problem. Maybe we could add
a note to the docstring of highlight-regexp saying that multi-line
regular expressions are problematic? Does anyone have a suggestion?
BTW, here is a simplified recipe, for those who didn't download the
attached file:
1. Copy the following text, between the "---...----" lines, into a
buffer
------------------
# Messages français pour GNU gettext.
# Copyright © 2006 Free Software Foundation, Inc.
# François Pinard <address@hidden>, 1996.
#
#
msgid ""
msgstr ""
"Project-Id-Version: GNU gettext-tools 0.16.2-pre5\n"
"Report-Msgid-Bugs-To: address@hidden"
"POT-Creation-Date: 2007-11-02 03:23+0100\n"
"PO-Revision-Date: 2007-10-27 13:35+0200\n"
"Last-Translator: Christophe Combelles <address@hidden>\n"
"Language-Team: French <address@hidden>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
------------------
2. M-: (highlight-regexp "^m.*\n\\(\".*\n\\)+") RET
Note that the last two lines remain unhighlighted.
- Re: regexp does not work as documented,
Chong Yidong <=
- Re: regexp does not work as documented, Bruno Haible, 2008/05/06
- Re: regexp does not work as documented, martin rudalics, 2008/05/06
- Re: regexp does not work as documented, David Koppelman, 2008/05/10
- Re: regexp does not work as documented, David Koppelman, 2008/05/10
- Re: regexp does not work as documented, martin rudalics, 2008/05/11
- Re: regexp does not work as documented, Chong Yidong, 2008/05/11
- Re: regexp does not work as documented, David Koppelman, 2008/05/11
- Re: regexp does not work as documented, Stefan Monnier, 2008/05/11
- Re: regexp does not work as documented, David Koppelman, 2008/05/11
- Re: regexp does not work as documented, Stefan Monnier, 2008/05/11