From 5c61a34e5bda2eb1c256f99606f6bc53bd35e90c Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 18 Feb 2013 19:46:42 +0100 Subject: [PATCH] ox-publish: Publish "theindex.org" last * lisp/ox-publish.el (org-publish-projects): Publish "theindex.org" last, so that "theindex.inc" can be completed. --- lisp/ox-publish.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index a5da49e47..bcdbfcfb8 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -675,17 +675,24 @@ If `:auto-sitemap' is set, publish the sitemap too. If (preparation-function (plist-get project-plist :preparation-function)) (completion-function (plist-get project-plist :completion-function)) - (files (org-publish-get-base-files project exclude-regexp)) file) + (files (org-publish-get-base-files project exclude-regexp)) + (theindex + (expand-file-name "theindex.org" + (plist-get project-plist :base-directory)))) (when preparation-function (run-hooks 'preparation-function)) (if sitemap-p (funcall sitemap-function project sitemap-filename)) - (dolist (file files) (org-publish-file file project t)) + ;; Publish all files from PROJECT excepted "theindex.org". Its + ;; publishing will be deferred until "theindex.inc" is + ;; populated. + (dolist (file files) + (unless (equal file theindex) + (org-publish-file file project t))) + ;; Populate "theindex.inc", if needed, and publish + ;; "theindex.org". (when (plist-get project-plist :makeindex) (org-publish-index-generate-theindex project (plist-get project-plist :base-directory)) - (org-publish-file - (expand-file-name - "theindex.org" (plist-get project-plist :base-directory)) - project t)) + (org-publish-file theindex project t)) (when completion-function (run-hooks 'completion-function)) (org-publish-write-cache-file))) (org-publish-expand-projects projects)))