Ahmadou Dicko <dicko.ahma...@gmail.com> writes: > As a workaround I will use your trick (in buffer evaluation before > exporting) but I was thinking of writing a filter.
A better workaround is to delete the white space (spaces, tabs and newlines) at the end of the file: without that, the problem goes away. If white space is added to the end of the file, the problem might reappear, with different amounts of junk added depending on the amount of added white space. I have traced it down to org-babel-exp-process-buffer: it does the deletions of the source code blocks (possibly putting them back again if the header args tell it to) but it does not always delete the right region. More details later. Nick