From: Eshel Yaron Date: Sun, 16 Apr 2023 16:52:39 +0000 (+0300) Subject: More robust post-publish cleanup X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4d728bea671ebbaedb15dcf0ae5d11368f1d45af;p=esy-publish.git More robust post-publish cleanup --- diff --git a/esy-publish.el b/esy-publish.el index 408d57c..8c78904 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.10.0 +;; Package-Version: 0.11.0 ;; Package-Requires: ((emacs "28.2")) ;; This file is NOT part of GNU Emacs. @@ -151,6 +151,8 @@ (let* ((file (expand-file-name note dir)) (buffer (find-file-noselect file)) (titles (with-current-buffer buffer + (when esy-publish--publishing + (push (current-buffer) esy-publish--buffers)) (org-collect-keywords '("TITLE" "SUBTITLE")))) (title (car (alist-get "TITLE" titles nil nil #'string=))) (subtitle (car (alist-get "SUBTITLE" titles nil nil #'string=)))) @@ -177,6 +179,8 @@ (dolist (file files) (let* ((full (expand-file-name file dir)) (titles (with-current-buffer (find-file-noselect full) + (when esy-publish--publishing + (push (current-buffer) esy-publish--buffers)) (org-collect-keywords '("TITLE" "SUBTITLE")))) (title (car (alist-get "TITLE" titles nil nil #'string=))) (subtitle (car (alist-get "SUBTITLE" titles nil nil #'string=)))) @@ -261,6 +265,8 @@ #'string=) "org") esy-publish-notes-source-directory)) + (when esy-publish--publishing + (push (current-buffer) esy-publish--buffers)) (car (alist-get "SUBTITLE" (org-collect-keywords '("SUBTITLE")) @@ -412,6 +418,8 @@ (defvar esy-publish--buffers nil) +(defvar esy-publish--publishing nil) + ;;;###autoload (defun esy-publish (&optional force) (interactive "P") @@ -420,6 +428,7 @@ (org-export-with-section-numbers nil) (org-export-with-toc nil) (org-export-with-smart-quotes t) + (org-export-time-stamp-file nil) (org-html-htmlize-output-type 'css) (org-html-metadata-timestamp-format "%Y-%m-%d") (org-time-stamp-formats '("%Y-%m-%d" . "%Y-%m-%d %H:%M")) @@ -429,6 +438,7 @@ (make-backup-files nil) (auto-save-default nil) (esy-publish--buffers nil) + (esy-publish--publishing t) (initial-buffers (buffer-list)) (org-publish-project-alist (list '("all" :components ("assets" "org")) @@ -513,8 +523,9 @@ (time ((class . "copyright-year")) "2023") " %a")))))))) (org-publish "all" force) - (dolist (buffer (seq-difference esy-publish--buffers - initial-buffers)) + (dolist (buffer (seq-uniq + (seq-difference esy-publish--buffers + initial-buffers))) (when (buffer-live-p buffer) (with-current-buffer buffer (set-buffer-modified-p nil))