From: Bruno Haible <bruno@clisp.org>
To: Chong Yidong <cyd@stupidchicken.com>, emacs-devel@gnu.org
Cc: koppel@ece.lsu.edu, 192@emacsbugs.donarmstrong.com
Subject: Re: regexp does not work as documented
Date: Tue, 6 May 2008 13:35:11 +0200 [thread overview]
Message-ID: <200805061335.11379.bruno@clisp.org> (raw)
In-Reply-To: <87k5i8ukq8.fsf@stupidchicken.com>
Chong Yidong wrote:
> 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 <pinard@iro.umontreal.ca>, 1996.
> #
> #
> msgid ""
> msgstr ""
> "Project-Id-Version: GNU gettext-tools 0.16.2-pre5\n"
> "Report-Msgid-Bugs-To: bug-gnu-gettext@gnu.org\n"
> "POT-Creation-Date: 2007-11-02 03:23+0100\n"
> "PO-Revision-Date: 2007-10-27 13:35+0200\n"
> "Last-Translator: Christophe Combelles <ccomb@free.fr>\n"
> "Language-Team: French <traduc@traduc.org>\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.
Yes. I reproduce with this simpler recipe as well. Thank you.
> 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.
You are right that there is a limit, but it is set to 200000:
highlight-regexp is aliased to hi-lock-face-buffer, which asks for the
arguments and calls hi-lock-set-pattern. hi-lock-set-pattern does little
more than applying a margin of 100000 and calling re-search-forward.
I believe the origin of the bug is deeper, because
- the limit of 100000 is way larger than the little snippet you posted,
- I originally observed the bug in po-mode (part of GNU gettext), in
a function po-find-span-of-entry which essentially only calls
re-search-backward and re-search-forward.
> 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?
Can someone help me find a workaround, then? If not, I would have to give up
maintaining po-mode as part of GNU gettext. Said function is central in
Emacs po-mode (everything else relies on it), and if multi-line regular
expressions don't work, I don't know how this function could be rewritten.
Bruno
next prev parent reply other threads:[~2008-05-06 11:35 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-06 4:20 regexp does not work as documented Chong Yidong
2008-05-06 11:35 ` Bruno Haible [this message]
2008-05-06 12:12 ` martin rudalics
2008-05-10 19:18 ` bug#192: " David Koppelman
2008-05-10 19:18 ` David Koppelman
2008-05-10 20:13 ` bug#192: " David Koppelman
2008-05-10 20:13 ` David Koppelman
2008-05-11 7:40 ` martin rudalics
2008-05-11 14:27 ` bug#192: " Chong Yidong
2008-05-11 14:27 ` Chong Yidong
2008-05-11 15:36 ` bug#192: " David Koppelman
2008-05-11 15:36 ` David Koppelman
2008-05-11 18:44 ` Stefan Monnier
2008-05-11 19:09 ` bug#192: " David Koppelman
2008-05-11 19:09 ` David Koppelman
2008-05-12 1:28 ` Stefan Monnier
2008-05-12 15:03 ` bug#192: " David Koppelman
2008-05-12 15:03 ` David Koppelman
2008-05-12 16:29 ` bug#192: " Stefan Monnier
2008-05-12 16:29 ` Stefan Monnier
2008-05-12 17:04 ` bug#192: " David Koppelman
2008-05-12 17:04 ` David Koppelman
2008-05-12 1:28 ` bug#192: " Stefan Monnier
2008-05-11 18:44 ` Stefan Monnier
2008-05-11 18:44 ` Stefan Monnier
2008-05-11 18:44 ` Stefan Monnier
2008-05-11 20:03 ` Thomas Lord
2008-05-12 1:43 ` Stefan Monnier
2008-05-12 3:30 ` Thomas Lord
2008-05-12 13:43 ` Stefan Monnier
2008-05-12 15:55 ` Thomas Lord
2008-05-12 16:18 ` bug#192: " tomas
2008-05-12 16:18 ` tomas
2008-05-12 15:55 ` bug#192: " Thomas Lord
2008-05-12 13:43 ` Stefan Monnier
2008-05-12 3:30 ` Thomas Lord
2008-05-12 1:43 ` Stefan Monnier
2008-05-11 20:03 ` Thomas Lord
2008-05-11 7:40 ` martin rudalics
2008-05-06 15:35 ` Stefan Monnier
2008-05-06 21:29 ` Bruno Haible
2008-05-10 20:04 ` bug#192: " Bruno Haible
2008-05-10 20:04 ` Bruno Haible
2008-05-06 15:00 ` David Koppelman
2008-05-06 21:35 ` Bruno Haible
2008-05-07 1:04 ` Stefan Monnier
2008-05-07 1:08 ` Auto-discovery of multi-line font-lock regexps Stefan Monnier
2008-05-07 3:46 ` Chong Yidong
2008-05-07 4:21 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2008-05-06 1:30 regexp does not work as documented Bruno Haible
2008-05-06 14:15 ` Johan Bockgård
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200805061335.11379.bruno@clisp.org \
--to=bruno@clisp.org \
--cc=192@emacsbugs.donarmstrong.com \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=koppel@ece.lsu.edu \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.