Bladeren bron

ox-publish: Write cache after successfully publishing a file

* lisp/ox-publish.el (org-publish-file): Ignore NO-CACHE parameter when
  writing cache to file.  This is needed to recover from an interrupted
  publishing process.

Reported-by: Julien Cubizolles <j.cubizolles@free.fr>
<http://permalink.gmane.org/gmane.emacs.orgmode/105046>
Nicolas Goaziou 9 jaren geleden
bovenliggende
commit
92443160fd
1 gewijzigde bestanden met toevoegingen van 7 en 5 verwijderingen
  1. 7 5
      lisp/ox-publish.el

+ 7 - 5
lisp/ox-publish.el

@@ -614,10 +614,10 @@ Return output file name."
 
 (defun org-publish-file (filename &optional project no-cache)
   "Publish file FILENAME from PROJECT.
-If NO-CACHE is not nil, do not initialize org-publish-cache and
-write it to disk.  This is needed, since this function is used to
-publish single files, when entire projects are published.
-See `org-publish-projects'."
+If NO-CACHE is not nil, do not initialize `org-publish-cache'.
+This is needed, since this function is used to publish single
+files, when entire projects are published (see
+`org-publish-projects')."
   (let* ((project
 	  (or project
 	      (or (org-publish-get-project-from-filename filename)
@@ -659,7 +659,9 @@ See `org-publish-projects'."
 	  (run-hook-with-args 'org-publish-after-publishing-hook
 			      filename
 			      output))))
-    (unless no-cache (org-publish-write-cache-file))))
+    ;; Make sure to write cache to file after successfully publishing
+    ;; a file, so as to minimize impact of a publishing failure.
+    (org-publish-write-cache-file)))
 
 (defun org-publish-projects (projects)
   "Publish all files belonging to the PROJECTS alist.