On Apr 28, 2012, at 7:19 PM, Bastien wrote: > Hi Mike, > > thanks very much for the detailed bug report. > > Mike McLean <mike.mcl...@pobox.com> writes: > >> The general symptom is that if: >> >> You have org-update-all-dblocks added >> to org-export-first-hook with the goal of ensuring that dynamic >> blocks are current before every export; AND >> You are exporting only a region of the file, for example >> using C-c C-e 1 b (buffer/subtree export) >> >> The Mark terminating the end of the region to be exported is carried >> into the org-clocktable-write-default formatting function and the >> call of (backward-delete-char 1) on line 2352 oforg-clock.el deletes >> a region (between the Mark of the initial call and point, which is >> immediately before the #+END: construct of the clock table). Deletion >> of the #+END: construct malforms the clock table and ultimately the >> export fails leaving the Org file is a corrupt state. > > The trick is to use (let ((delete-active-region nil)) ...) so that > the active region is not deleted by such adjustments.
Interesting, I was going to play a bit today and try things like (save-excursion (deactivate-mark) … ) but didn't know if that was the right approach or not. The delete-active-region sure seems simpler :) > I pushed a fix. Thank you