ox-publish: Fix publishing components asynchronously

* lisp/ox-publish.el (org-publish): Ensure asynchronous process
  doesn't encounter :components parts in the project, as it may not
  know how to expand them.

Reported-by: Julien Cubizolles <j.cubizolles@free.fr>
<http://permalink.gmane.org/gmane.emacs.orgmode/92319>
This commit is contained in:
Nicolas Goaziou 2014-11-04 22:15:27 +01:00
parent 33786d4645
commit f8d7da4c33

View file

@ -870,25 +870,28 @@ When optional argument FORCE is non-nil, force publishing all
files in PROJECT. With a non-nil optional argument ASYNC, files in PROJECT. With a non-nil optional argument ASYNC,
publishing will be done asynchronously, in another process." publishing will be done asynchronously, in another process."
(interactive (interactive
(list (list (assoc (org-icompleting-read "Publish project: "
(assoc (org-icompleting-read org-publish-project-alist nil t)
"Publish project: " org-publish-project-alist)
org-publish-project-alist nil t) current-prefix-arg))
org-publish-project-alist) (let ((project (if (not (stringp project)) project
current-prefix-arg)) ;; If this function is called in batch mode,
(let ((project-alist (if (not (stringp project)) (list project) ;; PROJECT is still a string here.
;; If this function is called in batch mode, (assoc project org-publish-project-alist))))
;; project is still a string here. (cond
(list (assoc project org-publish-project-alist))))) ((not project))
(if async (async
(org-export-async-start (lambda (results) nil) (org-export-async-start (lambda (results) nil)
`(let ((org-publish-use-timestamps-flag `(let ((org-publish-use-timestamps-flag
(if ',force nil ,org-publish-use-timestamps-flag))) ,(and (not force) org-publish-use-timestamps-flag)))
(org-publish-projects ',project-alist))) ;; Expand components right now as external process may not
(save-window-excursion ;; be aware of complete `org-publish-project-alist'.
(let* ((org-publish-use-timestamps-flag (org-publish-projects
(if force nil org-publish-use-timestamps-flag))) ',(org-publish-expand-projects (list project))))))
(org-publish-projects project-alist)))))) (t (save-window-excursion
(let ((org-publish-use-timestamps-flag
(and (not force) org-publish-use-timestamps-flag)))
(org-publish-projects (list project))))))))
;;;###autoload ;;;###autoload
(defun org-publish-all (&optional force async) (defun org-publish-all (&optional force async)