emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-babel-execute-src-block deletes its src block.
Date: Sat, 03 Mar 2012 16:11:14 +0100	[thread overview]
Message-ID: <87d38tn2i5.fsf@gmail.com> (raw)
In-Reply-To: 87k431kah8.fsf@gmx.com

Eric Schulte <eric.schulte@gmx.com> writes:

> Nick Dokos <nicholas.dokos@hp.com> writes:
>
>> Daimrod <daimrod@gmail.com> wrote:
>>
>>> 
>>> Hi, I've recently switched from Org 7.4 to the master branch on the git
>>> repository, and I've encountered this weird situation.
>>> 
>>>   #+name: foo
>>>   #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>> 
>>> If I evaluate this block I get:
>>> 
>>>   #+name: foo
>>> =42
>>> =emacs-lisp
>>> 
>>> Though it works as expected if I remove the name:
>>> 
>>>   #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>> =>
>>>   #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>> 
>>>   #+RESULTS:
>>>   : 42
>>> 
>>> I've tried to figure out what was the problem and it lies in the regexp
>>> org-babel-src-name-w-name-regexp.
>>> 
>>> So far I've found those workarounds:
>>> 
>>> No spaces after the ':'
>>> 
>>>   #+name:foo
>>>   #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>> =>
>>>   #+name:foo
>>>   #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>>   #+RESULTS: foo
>>>   : 42
>>> 
>>> Add parentheses after the name.
>>> 
>>>   #+name: foo()
>>>   #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>> =>
>>>   #+name: foo()
>>>   #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>> 
>>>   #+RESULTS: foo
>>>   : 42
>>> 
>>> No spaces before the src block
>>> 
>>>   #+name: foo
>>> #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>> =>
>>>   #+name: foo
>>> #+begin_src emacs-lisp 
>>>     (defun foo ()
>>>       42)
>>>     (foo)
>>>   #+end_src emacs-lisp
>>> 
>>> #+RESULTS: foo
>>> : 42
>>
>> Bug confirmed (but I didn't try all your workarounds, just the no spaces
>> before the #+begin_src and no space after the colon in the #+name).
>>
>
> This was caused by a commit of mine yesterday, I've just pushed up a fix
> and a protecting test case.
>
> Thanks for catching,

Works nicely.

By the way, org-babel is awesome, thanks for your efforts!

  reply	other threads:[~2012-03-03 15:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-03  4:40 Is it possible to run shell script src blocks as root or to export individual blocks? Leo Alekseyev
2012-03-03  8:55 ` Nick Dokos
2012-03-03  9:19 ` org-babel-execute-src-block deletes its src block Daimrod
2012-03-03  9:42   ` Nick Dokos
2012-03-03  9:54     ` Daimrod
2012-03-03 14:46     ` Eric Schulte
2012-03-03 15:11       ` Daimrod [this message]
2012-03-03 14:25 ` Is it possible to run shell script src blocks as root or to export individual blocks? Eric Schulte
2012-03-03 16:43   ` Andreas Leha
2012-03-05 15:24     ` Eric Schulte
2012-03-06  9:11       ` Andreas Leha
2012-03-19  8:42       ` Leo Alekseyev
2012-03-19 14:46         ` Eric Schulte
2012-03-04 17:29 ` Sylvain Rousseau

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d38tn2i5.fsf@gmail.com \
    --to=daimrod@gmail.com \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).