From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Loris Bennett <loris.bennett@fu-berlin.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Stackoverflow in regexp matcher
Date: Wed, 03 Feb 2016 18:50:12 +0100 [thread overview]
Message-ID: <m2mvrhsmy3.fsf@polytechnique.org> (raw)
In-Reply-To: <87y4b2owmm.fsf@hornfels.zedat.fu-berlin.de> (Loris Bennett's message of "Wed, 03 Feb 2016 12:34:41 +0100")
[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]
On 2016-02-03 12:34, "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> Hello,
>>
>> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>>
>>> re-search-forward("^[^%]*\\\\usepackage.*{biblatex}" nil t)
>>
>> This is a pathological regexp. [^%] is anything but a percent sign, so
>> it can contain newline characters. Basically [^%]* can match an entire
>> buffer if it doesn't contain any %.
>>
>> I think the regexp used in `reftex-using-biblatex-p' should be
>>
>> "^[^%\n]*\\\\usepackage.*{biblatex}"
>>
>>
>> Regards,
>
> So should this be filed as a bug against Emacs?
>
> In the meantime, aside from patching my own Emacs, would there be any
> other workaround, particularly considering that I don't currently need
> any biblatex functionality.
This is a known bug:
http://comments.gmane.org/gmane.emacs.auctex.devel/3692
This thread also suggests a fix:
#+begin_src emacs-lisp
(with-eval-after-load 'reftex-parse
(defun reftex-using-biblatex-p ()
"Return non-nil if we are using biblatex rather than bibtex."
(if (boundp 'TeX-active-styles)
;; the sophisticated AUCTeX way
(member "biblatex" TeX-active-styles)
;; poor-man's check...
(save-excursion
(re-search-forward "^[^%\n]*?\\\\usepackage.*{biblatex}" nil t)))))
#+end_src
Best,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated February 1, 2016, Mauna Loa Obs.): 402.43 ppm
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
next prev parent reply other threads:[~2016-02-03 17:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 13:56 Stackoverflow in regexp matcher Loris Bennett
2016-02-02 15:47 ` Nick Dokos
2016-02-03 7:36 ` Loris Bennett
2016-02-03 11:19 ` Nicolas Goaziou
2016-02-03 11:34 ` Loris Bennett
2016-02-03 17:50 ` Alan Schmitt [this message]
2016-02-04 7:30 ` Loris Bennett
2016-02-03 11:44 ` Peter Neilson
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=m2mvrhsmy3.fsf@polytechnique.org \
--to=alan.schmitt@polytechnique.org \
--cc=emacs-orgmode@gnu.org \
--cc=loris.bennett@fu-berlin.de \
/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.