From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [Babel] org-babel-execute-buffer gives different results than org-babel-exp-non-block-elements Date: Fri, 23 Aug 2013 01:06:44 +0200 Message-ID: <87siy1jpff.fsf@gmail.com> References: <87y57twot4.fsf@gmail.com> <87ppt5wjn1.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCdxj-0002FX-Fl for emacs-orgmode@gnu.org; Thu, 22 Aug 2013 19:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCdxY-0002BJ-Nk for emacs-orgmode@gnu.org; Thu, 22 Aug 2013 19:06:43 -0400 Received: from mail-we0-x22b.google.com ([2a00:1450:400c:c03::22b]:55348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCdxY-0002B7-Hr for emacs-orgmode@gnu.org; Thu, 22 Aug 2013 19:06:32 -0400 Received: by mail-we0-f171.google.com with SMTP id p57so2122457wes.2 for ; Thu, 22 Aug 2013 16:06:31 -0700 (PDT) In-Reply-To: (Nicolas Girard's message of "Thu, 22 Aug 2013 23:01:45 +0200") 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: Nicolas Girard Cc: emacs-orgmode Nicolas Girard writes: > I'm ashamed... but this time I swear I started a minimal emacs session > and got it to work. The instructions have slightly changed and are > written at the very beginning of the attached minimal document. I see. There is an important difference between evaluating a buffer and evaluating a buffer during export. In the latter, Babel has to deal with replacement values, i.e., code block is replaced by its results. See the difference between `org-export-execute-babel-code' and `org-babel-execute-buffer' in a buffer containing only src_emacs-lisp[:results raw]{(+ 1 2)} In this case, your code removes the code (and much more) as a side-effect. This confuses `org-babel-exp-non-block-elements', which also tries to remove it. As this fails, it removes a random part of the buffer instead (probably as a mean revenge). `org-babel-exp-non-block-elements' and `org-babel-exp-process-buffer' could probably check if code still exists before trying to remove (and replace) it. Regards, -- Nicolas Goaziou