From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Long lines prevent Org mode! Date: Wed, 08 Jan 2014 01:05:51 -0500 Message-ID: <87wqibypmo.fsf@gmail.com> References: <87txdfw9ij.fsf@iro.umontreal.ca> <87d2k313wc.fsf@gmail.com> <87ha9fvyjm.fsf@iro.umontreal.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0mHT-0000gy-Fn for emacs-orgmode@gnu.org; Wed, 08 Jan 2014 01:06:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0mHE-0000Ya-CK for emacs-orgmode@gnu.org; Wed, 08 Jan 2014 01:06:19 -0500 Received: from plane.gmane.org ([80.91.229.3]:56325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0mHE-0000Y9-5L for emacs-orgmode@gnu.org; Wed, 08 Jan 2014 01:06:04 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W0mHC-0001FY-MS for emacs-orgmode@gnu.org; Wed, 08 Jan 2014 07:06:02 +0100 Received: from pool-98-110-175-184.bstnma.fios.verizon.net ([98.110.175.184]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jan 2014 07:06:02 +0100 Received: from ndokos by pool-98-110-175-184.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jan 2014 07:06:02 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org François Pinard writes: > Nick Dokos 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