From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Richard Subject: Re: Args out of range: #, 0, 1 Date: Tue, 13 Jan 2015 16:52:04 +0100 Message-ID: <874mrulluj.fsf@yahoo.fr> References: <86iogara9o.fsf@example.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB3lh-0008Ku-PO for emacs-orgmode@gnu.org; Tue, 13 Jan 2015 10:52:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YB3ld-0005lo-Oc for emacs-orgmode@gnu.org; Tue, 13 Jan 2015 10:52:33 -0500 Received: from plane.gmane.org ([80.91.229.3]:45106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB3ld-0005lT-Ha for emacs-orgmode@gnu.org; Tue, 13 Jan 2015 10:52:29 -0500 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YB3lb-0003ow-Jz for emacs-orgmode@gnu.org; Tue, 13 Jan 2015 16:52:27 +0100 In-Reply-To: <86iogara9o.fsf@example.com> (Sebastien Vauban's message of "Tue, 13 Jan 2015 16:05:39 +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: Sebastien Vauban Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org Hello, Sebastien Vauban writes: > I tried to edebug the function `org-babel-demarcate-block' and the error > arises quite at the beginning: on the `match-string 0', on the second > line of the `let*'. The error means we tried to access portions from 0 to 1 in a buffer. That doesn't exist. The reason is that the match data was built when matching on a string (where 0 is a valid position), and we're trying to use it on a buffer. It simply means that we're trying to access the match data without actually checking that we matched something. Reproduce with: (progn (string-match "\\(\\(\\(\\(.\\)\\)\\)\\)" "foo") ; this sets the match data (with-temp-buffer (org-babel-demarcate-block))) ; tries to access the match data, ; but never matched anything successfully > - I can't reproduce it in a minimal Emacs, and there... edebug ends in > an error (I wanted to compare the execution steps), as you can see on > the right screen of http://screencast.com/t/A5ldV2yHNna. > > Why is edebug crashing? Did you perhaps kill the buffer where org-babel-demarcate-block was instrumented for edebug ? > - It seems normal that `org-babel-where-is-src-block-head' returns nil > when we use `C-c C-v C-d' to create the first code block in a buffer > which did not contain any... and it works in my minimal Emacs... (iff > edebug is turned off) > > Any idea of the problem, then? I think the `progn' in org-babel-demarcate-block should be `and'. (I also think that the fact that the match data is set according to org-babel-src-block-regexp when calling org-babel-where-is-src-block-head should be documented in that function. Relying on undocumented side effects is nasty.) HTH, -- Nico