emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Long lines prevent Org mode!


From: Nick Dokos
Subject: Re: [O] Long lines prevent Org mode!
Date: Wed, 08 Jan 2014 01:05:51 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

François Pinard <address@hidden> writes:

> Nick Dokos <address@hidden> writes:
>
>> you can leave org out of the picture altogether: create an empty
>> buffer, insert 33333 x's by hand, go to the beginning and evaluate
>
>>    (looking-at ".*foo")
>
>> As Stefan says in the thread you pointed out, it's a limitation of the
>> emacs regexp engine.
>
> Yes, I got this from his article.  However, it seems that "[^\nf]*foo"
> would succeed, avoiding the stack explosion.  So, it is possible to
> rework the regexpes around the limitation.
>
> Surely not a fun job to do for Org regexpes, I know.  Maybe not worth
> doing as very long lines are unusual, yet maybe worth doing nevertheless
> for Org files because long lines are still possible.  The fact is that I
> was hit by this problem in the Org buffers generated by org-grep.
>

It would be better to reimplement the regexp engine using e.g. an NDFA.
IIRC, it requires constant stack but it limits the regexps allowed. See
e.g.

        http://swtch.com/~rsc/regexp/regexp1.html

It might make sense to pair the NDFA with a backtracker. The pattern
compiler could then choose which one to use based on the regexp.

-- 
Nick




reply via email to

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