Re: [Orgmode] [Babel] Can't export to LaTeX anymore (args-out-of-range 0 0)

2010-09-17 Thread Eric Schulte
Hi Sébastien,

This is a tricky problem indeed.  After some debugging, it appears that
the problem is the result of the "org" code block calling
`org-export-as-latex' on its body, while `org-export-as-latex' is
already called on the entire org-mode file.  Apparently the Org-mode
exporter is not currently able to handle nested export calls, because
the name of the temporary export buffer is hard coded into
`org-export-preprocess-string', meaning that the buffer is re-used and
deleted by the nested export call.

This fix will probably take some time to implement, and until then I
don't think it will be possible to evaluate org-mode blocks during
export.

Best -- Eric

Sébastien Vauban  writes:

> Hello,
>
> With latest git pull'ed, I now have such an error when exporting to LaTeX:
>
> Debugger entered--Lisp error: (args-out-of-range 0 0)
>   replace-match("" t t)
>   (progn (replace-match replacement t t) (unless preserve-indent 
> (indent-code-rigidly ... ... indentation)))
>   (if replacement (progn (replace-match replacement t t) (unless 
> preserve-indent ...)))
>   (when replacement (replace-match replacement t t) (unless preserve-indent 
> (indent-code-rigidly ... ... indentation)))
>   (let ((replacement ...)) (when replacement (replace-match replacement t t) 
> (unless preserve-indent ...)))
>   (progn (let (...) (when replacement ... ...)))
>   (if (setq func (cadr ...)) (progn (let ... ...)))
>   (when (setq func (cadr ...)) (let (...) (when replacement ... ...)))
>   (while (re-search-forward "^\\([]*\\)#\\+begin_\\(\\S-+\\)[ 
> ]*\\(.*\\)?[\n]\\([^]*?\\)[\n][ ]*#\\+end_\\S-+.*[\n]?" nil t) (setq 
> indentation (length ...)) (setq type (intern ...)) (setq headers 
> (save-match-data ...)) (setq body (match-string 4)) (setq preserve-indent (or 
> org-src-preserve-indentation ...)) (unless preserve-indent (setq body ...)) 
> (unless (memq type types) (setq types ...)) (save-match-data (interblock 
> start ...)) (when (setq func ...) (let ... ...)) (setq start (match-end 0)))
>   (progn (fset (quote interblock) (function* ...)) (goto-char (point-min)) 
> (setq start (point)) (while (re-search-forward "^\\([  
> ]*\\)#\\+begin_\\(\\S-+\\)[ ]*\\(.*\\)?[\n]\\([^]*?\\)[\n][ 
> ]*#\\+end_\\S-+.*[\n]?" nil t) (setq indentation ...) (setq type ...) (setq 
> headers ...) (setq body ...) (setq preserve-indent ...) (unless 
> preserve-indent ...) (unless ... ...) (save-match-data ...) (when ... ...) 
> (setq start ...)) (interblock start (point-max)) (run-hooks (quote 
> org-export-blocks-postblock-hook)))
>   (unwind-protect (progn (fset ... ...) (goto-char ...) (setq start ...) 
> (while ... ... ... ... ... ... ... ... ... ... ...) (interblock start ...) 
> (run-hooks ...)) (if --cl-letf-bound-- (fset ... --cl-letf-save--) 
> (fmakunbound ...)))
>   (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect 
> (progn ... ... ... ... ... ...) (if --cl-letf-bound-- ... ...)))
>   (letf ((... ...)) (goto-char (point-min)) (setq start (point)) (while 
> (re-search-forward "^\\([ ]*\\)#\\+begin_\\(\\S-+\\)[ 
> ]*\\(.*\\)?[\n]\\([^]*?\\)[\n][ ]*#\\+end_\\S-+.*[\n]?" nil t) (setq 
> indentation ...) (setq type ...) (setq headers ...) (setq body ...) (setq 
> preserve-indent ...) (unless preserve-indent ...) (unless ... ...) 
> (save-match-data ...) (when ... ...) (setq start ...)) (interblock start 
> (point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
>   (letf* ((... ...)) (goto-char (point-min)) (setq start (point)) (while 
> (re-search-forward "^\\([]*\\)#\\+begin_\\(\\S-+\\)[ 
> ]*\\(.*\\)?[\n]\\([^]*?\\)[\n][ ]*#\\+end_\\S-+.*[\n]?" nil t) (setq 
> indentation ...) (setq type ...) (setq headers ...) (setq body ...) (setq 
> preserve-indent ...) (unless preserve-indent ...) (unless ... ...) 
> (save-match-data ...) (when ... ...) (setq start ...)) (interblock start 
> (point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
>   (flet ((interblock ... ...)) (goto-char (point-min)) (setq start (point)) 
> (while (re-search-forward "^\\([  ]*\\)#\\+begin_\\(\\S-+\\)[ 
> ]*\\(.*\\)?[\n]\\([^]*?\\)[\n][ ]*#\\+end_\\S-+.*[\n]?" nil t) (setq 
> indentation ...) (setq type ...) (setq headers ...) (setq body ...) (setq 
> preserve-indent ...) (unless preserve-indent ...) (unless ... ...) 
> (save-match-data ...) (when ... ...) (setq start ...)) (interblock start 
> (point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
>   (let ((case-fold-search t) (types ...) indentation type func start body 
> headers preserve-indent progress-marker) (flet (...) (goto-char ...) (setq 
> start ...) (while ... ... ... ... ... ... ... ... ... ... ...) (interblock 
> start ...) (run-hooks ...)))
>   (save-window-excursion (let (... ... indentation type func start body 
> headers preserve-indent progress-marker) (flet ... ... ... ... ... ...)))
>   org-export-blocks-preprocess()
>   run-hooks(org-export-preprocess-

[Orgmode] [Babel] Can't export to LaTeX anymore (args-out-of-range 0 0)

2010-09-13 Thread Sébastien Vauban
Hello,

With latest git pull'ed, I now have such an error when exporting to LaTeX:

--8<---cut here---start->8---
Debugger entered--Lisp error: (args-out-of-range 0 0)
  replace-match("" t t)
  (progn (replace-match replacement t t) (unless preserve-indent 
(indent-code-rigidly ... ... indentation)))
  (if replacement (progn (replace-match replacement t t) (unless 
preserve-indent ...)))
  (when replacement (replace-match replacement t t) (unless preserve-indent 
(indent-code-rigidly ... ... indentation)))
  (let ((replacement ...)) (when replacement (replace-match replacement t t) 
(unless preserve-indent ...)))
  (progn (let (...) (when replacement ... ...)))
  (if (setq func (cadr ...)) (progn (let ... ...)))
  (when (setq func (cadr ...)) (let (...) (when replacement ... ...)))
  (while (re-search-forward "^\\([  ]*\\)#\\+begin_\\(\\S-+\\)[ 
]*\\(.*\\)?[
\n]\\([^]*?\\)[
\n][]*#\\+end_\\S-+.*[
\n]?" nil t) (setq indentation (length ...)) (setq type (intern ...)) (setq 
headers (save-match-data ...)) (setq body (match-string 4)) (setq 
preserve-indent (or org-src-preserve-indentation ...)) (unless preserve-indent 
(setq body ...)) (unless (memq type types) (setq types ...)) (save-match-data 
(interblock start ...)) (when (setq func ...) (let ... ...)) (setq start 
(match-end 0)))
  (progn (fset (quote interblock) (function* ...)) (goto-char (point-min)) 
(setq start (point)) (while (re-search-forward "^\\([
]*\\)#\\+begin_\\(\\S-+\\)[ ]*\\(.*\\)?[
\n]\\([^]*?\\)[
\n][]*#\\+end_\\S-+.*[
\n]?" nil t) (setq indentation ...) (setq type ...) (setq headers ...) (setq 
body ...) (setq preserve-indent ...) (unless preserve-indent ...) (unless ... 
...) (save-match-data ...) (when ... ...) (setq start ...)) (interblock start 
(point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
  (unwind-protect (progn (fset ... ...) (goto-char ...) (setq start ...) (while 
... ... ... ... ... ... ... ... ... ... ...) (interblock start ...) (run-hooks 
...)) (if --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
  (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect (progn 
... ... ... ... ... ...) (if --cl-letf-bound-- ... ...)))
  (letf ((... ...)) (goto-char (point-min)) (setq start (point)) (while 
(re-search-forward "^\\([   ]*\\)#\\+begin_\\(\\S-+\\)[ ]*\\(.*\\)?[
\n]\\([^]*?\\)[
\n][]*#\\+end_\\S-+.*[
\n]?" nil t) (setq indentation ...) (setq type ...) (setq headers ...) (setq 
body ...) (setq preserve-indent ...) (unless preserve-indent ...) (unless ... 
...) (save-match-data ...) (when ... ...) (setq start ...)) (interblock start 
(point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
  (letf* ((... ...)) (goto-char (point-min)) (setq start (point)) (while 
(re-search-forward "^\\([  ]*\\)#\\+begin_\\(\\S-+\\)[ ]*\\(.*\\)?[
\n]\\([^]*?\\)[
\n][]*#\\+end_\\S-+.*[
\n]?" nil t) (setq indentation ...) (setq type ...) (setq headers ...) (setq 
body ...) (setq preserve-indent ...) (unless preserve-indent ...) (unless ... 
...) (save-match-data ...) (when ... ...) (setq start ...)) (interblock start 
(point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
  (flet ((interblock ... ...)) (goto-char (point-min)) (setq start (point)) 
(while (re-search-forward "^\\([]*\\)#\\+begin_\\(\\S-+\\)[ ]*\\(.*\\)?[
\n]\\([^]*?\\)[
\n][]*#\\+end_\\S-+.*[
\n]?" nil t) (setq indentation ...) (setq type ...) (setq headers ...) (setq 
body ...) (setq preserve-indent ...) (unless preserve-indent ...) (unless ... 
...) (save-match-data ...) (when ... ...) (setq start ...)) (interblock start 
(point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
  (let ((case-fold-search t) (types ...) indentation type func start body 
headers preserve-indent progress-marker) (flet (...) (goto-char ...) (setq 
start ...) (while ... ... ... ... ... ... ... ... ... ... ...) (interblock 
start ...) (run-hooks ...)))
  (save-window-excursion (let (... ... indentation type func start body headers 
preserve-indent progress-marker) (flet ... ... ... ... ... ...)))
  org-export-blocks-preprocess()
  run-hooks(org-export-preprocess-after-include-files-hook)
  (save-current-buffer (set-buffer (get-buffer-create " org-mode-tmp")) 
(erase-buffer) (insert string) (setq case-fold-search t) (let (...) 
(remove-text-properties ... ... ...)) (org-export-kill-licensed-text) (let 
(...) (org-mode)) (setq case-fold-search t) (org-install-letbind) (run-hooks 
(quote org-export-preprocess-hook)) (org-export-preprocess-apply-macros) 
(run-hooks (quote org-export-preprocess-after-macros-hook)) (untabify 
(point-min) (point-max)) (org-export-handle-include-files-recurse) (run-hooks 
(quote org-export-preprocess-after-include-files-hook)) 
(org-export-remove-archived-trees archived-trees) 
(org-export-remove-comment-blocks-and-subtrees) (org-export-handle-export-tags 
(plist-get parameters :select-tags) (p