summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-03-17 08:53:46 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-03-17 08:53:46 +0100
commit6e1d174d0a5564f3c18570025a439cbd201290cb (patch)
treedfa0a2f1b1ee79cd4eba8a932e3612e0b1edf135
parent00f95cb126af6239cf0f18a4db21bd47614f6894 (diff)
downloadorg-mode-6e1d174d0a5564f3c18570025a439cbd201290cb.tar.gz
ox-publish: Raise an error when encountering undefined component
* lisp/ox-publish.el (org-publish-expand-projects): Raise an error when encountering undefined component. Refactor code. Fix docstring. Reported-by: Bob Newell <bobnewell@bobnewell.net> <http://permalink.gmane.org/gmane.emacs.orgmode/112712>
-rw-r--r--lisp/ox-publish.el21
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index 44f8097..adcfd21 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -413,16 +413,17 @@ project base directory."
(defun org-publish-expand-projects (projects-alist)
"Expand projects in PROJECTS-ALIST.
-This splices all the components into the list."
- (let ((rest projects-alist) rtn p components)
- (while (setq p (pop rest))
- (if (setq components (plist-get (cdr p) :components))
- (setq rest (append
- (mapcar (lambda (x) (assoc x org-publish-project-alist))
- components)
- rest))
- (push p rtn)))
- (nreverse (delete-dups (delq nil rtn)))))
+This splices all the components into a list."
+ (delete-dups
+ (cl-mapcan (lambda (project)
+ (pcase-let ((`(,name . ,properties) project))
+ (cl-mapcan (lambda (component)
+ (or
+ (assoc component org-publish-project-alist)
+ (user-error "Unknown component %S in project %S"
+ component name)))
+ (plist-get properties :components))))
+ projects-alist)))
(defun org-publish-get-base-files (project)
"Return a list of all files in PROJECT."