Nicolas Girard <girard.nico...@gmail.com> writes: > I'm ashamed... but this time I swear I started a minimal emacs session > and got it to work. The instructions have slightly changed and are > written at the very beginning of the attached minimal document.
I see. There is an important difference between evaluating a buffer and evaluating a buffer during export. In the latter, Babel has to deal with replacement values, i.e., code block is replaced by its results. See the difference between `org-export-execute-babel-code' and `org-babel-execute-buffer' in a buffer containing only src_emacs-lisp[:results raw]{(+ 1 2)} In this case, your code removes the code (and much more) as a side-effect. This confuses `org-babel-exp-non-block-elements', which also tries to remove it. As this fails, it removes a random part of the buffer instead (probably as a mean revenge). `org-babel-exp-non-block-elements' and `org-babel-exp-process-buffer' could probably check if code still exists before trying to remove (and replace) it. Regards, -- Nicolas Goaziou