emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Stackoverflow in regexp matcher


From: Alan Schmitt
Subject: Re: [O] Stackoverflow in regexp matcher
Date: Wed, 03 Feb 2016 18:50:12 +0100
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/24.5 (darwin)

On 2016-02-03 12:34, "Loris Bennett" <address@hidden> writes:

> Nicolas Goaziou <address@hidden> writes:
>
>> Hello,
>>
>> "Loris Bennett" <address@hidden> 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: signature.asc
Description: PGP signature


reply via email to

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