> What about using `write-region' instead of `write-file' and not touching > `set-auto-mode' function?
Thanks, that's indeed a much better way of doing it :) One can even avoid the temp buffer altogether and write the `output' string directly with `(write-region output nil file)`. Shall I prepare a patch? Or would you rather do it yourself, since it was your idea? Best, David