From 01c5c35686c9f4bac715e1db0cd3ef1fb32803d8 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 4 Aug 2020 18:04:15 -0400 Subject: [PATCH] Fix #3688: failure tangling config.org --- modules/config/literate/autoload.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/config/literate/autoload.el b/modules/config/literate/autoload.el index a9ae4bdf0..618304836 100644 --- a/modules/config/literate/autoload.el +++ b/modules/config/literate/autoload.el @@ -29,12 +29,14 @@ byte-compiled from.") ;; Prevent infinite recursion due to recompile-on-save ;; hooks later. (org-mode-hook nil)) - (copy-file org backup t) - (with-current-buffer (find-file-noselect backup) - ;; Tangling won't ordinarily expand #+INCLUDE directives - (org-export-expand-include-keyword) - (org-babel-tangle nil dest) - (kill-buffer (current-buffer))) + ;; Tangling won't ordinarily expand #+INCLUDE directives, and it + ;; modifies the buffer so we must do it in a copy to prevent + ;; stepping on the user's toes. + (with-temp-file backup + (let ((buffer-file-name backup)) + (insert-file-contents org) + (org-export-expand-include-keyword) + (org-babel-tangle nil dest))) t) ;; Write an empty file to serve as our mtime cache (with-temp-file +literate-config-cache-file))