emacs-devel
[Top][All Lists]
Advanced

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

Re: regexp does not work as documented


From: David Koppelman
Subject: Re: regexp does not work as documented
Date: Tue, 06 May 2008 10:00:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Later in the week I'll look into it and provide either a fix
or document the limitation.

Chong Yidong <address@hidden> writes:

> 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?



Chong Yidong <address@hidden> writes:

>> $ 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.




reply via email to

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