From 699f9d1b21868e34e46545339c25851b44dae2f9 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 16 Apr 2023 19:12:10 +0300 Subject: [PATCH] Kill buffers opened during export --- esy-publish.el | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/esy-publish.el b/esy-publish.el index 57dda01..ead4a2d 100644 --- a/esy-publish.el +++ b/esy-publish.el @@ -6,7 +6,7 @@ ;; Maintainer: Eshel Yaron ;; Keywords: languages extensions ;; URL: http://git.eshelyaron.com/gitweb/?p=esy-publish.git -;; Package-Version: 0.6.0 +;; Package-Version: 0.7.0 ;; Package-Requires: ((emacs "28.2")) ;; This file is NOT part of GNU Emacs. @@ -366,14 +366,16 @@ (with-current-buffer (find-file-noselect (expand-file-name "esy.org" esy-publish-source-directory)) - (org-transclusion-add-all))) + (org-transclusion-add-all) + (push (current-buffer) esy-publish--buffers))) (defun esy-publish--prepare-indices (&rest _) (dolist (dir (list esy-publish-notes-source-directory esy-publish-posts-source-directory esy-publish-source-directory)) (with-current-buffer (find-file-noselect (expand-file-name "index.org" dir)) - (org-update-all-dblocks)))) + (org-update-all-dblocks) + (push (current-buffer) esy-publish--buffers)))) (defun esy-publish--prepare-notes-links (&rest _) (dolist (note (delete "index.org" @@ -382,7 +384,8 @@ (rx bos alnum (+ any) ".org" eos)))) (with-current-buffer (find-file-noselect note) - (org-update-all-dblocks)))) + (org-update-all-dblocks) + (push (current-buffer) esy-publish--buffers)))) (defun esy-publish--prepare (&rest _) (esy-publish--transclude-config) @@ -398,13 +401,16 @@ (replace-match (format "" (esy-publish--file-url file)) nil t)) - (basic-save-buffer)))) + (basic-save-buffer) + (push (current-buffer) esy-publish--buffers)))) (defun esy-publish--finalize (plist) (esy-publish--add-canonical-tags plist) (esy-publish--finalize-feed plist) (esy-publish--finalize-sitemap plist)) +(defvar esy-publish--buffers nil) + ;;;###autoload (defun esy-publish (&optional force) (interactive "P") @@ -420,6 +426,8 @@ (org-src-lang-modes nil) (prog-mode-hook '(rainbow-delimiters-mode)) (make-backup-files nil) + (auto-save-default nil) + (esy-publish--buffers nil) (org-publish-project-alist (list '("all" :components ("assets" "org")) (list "assets" @@ -502,7 +510,10 @@ "© " (time ((class . "copyright-year")) "2023") " %a")))))))) - (org-publish "all" force))) + (org-publish "all" force) + (dolist (buffer esy-publish--buffers) + (kill-buffer))) + (setq esy-publish--buffers nil)) (defun esy-publish-all () (esy-publish t)) -- 2.39.2