DONE src block regexp fails if block contains block delimiters
- State "DONE" from "TODO"
- State "TODO" from ""
this appears to be fixed now…
(concat "#+begin_src\n" "hello\n" "#+end_src\n")
used to be that C-c C-c \rightarrow End of file during parsing
report by Maurizio Vitale
From: Maurizio Vitale <mav@cuma.i-did-not-set--mail-host-address--so-tickle-me> Subject: [Orgmode] Re: [babel] problems with org-babel-src-block-regexp (full text) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Date: Thu, 11 Mar 2010 12:19:09 -0500 To: emacs-orgmode@gnu.org [sorry for the double posting, but the control char in the regexp prevented the full message from appearing. This is what I meant to send] There're problems with org-babel-src-block-regexp when the src block contains the block delimiters (for instance in strings or comments). Granted, this is an uncommon occurrence (which I discovered by accident) editing an org-file containing elisp code that needed to insert #+begin_src...#+end_src pairs, but if it is not too difficult to fix it would be nice to have a more useful behaviour. This is my setting (replaced 0x0 with ^@ to avoid posting problems): org-babel-src-block-regexp is a variable defined in `org-babel.el'. Its value is "^[ ]*#\\+begin_src[ ]+\\(python\\|sh\\|emacs-lisp\\)[ ]*\\([^\":\n]*\"[^\"\n*]*\"[^\":\n]*\\|[^\":\n]*\\)\\([^\n]*\\)\n\\([^^@]+?\\)#\\+end_src" And these are two test cases. I'm particularly puzzled by the first, because the regexp seems to be anchored to the begin of line and hence it shouldn't match the begin_src inside the string. For end_src, it should probably be anchored to the begin of line. #+begin_src emacs-lisp ;;; evaluating the following C-x C-e with the point at the end is ok (org-babel-where-is-src-block-head) (defun foo () (insert "#+begin_src emacs-lisp")) ;;; evaluating the following C-x C-e with the point at the end is not ok (org-babel-where-is-src-block-head) #+end_src #+begin_src emacs-lisp ;;; evaluating the following C-x C-e with the point at the end is ok (org-babel-where-is-src-block-head) (defun foo () (insert "#+end_src emacs-lisp")) ;;; evaluating the following C-x C-e with the point at the end is not ok (org-babel-where-is-src-block-head) #+end_src Best regards, Maurizio