emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org Babel Bug
@ 2010-02-09 11:06 Ian Barton
  2010-02-09 15:21 ` Dan Davison
  2010-02-09 16:54 ` Eric Schulte
  0 siblings, 2 replies; 6+ messages in thread
From: Ian Barton @ 2010-02-09 11:06 UTC (permalink / raw)
  To: emacs-orgmode

I am using Babel to maintein my .emacs file. When I try to publish I am 
getting a Babel error from one of my org files. The offending section of 
the org file seems to be:

#+BEGIN_SRC emacs-shell
   127.0.0.1 mail.wilkesley.org localhost

   # The following lines are desirable for IPv6 capable hosts
   ::1 ip6-localhost ip6-loopback
   fe00::0 ip6-localnet
   ff00::0 ip6-mcastprefix
   ff02::1 ip6-allnodes
   ff02::2 ip6-allrouters
   ff02::3 ip6-allhosts

#+END_SRC

I am using a recent git checkout of org and GNU Emacs 23.1.50.1 
(x86_64-pc-linux-gnu, GTK+ Version 2.18.0).

The backtrace is:

Debugger entered--Lisp error: (error "Unmatched block [bug in 
`org-babel-exp-src-blocks'].")
   signal(error ("Unmatched block [bug in `org-babel-exp-src-blocks']."))
   error("Unmatched block [bug in `org-babel-exp-src-blocks'].")
   (or (and (re-search-backward org-babel-src-block-regexp ... t) (setq 
progress-marker ...) (org-babel-exp-do-export ... ...)) (save-excursion 
(forward-line 0) (and ... ... ...)) (and (re-search-backward 
org-block-regexp ... t) (setq progress-marker ...) (match-string 0)) 
(error "Unmatched block [bug in `org-babel-exp-src-blocks']."))
   (progn (fset (quote cond-progress-marker) (function* ...)) (or (and 
... ... ...) (save-excursion ... ...) (and ... ... ...) (error 
"Unmatched block [bug in `org-babel-exp-src-blocks'].")))
   (unwind-protect (progn (fset ... ...) (or ... ... ... ...)) (if 
--cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
   (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) 
(unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...)))
   (letf ((... ...)) (or (and ... ... ...) (save-excursion ... ...) (and 
... ... ...) (error "Unmatched block [bug in 
`org-babel-exp-src-blocks'].")))
   (letf* ((... ...)) (or (and ... ... ...) (save-excursion ... ...) 
(and ... ... ...) (error "Unmatched block [bug in 
`org-babel-exp-src-blocks'].")))
   (flet ((cond-progress-marker nil ...)) (or (and ... ... ...) 
(save-excursion ... ...) (and ... ... ...) (error "Unmatched block [bug 
in `org-babel-exp-src-blocks'].")))
   org-babel-exp-src-blocks(#("127.0.0.1 mail.wilkesley.org 
localhost\n\n# The following lines are desirable for IPv6 capable 
hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 
ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3 
ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified 
nil)))
   apply(org-babel-exp-src-blocks #("127.0.0.1 mail.wilkesley.org 
localhost\n\n# The following lines are desirable for IPv6 capable 
hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 
ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3 
ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified 
nil)))
 
byte-code("\306\307\211\211\211\211\211\211\211\211\x18\x19\x1a^[\x1c\x1d\x1e#\x1e$\x1e%\x1e&\310\311!\211\x1e'\205#

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Org Babel Bug
  2010-02-09 11:06 Org Babel Bug Ian Barton
@ 2010-02-09 15:21 ` Dan Davison
  2010-02-09 17:29   ` Dan Davison
  2010-02-09 16:54 ` Eric Schulte
  1 sibling, 1 reply; 6+ messages in thread
From: Dan Davison @ 2010-02-09 15:21 UTC (permalink / raw)
  To: lists; +Cc: emacs-orgmode

Ian Barton <lists@manor-farm.org> writes:

> I am using Babel to maintein my .emacs file. When I try to publish I
> am getting a Babel error from one of my org files. The offending
> section of the org file seems to be:
>
> #+BEGIN_SRC emacs-shell

Hi Ian,

I don't think org-babel supports a language "emacs-shell". I'm curious
though; what do these lines do?  Do let us know if there is something
that you feel might be a good feature to add.

Dan


>   127.0.0.1 mail.wilkesley.org localhost
>
>   # The following lines are desirable for IPv6 capable hosts
>   ::1 ip6-localhost ip6-loopback
>   fe00::0 ip6-localnet
>   ff00::0 ip6-mcastprefix
>   ff02::1 ip6-allnodes
>   ff02::2 ip6-allrouters
>   ff02::3 ip6-allhosts
>
> #+END_SRC
>
> I am using a recent git checkout of org and GNU Emacs 23.1.50.1
> (x86_64-pc-linux-gnu, GTK+ Version 2.18.0).
>
> The backtrace is:
>
> Debugger entered--Lisp error: (error "Unmatched block [bug in
> org-babel-exp-src-blocks'].")
>   signal(error ("Unmatched block [bug in `org-babel-exp-src-blocks']."))
>   error("Unmatched block [bug in `org-babel-exp-src-blocks'].")
>   (or (and (re-search-backward org-babel-src-block-regexp ... t) (setq
> progress-marker ...) (org-babel-exp-do-export ... ...))
> (save-excursion (forward-line 0) (and ... ... ...)) (and
> (re-search-backward org-block-regexp ... t) (setq progress-marker ...)
> (match-string 0)) (error "Unmatched block [bug in
> org-babel-exp-src-blocks']."))
>   (progn (fset (quote cond-progress-marker) (function* ...)) (or (and
> ... ... ...) (save-excursion ... ...) (and ... ... ...) (error
> "Unmatched block [bug in `org-babel-exp-src-blocks'].")))
>   (unwind-protect (progn (fset ... ...) (or ... ... ... ...)) (if
> --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
>   (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...))
> (unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...)))
>   (letf ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
> (and ... ... ...) (error "Unmatched block [bug in
> org-babel-exp-src-blocks'].")))
>   (letf* ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
> (and ... ... ...) (error "Unmatched block [bug in
> org-babel-exp-src-blocks'].")))
>   (flet ((cond-progress-marker nil ...)) (or (and ... ... ...)
> (save-excursion ... ...) (and ... ... ...) (error "Unmatched block
> [bug in `org-babel-exp-src-blocks'].")))
>   org-babel-exp-src-blocks(#("127.0.0.1 mail.wilkesley.org
> localhost\n\n# The following lines are desirable for IPv6 capable
> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
> nil)))
>   apply(org-babel-exp-src-blocks #("127.0.0.1 mail.wilkesley.org
> localhost\n\n# The following lines are desirable for IPv6 capable
> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
> nil)))
>
> byte-code("\306\307\211\211\211\211\211\211\211\211.\x19.^[.\x1d.#.$.%.&\310\311!\211.'\205#
>
>
> _______________________________________________
> 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] 6+ messages in thread

* Re: Org Babel Bug
  2010-02-09 11:06 Org Babel Bug Ian Barton
  2010-02-09 15:21 ` Dan Davison
@ 2010-02-09 16:54 ` Eric Schulte
  2010-02-10  2:11   ` Eric Schulte
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Schulte @ 2010-02-09 16:54 UTC (permalink / raw)
  To: lists; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Hi Ian,

The implementation of our block exportation has been bothering me for
some time now.  The attached patch *greatly* simplifies the exportation
code.  Could you please give it a try and let me know if it fixes your
bug?

If so I will apply it to the main repository.

Thanks -- Eric


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: simpler-exports.patch --]
[-- Type: text/x-diff, Size: 2805 bytes --]

diff --git a/contrib/babel/lisp/org-babel-exp.el b/contrib/babel/lisp/org-babel-exp.el
index 8ce52b6..b299d57 100644
--- a/contrib/babel/lisp/org-babel-exp.el
+++ b/contrib/babel/lisp/org-babel-exp.el
@@ -73,20 +73,10 @@ results - just like none only the block is run on export ensuring
 none ----- do not display either code or results upon export"
   (interactive)
   (message "org-babel-exp processing...")
-  (flet ((cond-progress-marker () (when (and progress-marker (< progress-marker (point)))
-                                   progress-marker)))
-    (or (and (re-search-backward org-babel-src-block-regexp (cond-progress-marker) t)
-             (setq progress-marker (match-end 0))
-             (org-babel-exp-do-export (org-babel-get-src-block-info) 'block))
-        (save-excursion
-          (forward-line 0)
-          (and (org-babel-where-is-src-block-head)
-               (goto-char (org-babel-where-is-src-block-head))
-               (org-babel-exp-do-export (org-babel-get-src-block-info) 'block)))
-        (and (re-search-backward org-block-regexp (cond-progress-marker) t)
-             (setq progress-marker (match-end 0))
-             (match-string 0))
-        (error "Unmatched block [bug in `org-babel-exp-src-blocks']."))))
+  (when (member (first headers) org-babel-interpreters)
+    (save-excursion
+      (goto-char (match-beginning 0))
+      (org-babel-exp-do-export (org-babel-get-src-block-info) 'block))))
 
 (defun org-babel-exp-inline-src-blocks (start end)
   "Process inline src blocks between START and END for export.
diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el
index 1d43d3a..af53b60 100644
--- a/lisp/org-exp-blocks.el
+++ b/lisp/org-exp-blocks.el
@@ -183,13 +183,15 @@ specified in BLOCKS which default to the value of
 	    (setq body (save-match-data (org-remove-indentation body))))
 	  (unless (memq type types) (setq types (cons type types)))
 	  (save-match-data (interblock start (match-beginning 0)))
-	  (if (setq func (cadr (assoc type org-export-blocks)))
-	      (progn
-                (replace-match (save-match-data
+	  (when (setq func (cadr (assoc type org-export-blocks)))
+            (let ((replacement (save-match-data
                                  (if (memq type org-export-blocks-witheld) ""
-                                   (apply func body headers))) t t)
+                                   (apply func body headers)))))
+              (when replacement
+                (replace-match replacement t t)
                 (unless preserve-indent
-		  (indent-code-rigidly (match-beginning 0) (match-end 0) indentation))))
+                  (indent-code-rigidly
+                   (match-beginning 0) (match-end 0) indentation)))))
 	  (setq start (match-end 0)))
 	(interblock start (point-max))))))
 

[-- Attachment #3: Type: text/plain, Size: 3227 bytes --]


Ian Barton <lists@manor-farm.org> writes:

> I am using Babel to maintein my .emacs file. When I try to publish I
> am getting a Babel error from one of my org files. The offending
> section of the org file seems to be:
>
> #+BEGIN_SRC emacs-shell
>   127.0.0.1 mail.wilkesley.org localhost
>
>   # The following lines are desirable for IPv6 capable hosts
>   ::1 ip6-localhost ip6-loopback
>   fe00::0 ip6-localnet
>   ff00::0 ip6-mcastprefix
>   ff02::1 ip6-allnodes
>   ff02::2 ip6-allrouters
>   ff02::3 ip6-allhosts
>
> #+END_SRC
>
> I am using a recent git checkout of org and GNU Emacs 23.1.50.1
> (x86_64-pc-linux-gnu, GTK+ Version 2.18.0).
>
> The backtrace is:
>
> Debugger entered--Lisp error: (error "Unmatched block [bug in
> org-babel-exp-src-blocks'].")
>   signal(error ("Unmatched block [bug in `org-babel-exp-src-blocks']."))
>   error("Unmatched block [bug in `org-babel-exp-src-blocks'].")
>   (or (and (re-search-backward org-babel-src-block-regexp ... t) (setq
> progress-marker ...) (org-babel-exp-do-export ... ...))
> (save-excursion (forward-line 0) (and ... ... ...)) (and
> (re-search-backward org-block-regexp ... t) (setq progress-marker ...)
> (match-string 0)) (error "Unmatched block [bug in
> org-babel-exp-src-blocks']."))
>   (progn (fset (quote cond-progress-marker) (function* ...)) (or (and
> ... ... ...) (save-excursion ... ...) (and ... ... ...) (error
> "Unmatched block [bug in `org-babel-exp-src-blocks'].")))
>   (unwind-protect (progn (fset ... ...) (or ... ... ... ...)) (if
> --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
>   (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...))
> (unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...)))
>   (letf ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
> (and ... ... ...) (error "Unmatched block [bug in
> org-babel-exp-src-blocks'].")))
>   (letf* ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
> (and ... ... ...) (error "Unmatched block [bug in
> org-babel-exp-src-blocks'].")))
>   (flet ((cond-progress-marker nil ...)) (or (and ... ... ...)
> (save-excursion ... ...) (and ... ... ...) (error "Unmatched block
> [bug in `org-babel-exp-src-blocks'].")))
>   org-babel-exp-src-blocks(#("127.0.0.1 mail.wilkesley.org
> localhost\n\n# The following lines are desirable for IPv6 capable
> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
> nil)))
>   apply(org-babel-exp-src-blocks #("127.0.0.1 mail.wilkesley.org
> localhost\n\n# The following lines are desirable for IPv6 capable
> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
> nil)))
>
> byte-code("\306\307\211\211\211\211\211\211\211\211.\x19.^[.\x1d.#.$.%.&\310\311!\211.'\205#
>
>
> _______________________________________________
> 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

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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 related	[flat|nested] 6+ messages in thread

* Re: Org Babel Bug
  2010-02-09 15:21 ` Dan Davison
@ 2010-02-09 17:29   ` Dan Davison
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Davison @ 2010-02-09 17:29 UTC (permalink / raw)
  To: lists; +Cc: emacs-orgmode

Dan Davison <davison@stats.ox.ac.uk> writes:

> Ian Barton <lists@manor-farm.org> writes:
>
>> I am using Babel to maintein my .emacs file. When I try to publish I
>> am getting a Babel error from one of my org files. The offending
>> section of the org file seems to be:
>>
>> #+BEGIN_SRC emacs-shell
>
> Hi Ian,
>
> I don't think org-babel supports a language "emacs-shell".

Sorry, I think I may have missed the point of your report. org-babel
tangling and export procedures should of course proceed without problems
in the presence of an unknown language block. Could you provide an
example file in which the error occurs? Are you sure that all blocks in
the file are started/terminated correctly? I tried the test file below
containing your emacs-shell block and, for me, it tangles correctly
(just the two emacs lisp blocks), and exports to HTML (all three
blocks), and org-babel-load-file works on it (the two variables have
their values set). Does it work for you?

Dan

--------------------------------------------------------------------
* testblock 1
#+begin_src emacs-lisp
(setq testvar1 'testval1) 
#+end_src

* emacs-shell block
#+BEGIN_SRC emacs-shell
  127.0.0.1 mail.wilkesley.org localhost

  # The following lines are desirable for IPv6 capable hosts
  ::1 ip6-localhost ip6-loopback
  fe00::0 ip6-localnet
  ff00::0 ip6-mcastprefix
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  ff02::3 ip6-allhosts

#+END_SRC

* test block 2
#+begin_src emacs-lisp
(setq testvar2 'testval2) 
#+end_src
--------------------------------------------------------------------


> I'm curious
> though; what do these lines do?  Do let us know if there is something
> that you feel might be a good feature to add.
>
> Dan
>
>
>>   127.0.0.1 mail.wilkesley.org localhost
>>
>>   # The following lines are desirable for IPv6 capable hosts
>>   ::1 ip6-localhost ip6-loopback
>>   fe00::0 ip6-localnet
>>   ff00::0 ip6-mcastprefix
>>   ff02::1 ip6-allnodes
>>   ff02::2 ip6-allrouters
>>   ff02::3 ip6-allhosts
>>
>> #+END_SRC
>>
>> I am using a recent git checkout of org and GNU Emacs 23.1.50.1
>> (x86_64-pc-linux-gnu, GTK+ Version 2.18.0).
>>
>> The backtrace is:
>>
>> Debugger entered--Lisp error: (error "Unmatched block [bug in
>> org-babel-exp-src-blocks'].")
>>   signal(error ("Unmatched block [bug in `org-babel-exp-src-blocks']."))
>>   error("Unmatched block [bug in `org-babel-exp-src-blocks'].")
>>   (or (and (re-search-backward org-babel-src-block-regexp ... t) (setq
>> progress-marker ...) (org-babel-exp-do-export ... ...))
>> (save-excursion (forward-line 0) (and ... ... ...)) (and
>> (re-search-backward org-block-regexp ... t) (setq progress-marker ...)
>> (match-string 0)) (error "Unmatched block [bug in
>> org-babel-exp-src-blocks']."))
>>   (progn (fset (quote cond-progress-marker) (function* ...)) (or (and
>> ... ... ...) (save-excursion ... ...) (and ... ... ...) (error
>> "Unmatched block [bug in `org-babel-exp-src-blocks'].")))
>>   (unwind-protect (progn (fset ... ...) (or ... ... ... ...)) (if
>> --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
>>   (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...))
>> (unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...)))
>>   (letf ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
>> (and ... ... ...) (error "Unmatched block [bug in
>> org-babel-exp-src-blocks'].")))
>>   (letf* ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
>> (and ... ... ...) (error "Unmatched block [bug in
>> org-babel-exp-src-blocks'].")))
>>   (flet ((cond-progress-marker nil ...)) (or (and ... ... ...)
>> (save-excursion ... ...) (and ... ... ...) (error "Unmatched block
>> [bug in `org-babel-exp-src-blocks'].")))
>>   org-babel-exp-src-blocks(#("127.0.0.1 mail.wilkesley.org
>> localhost\n\n# The following lines are desirable for IPv6 capable
>> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
>> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
>> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
>> nil)))
>>   apply(org-babel-exp-src-blocks #("127.0.0.1 mail.wilkesley.org
>> localhost\n\n# The following lines are desirable for IPv6 capable
>> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
>> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
>> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
>> nil)))
>>
>> byte-code("\306\307\211\211\211\211\211\211\211\211.......#.$.%.&\310\311!\211.'\205#
>>
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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] 6+ messages in thread

* Re: Org Babel Bug
  2010-02-09 16:54 ` Eric Schulte
@ 2010-02-10  2:11   ` Eric Schulte
  2010-02-11 10:11     ` Ian Barton
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Schulte @ 2010-02-10  2:11 UTC (permalink / raw)
  To: lists; +Cc: emacs-orgmode

Hi,

Since the patch below greatly simplifies the code, and it has worked in
all my tests, I'm going to apply it now.

Please do let me know if the export problems persist.

Best -- Eric

"Eric Schulte" <schulte.eric@gmail.com> writes:

> Hi Ian,
>
> The implementation of our block exportation has been bothering me for
> some time now.  The attached patch *greatly* simplifies the exportation
> code.  Could you please give it a try and let me know if it fixes your
> bug?
>
> If so I will apply it to the main repository.
>
> Thanks -- Eric
>
>
> diff --git a/contrib/babel/lisp/org-babel-exp.el b/contrib/babel/lisp/org-babel-exp.el
> index 8ce52b6..b299d57 100644
> --- a/contrib/babel/lisp/org-babel-exp.el
> +++ b/contrib/babel/lisp/org-babel-exp.el
> @@ -73,20 +73,10 @@ results - just like none only the block is run on export ensuring
>  none ----- do not display either code or results upon export"
>    (interactive)
>    (message "org-babel-exp processing...")
> -  (flet ((cond-progress-marker () (when (and progress-marker (< progress-marker (point)))
> -                                   progress-marker)))
> -    (or (and (re-search-backward org-babel-src-block-regexp (cond-progress-marker) t)
> -             (setq progress-marker (match-end 0))
> -             (org-babel-exp-do-export (org-babel-get-src-block-info) 'block))
> -        (save-excursion
> -          (forward-line 0)
> -          (and (org-babel-where-is-src-block-head)
> -               (goto-char (org-babel-where-is-src-block-head))
> -               (org-babel-exp-do-export (org-babel-get-src-block-info) 'block)))
> -        (and (re-search-backward org-block-regexp (cond-progress-marker) t)
> -             (setq progress-marker (match-end 0))
> -             (match-string 0))
> -        (error "Unmatched block [bug in `org-babel-exp-src-blocks']."))))
> +  (when (member (first headers) org-babel-interpreters)
> +    (save-excursion
> +      (goto-char (match-beginning 0))
> +      (org-babel-exp-do-export (org-babel-get-src-block-info) 'block))))
>  
>  (defun org-babel-exp-inline-src-blocks (start end)
>    "Process inline src blocks between START and END for export.
> diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el
> index 1d43d3a..af53b60 100644
> --- a/lisp/org-exp-blocks.el
> +++ b/lisp/org-exp-blocks.el
> @@ -183,13 +183,15 @@ specified in BLOCKS which default to the value of
>  	    (setq body (save-match-data (org-remove-indentation body))))
>  	  (unless (memq type types) (setq types (cons type types)))
>  	  (save-match-data (interblock start (match-beginning 0)))
> -	  (if (setq func (cadr (assoc type org-export-blocks)))
> -	      (progn
> -                (replace-match (save-match-data
> +	  (when (setq func (cadr (assoc type org-export-blocks)))
> +            (let ((replacement (save-match-data
>                                   (if (memq type org-export-blocks-witheld) ""
> -                                   (apply func body headers))) t t)
> +                                   (apply func body headers)))))
> +              (when replacement
> +                (replace-match replacement t t)
>                  (unless preserve-indent
> -		  (indent-code-rigidly (match-beginning 0) (match-end 0) indentation))))
> +                  (indent-code-rigidly
> +                   (match-beginning 0) (match-end 0) indentation)))))
>  	  (setq start (match-end 0)))
>  	(interblock start (point-max))))))
>  
>
>
> Ian Barton <lists@manor-farm.org> writes:
>
>> I am using Babel to maintein my .emacs file. When I try to publish I
>> am getting a Babel error from one of my org files. The offending
>> section of the org file seems to be:
>>
>> #+BEGIN_SRC emacs-shell
>>   127.0.0.1 mail.wilkesley.org localhost
>>
>>   # The following lines are desirable for IPv6 capable hosts
>>   ::1 ip6-localhost ip6-loopback
>>   fe00::0 ip6-localnet
>>   ff00::0 ip6-mcastprefix
>>   ff02::1 ip6-allnodes
>>   ff02::2 ip6-allrouters
>>   ff02::3 ip6-allhosts
>>
>> #+END_SRC
>>
>> I am using a recent git checkout of org and GNU Emacs 23.1.50.1
>> (x86_64-pc-linux-gnu, GTK+ Version 2.18.0).
>>
>> The backtrace is:
>>
>> Debugger entered--Lisp error: (error "Unmatched block [bug in
>> org-babel-exp-src-blocks'].")
>>   signal(error ("Unmatched block [bug in `org-babel-exp-src-blocks']."))
>>   error("Unmatched block [bug in `org-babel-exp-src-blocks'].")
>>   (or (and (re-search-backward org-babel-src-block-regexp ... t) (setq
>> progress-marker ...) (org-babel-exp-do-export ... ...))
>> (save-excursion (forward-line 0) (and ... ... ...)) (and
>> (re-search-backward org-block-regexp ... t) (setq progress-marker ...)
>> (match-string 0)) (error "Unmatched block [bug in
>> org-babel-exp-src-blocks']."))
>>   (progn (fset (quote cond-progress-marker) (function* ...)) (or (and
>> ... ... ...) (save-excursion ... ...) (and ... ... ...) (error
>> "Unmatched block [bug in `org-babel-exp-src-blocks'].")))
>>   (unwind-protect (progn (fset ... ...) (or ... ... ... ...)) (if
>> --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
>>   (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...))
>> (unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...)))
>>   (letf ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
>> (and ... ... ...) (error "Unmatched block [bug in
>> org-babel-exp-src-blocks'].")))
>>   (letf* ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
>> (and ... ... ...) (error "Unmatched block [bug in
>> org-babel-exp-src-blocks'].")))
>>   (flet ((cond-progress-marker nil ...)) (or (and ... ... ...)
>> (save-excursion ... ...) (and ... ... ...) (error "Unmatched block
>> [bug in `org-babel-exp-src-blocks'].")))
>>   org-babel-exp-src-blocks(#("127.0.0.1 mail.wilkesley.org
>> localhost\n\n# The following lines are desirable for IPv6 capable
>> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
>> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
>> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
>> nil)))
>>   apply(org-babel-exp-src-blocks #("127.0.0.1 mail.wilkesley.org
>> localhost\n\n# The following lines are desirable for IPv6 capable
>> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
>> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
>> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
>> nil)))
>>
>> byte-code("\306\307\211\211\211\211\211\211\211\211.......#.$.%.&\310\311!\211.'\205#
>>
>>
>> _______________________________________________
>> 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] 6+ messages in thread

* Re: Org Babel Bug
  2010-02-10  2:11   ` Eric Schulte
@ 2010-02-11 10:11     ` Ian Barton
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Barton @ 2010-02-11 10:11 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Hi Eric,

I have been away from my own computer for a while. I have just applied 
the patch and it works for me. Thanks!

Ian.

> Since the patch below greatly simplifies the code, and it has worked in
> all my tests, I'm going to apply it now.
> 
> Please do let me know if the export problems persist.
> 
> Best -- Eric
> 
> "Eric Schulte" <schulte.eric@gmail.com> writes:
> 
>> Hi Ian,
>>
>> The implementation of our block exportation has been bothering me for
>> some time now.  The attached patch *greatly* simplifies the exportation
>> code.  Could you please give it a try and let me know if it fixes your
>> bug?
>>
>> If so I will apply it to the main repository.
>>
>> Thanks -- Eric
>>
>>
>> diff --git a/contrib/babel/lisp/org-babel-exp.el b/contrib/babel/lisp/org-babel-exp.el
>> index 8ce52b6..b299d57 100644
>> --- a/contrib/babel/lisp/org-babel-exp.el
>> +++ b/contrib/babel/lisp/org-babel-exp.el
>> @@ -73,20 +73,10 @@ results - just like none only the block is run on export ensuring
>>  none ----- do not display either code or results upon export"
>>    (interactive)
>>    (message "org-babel-exp processing...")
>> -  (flet ((cond-progress-marker () (when (and progress-marker (< progress-marker (point)))
>> -                                   progress-marker)))
>> -    (or (and (re-search-backward org-babel-src-block-regexp (cond-progress-marker) t)
>> -             (setq progress-marker (match-end 0))
>> -             (org-babel-exp-do-export (org-babel-get-src-block-info) 'block))
>> -        (save-excursion
>> -          (forward-line 0)
>> -          (and (org-babel-where-is-src-block-head)
>> -               (goto-char (org-babel-where-is-src-block-head))
>> -               (org-babel-exp-do-export (org-babel-get-src-block-info) 'block)))
>> -        (and (re-search-backward org-block-regexp (cond-progress-marker) t)
>> -             (setq progress-marker (match-end 0))
>> -             (match-string 0))
>> -        (error "Unmatched block [bug in `org-babel-exp-src-blocks']."))))
>> +  (when (member (first headers) org-babel-interpreters)
>> +    (save-excursion
>> +      (goto-char (match-beginning 0))
>> +      (org-babel-exp-do-export (org-babel-get-src-block-info) 'block))))
>>  
>>  (defun org-babel-exp-inline-src-blocks (start end)
>>    "Process inline src blocks between START and END for export.
>> diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el
>> index 1d43d3a..af53b60 100644
>> --- a/lisp/org-exp-blocks.el
>> +++ b/lisp/org-exp-blocks.el
>> @@ -183,13 +183,15 @@ specified in BLOCKS which default to the value of
>>  	    (setq body (save-match-data (org-remove-indentation body))))
>>  	  (unless (memq type types) (setq types (cons type types)))
>>  	  (save-match-data (interblock start (match-beginning 0)))
>> -	  (if (setq func (cadr (assoc type org-export-blocks)))
>> -	      (progn
>> -                (replace-match (save-match-data
>> +	  (when (setq func (cadr (assoc type org-export-blocks)))
>> +            (let ((replacement (save-match-data
>>                                   (if (memq type org-export-blocks-witheld) ""
>> -                                   (apply func body headers))) t t)
>> +                                   (apply func body headers)))))
>> +              (when replacement
>> +                (replace-match replacement t t)
>>                  (unless preserve-indent
>> -		  (indent-code-rigidly (match-beginning 0) (match-end 0) indentation))))
>> +                  (indent-code-rigidly
>> +                   (match-beginning 0) (match-end 0) indentation)))))
>>  	  (setq start (match-end 0)))
>>  	(interblock start (point-max))))))
>>  
>>
>>
>> Ian Barton <lists@manor-farm.org> writes:
>>
>>> I am using Babel to maintein my .emacs file. When I try to publish I
>>> am getting a Babel error from one of my org files. The offending
>>> section of the org file seems to be:
>>>
>>> #+BEGIN_SRC emacs-shell
>>>   127.0.0.1 mail.wilkesley.org localhost
>>>
>>>   # The following lines are desirable for IPv6 capable hosts
>>>   ::1 ip6-localhost ip6-loopback
>>>   fe00::0 ip6-localnet
>>>   ff00::0 ip6-mcastprefix
>>>   ff02::1 ip6-allnodes
>>>   ff02::2 ip6-allrouters
>>>   ff02::3 ip6-allhosts
>>>
>>> #+END_SRC
>>>
>>> I am using a recent git checkout of org and GNU Emacs 23.1.50.1
>>> (x86_64-pc-linux-gnu, GTK+ Version 2.18.0).
>>>
>>> The backtrace is:
>>>
>>> Debugger entered--Lisp error: (error "Unmatched block [bug in
>>> org-babel-exp-src-blocks'].")
>>>   signal(error ("Unmatched block [bug in `org-babel-exp-src-blocks']."))
>>>   error("Unmatched block [bug in `org-babel-exp-src-blocks'].")
>>>   (or (and (re-search-backward org-babel-src-block-regexp ... t) (setq
>>> progress-marker ...) (org-babel-exp-do-export ... ...))
>>> (save-excursion (forward-line 0) (and ... ... ...)) (and
>>> (re-search-backward org-block-regexp ... t) (setq progress-marker ...)
>>> (match-string 0)) (error "Unmatched block [bug in
>>> org-babel-exp-src-blocks']."))
>>>   (progn (fset (quote cond-progress-marker) (function* ...)) (or (and
>>> ... ... ...) (save-excursion ... ...) (and ... ... ...) (error
>>> "Unmatched block [bug in `org-babel-exp-src-blocks'].")))
>>>   (unwind-protect (progn (fset ... ...) (or ... ... ... ...)) (if
>>> --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
>>>   (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...))
>>> (unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...)))
>>>   (letf ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
>>> (and ... ... ...) (error "Unmatched block [bug in
>>> org-babel-exp-src-blocks'].")))
>>>   (letf* ((... ...)) (or (and ... ... ...) (save-excursion ... ...)
>>> (and ... ... ...) (error "Unmatched block [bug in
>>> org-babel-exp-src-blocks'].")))
>>>   (flet ((cond-progress-marker nil ...)) (or (and ... ... ...)
>>> (save-excursion ... ...) (and ... ... ...) (error "Unmatched block
>>> [bug in `org-babel-exp-src-blocks'].")))
>>>   org-babel-exp-src-blocks(#("127.0.0.1 mail.wilkesley.org
>>> localhost\n\n# The following lines are desirable for IPv6 capable
>>> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
>>> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
>>> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
>>> nil)))
>>>   apply(org-babel-exp-src-blocks #("127.0.0.1 mail.wilkesley.org
>>> localhost\n\n# The following lines are desirable for IPv6 capable
>>> hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0
>>> ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3
>>> ip6-allhosts\n" 0 240 (fontified nil)) #("emacs-shell" 0 11 (fontified
>>> nil)))
>>>
>>> byte-code("\306\307\211\211\211\211\211\211\211\211.......#.$.%.&\310\311!\211.'\205#

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-11 10:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-09 11:06 Org Babel Bug Ian Barton
2010-02-09 15:21 ` Dan Davison
2010-02-09 17:29   ` Dan Davison
2010-02-09 16:54 ` Eric Schulte
2010-02-10  2:11   ` Eric Schulte
2010-02-11 10:11     ` Ian Barton

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).