Browse Source

ox-publish: Fix void-variable project-plist

* lisp/ox-publish.el (org-publish-projects): Fix bug introduced in
  346d227.
Nicolas Goaziou 9 years ago
parent
commit
606b5fdd87
1 changed files with 33 additions and 32 deletions
  1. 33 32
      lisp/ox-publish.el

+ 33 - 32
lisp/ox-publish.el

@@ -671,42 +671,43 @@ See `org-publish-projects'."
 (defun org-publish-projects (projects)
   "Publish all files belonging to the PROJECTS alist.
 If `:auto-sitemap' is set, publish the sitemap too.  If
-`:makeindex' is set, also produce a file theindex.org."
+`:makeindex' is set, also produce a file \"theindex.org\"."
   (dolist (project (org-publish-expand-projects projects))
-    (let ((preparation-function
-	   (plist-get project-plist :preparation-function)))
-      (when preparation-function (run-hooks 'preparation-function)))
-    ;; Each project uses its own cache file.
-    (org-publish-initialize-cache (car project))
-    (let* ((project-plist (cdr project))
-	   (exclude-regexp (plist-get project-plist :exclude))
-	   (sitemap-p (plist-get project-plist :auto-sitemap))
-	   (sitemap-filename (or (plist-get project-plist :sitemap-filename)
-				 "sitemap.org"))
-	   (sitemap-function (or (plist-get project-plist :sitemap-function)
-				 'org-publish-org-sitemap))
-	   (org-publish-sitemap-date-format
-	    (or (plist-get project-plist :sitemap-date-format)
-		org-publish-sitemap-date-format))
-	   (org-publish-sitemap-file-entry-format
-	    (or (plist-get project-plist :sitemap-file-entry-format)
-		org-publish-sitemap-file-entry-format))
-	   (files (org-publish-get-base-files project exclude-regexp))
-	   (theindex
-	    (expand-file-name "theindex.org"
-			      (plist-get project-plist :base-directory))))
-      (when sitemap-p (funcall sitemap-function project sitemap-filename))
+    (let ((project-plist (cdr project)))
+      (let ((preparation-function
+	     (plist-get project-plist :preparation-function)))
+	(when preparation-function (run-hooks 'preparation-function)))
+      ;; Each project uses its own cache file.
+      (org-publish-initialize-cache (car project))
+      (when  (plist-get project-plist :auto-sitemap)
+	(let ((sitemap-filename
+	       (or (plist-get project-plist :sitemap-filename)
+		   "sitemap.org"))
+	      (sitemap-function
+	       (or (plist-get project-plist :sitemap-function)
+		   #'org-publish-org-sitemap))
+	      (org-publish-sitemap-date-format
+	       (or (plist-get project-plist :sitemap-date-format)
+		   org-publish-sitemap-date-format))
+	      (org-publish-sitemap-file-entry-format
+	       (or (plist-get project-plist :sitemap-file-entry-format)
+		   org-publish-sitemap-file-entry-format)))
+	  (funcall sitemap-function project sitemap-filename)))
       ;; 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 theindex project t))
+      (let ((theindex
+	     (expand-file-name "theindex.org"
+			       (plist-get project-plist :base-directory)))
+	    (exclude-regexp (plist-get project-plist :exclude)))
+	(dolist (file (org-publish-get-base-files project exclude-regexp))
+	  (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 theindex project t)))
       (let ((completion-function
 	     (plist-get project-plist :completion-function)))
 	(when completion-function (run-hooks 'completion-function)))