summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-07-31 12:44:33 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2013-07-31 12:44:33 (GMT)
commitcc10c80d8504d1be59521e291923179170cb3792 (patch)
tree5f9bd9541a1f0617dfa96fc2443b4b8f3eca6278
parent2710267ed74a99829aeb3fae0a669573d14c7e43 (diff)
downloadorg-mode-cc10c80d8504d1be59521e291923179170cb3792.zip
org-mode-cc10c80d8504d1be59521e291923179170cb3792.tar.gz
ox: Preserve coding system when writing output to a filerelease_8.0.7
* lisp/ox.el (org-export-to-file): Preserve coding system when writing output.
-rw-r--r--lisp/ox.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/ox.el b/lisp/ox.el
index fcf3ef7..abdc636 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3058,10 +3058,11 @@ to kill ring. Return output file's name."
;; we'd rather avoid needless transcoding of parse tree.
(unless (file-writable-p file) (error "Output file not writable"))
;; Insert contents to a temporary buffer and write it to FILE.
- (let ((out (org-export-as backend subtreep visible-only body-only ext-plist)))
+ (let ((coding buffer-file-coding-system)
+ (out (org-export-as backend subtreep visible-only body-only ext-plist)))
(with-temp-buffer
(insert out)
- (let ((coding-system-for-write org-export-coding-system))
+ (let ((coding-system-for-write (or org-export-coding-system coding)))
(write-file file)))
;; Maybe add file contents to kill ring.
(when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p out))