summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2014-11-04 22:15:27 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-11-04 22:21:30 +0100
commitf8d7da4c33729296d2a38bcb4ccaaabfe01dd121 (patch)
tree2933856271b532da2df0bad9875da60e1387190e
parent33786d4645dfd5c744e38e3a4bdc587e7e5caf62 (diff)
downloadorg-mode-f8d7da4c33729296d2a38bcb4ccaaabfe01dd121.tar.gz
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>
-rw-r--r--lisp/ox-publish.el41
1 files changed, 22 insertions, 19 deletions
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index efc70d2..180764e 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -870,25 +870,28 @@ When optional argument FORCE is non-nil, force publishing all
files in PROJECT. With a non-nil optional argument ASYNC,
publishing will be done asynchronously, in another process."
(interactive
- (list
- (assoc (org-icompleting-read
- "Publish project: "
- org-publish-project-alist nil t)
- org-publish-project-alist)
- current-prefix-arg))
- (let ((project-alist (if (not (stringp project)) (list project)
- ;; If this function is called in batch mode,
- ;; project is still a string here.
- (list (assoc project org-publish-project-alist)))))
- (if async
- (org-export-async-start (lambda (results) nil)
- `(let ((org-publish-use-timestamps-flag
- (if ',force nil ,org-publish-use-timestamps-flag)))
- (org-publish-projects ',project-alist)))
- (save-window-excursion
- (let* ((org-publish-use-timestamps-flag
- (if force nil org-publish-use-timestamps-flag)))
- (org-publish-projects project-alist))))))
+ (list (assoc (org-icompleting-read "Publish project: "
+ org-publish-project-alist nil t)
+ org-publish-project-alist)
+ current-prefix-arg))
+ (let ((project (if (not (stringp project)) project
+ ;; If this function is called in batch mode,
+ ;; PROJECT is still a string here.
+ (assoc project org-publish-project-alist))))
+ (cond
+ ((not project))
+ (async
+ (org-export-async-start (lambda (results) nil)
+ `(let ((org-publish-use-timestamps-flag
+ ,(and (not force) org-publish-use-timestamps-flag)))
+ ;; Expand components right now as external process may not
+ ;; be aware of complete `org-publish-project-alist'.
+ (org-publish-projects
+ ',(org-publish-expand-projects (list project))))))
+ (t (save-window-excursion
+ (let ((org-publish-use-timestamps-flag
+ (and (not force) org-publish-use-timestamps-flag)))
+ (org-publish-projects (list project))))))))
;;;###autoload
(defun org-publish-all (&optional force async)