]> git.eshelyaron.com Git - esy-publish.git/commitdiff
More robust post-publish cleanup
authorEshel Yaron <me@eshelyaron.com>
Sun, 16 Apr 2023 16:52:39 +0000 (19:52 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 16 Apr 2023 16:52:39 +0000 (19:52 +0300)
esy-publish.el

index 408d57ce2fa7804756c148122ef8a1c2e2dc8874..8c78904757a3bf0f90e47f9020a331ac3ff25bcd 100644 (file)
@@ -6,7 +6,7 @@
 ;; Maintainer: Eshel Yaron <me@eshelyaron.com>
 ;; 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.
       (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=))))
     (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=))))
                                                #'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"))
 
 (defvar esy-publish--buffers nil)
 
+(defvar esy-publish--publishing nil)
+
 ;;;###autoload
 (defun esy-publish (&optional force)
   (interactive "P")
          (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"))
          (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"))
                                   (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))