* [babel] problems with org-babel-src-block-regexp
@ 2010-03-11 17:02 Maurizio Vitale
2010-03-11 17:19 ` [babel] problems with org-babel-src-block-regexp (full text) Maurizio Vitale
0 siblings, 1 reply; 3+ messages in thread
From: Maurizio Vitale @ 2010-03-11 17:02 UTC (permalink / raw)
To: emacs-orgmode
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:
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\\([^
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [babel] problems with org-babel-src-block-regexp (full text)
2010-03-11 17:02 [babel] problems with org-babel-src-block-regexp Maurizio Vitale
@ 2010-03-11 17:19 ` Maurizio Vitale
2010-03-22 17:27 ` Eric Schulte
0 siblings, 1 reply; 3+ messages in thread
From: Maurizio Vitale @ 2010-03-11 17:19 UTC (permalink / raw)
To: emacs-orgmode
[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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [babel] problems with org-babel-src-block-regexp (full text)
2010-03-11 17:19 ` [babel] problems with org-babel-src-block-regexp (full text) Maurizio Vitale
@ 2010-03-22 17:27 ` Eric Schulte
0 siblings, 0 replies; 3+ messages in thread
From: Eric Schulte @ 2010-03-22 17:27 UTC (permalink / raw)
To: maurizio.vitale; +Cc: emacs-orgmode
Hi Maurizio,
Thanks for finding and demonstrating this bug. It should now be fixed.
Best -- Eric
Maurizio Vitale
<mav@cuma.i-did-not-set--mail-host-address--so-tickle-me> writes:
> [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
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-22 21:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-11 17:02 [babel] problems with org-babel-src-block-regexp Maurizio Vitale
2010-03-11 17:19 ` [babel] problems with org-babel-src-block-regexp (full text) Maurizio Vitale
2010-03-22 17:27 ` Eric Schulte
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).