David Lukes writes: > * lisp/ox-odt.el (org-odt-template, org-odt--export-wrap): > `write-region' instead of `save-buffer'. > > `write-file' and `save-buffer' trigger major mode changes, which leads > to various mode-related hooks being run. This is undesirable: running > these on generated files is wasted time and computation, and it can even > lead to hard to track data corruption when auto-formatting hooks are > involved. One such case is the 2006 version of the tidy program which > ships with stock macOS and can corrupt multi-byte UTF-8 codepoints in > HTML and ODT (via XML) exports. And even recent versions of tidy can > re-arrange whitespace in the exported documents in unwanted ways. See the attached patch where I applied the idea across Org, where it made sense. Note that I did not alter `org-odt--export-wrap' because `save-buffer' there is applied only when XML files are opened as buffers in Emacs, presumably manually. Interactive `save-buffer' makes sense then. (Though maybe that code is not needed at all, IDK) Please let me know if there are any objections.