Browse Source

org-export-copy-buffer: Prevent saving to disk

* lisp/ox.el (org-export--generate-copy-script): Prevent Emacs from
ever saving copied buffer contents to disk despite `buffer-file-name'
being set to the original value.
Ihor Radchenko 2 years ago
parent
commit
b45911d41e
1 changed files with 3 additions and 0 deletions
  1. 3 0
      lisp/ox.el

+ 3 - 0
lisp/ox.el

@@ -2624,6 +2624,9 @@ The function assumes BUFFER's major mode is `org-mode'."
 	     ov-set)))
       (lambda ()
 	(let ((inhibit-modification-hooks t))
+          ;; Never write the buffer copy to disk, despite
+          ;; `buffer-file-name' not being nil.
+          (set 'write-contents-functions (list #'always))
 	  ;; Set major mode. Ignore `org-mode-hook' and other hooks as
 	  ;; they have been run already in BUFFER.
           (delay-mode-hooks