all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Loris Bennett" <loris.bennett@fu-berlin.de>
To: emacs-orgmode@gnu.org
Subject: Re: Stackoverflow in regexp matcher
Date: Thu, 04 Feb 2016 08:30:01 +0100	[thread overview]
Message-ID: <87r3gtue4m.fsf@hornfels.zedat.fu-berlin.de> (raw)
In-Reply-To: m2mvrhsmy3.fsf@polytechnique.org

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> 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

Thanks for the fix.

Cheers,

Loris

-- 
This signature is currently under construction.

  reply	other threads:[~2016-02-04  7:30 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
2016-02-04  7:30           ` Loris Bennett [this message]
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=87r3gtue4m.fsf@hornfels.zedat.fu-berlin.de \
    --to=loris.bennett@fu-berlin.de \
    --cc=emacs-orgmode@gnu.org \
    /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.