Hello, Julien Cubizolles <j.cubizol...@free.fr> writes:
> Julien Cubizolles <j.cubizol...@free.fr> writes: > >> I noticed that the :preparation-function defined in >> org-publish-project-alist isn't run anymore when publishing a project. > > It seems the preparation-function isn't run either. Consider the > following more simple examples > > > #+TITLE: Hello > #+begin_src emacs-lisp :tangle none :exports none > (setq org-export-in-background nil) > (defun jc-preparation () > "Preparation functions to be run before actually pubishing" > (setq org-latex-title-command "") > ) > (setq org-publish-project-alist > `(("pdf" > :base-directory "./" > :publishing-directory "./" > :preparation-function jc-preparation > :publishing-function org-beamer-publish-to-pdf > :exclude ".*" > :include ,(list (file-name-nondirectory buffer-file-name)) > ) > )) > #+end_src > > #+RESULTS: > | pdf | :base-directory | ./ | :publishing-directory | ./ | > :preparation-function | jc-preparation | :publishing-function | > org-beamer-publish-to-pdf | :exclude | .* | :include | (test.org) | > > * 1st section > ** 1st subsection > ** 2nd subsection > > Save the to test.org and publish using the "pdf" > project. org-beamer-publish-to-pdf creates test.pdf as it should but the > preparation-function should remove the titlepage wich it doesn't. I didn't investigate much the issue yet, but, out of curiosity, would the following patch solve the issue: Regards, -- Nicolas Goaziou
>From 28dc2a08846992f0565897ae8e061da685cd776d Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou <m...@nicolasgoaziou.fr> Date: Sun, 29 Nov 2015 14:16:37 +0100 Subject: [PATCH] ox-publish.el: Fix :preparation-function and :completion-function * lisp/ox-publish.el (org-publish-projects): Do not use `run-hooks' in a lexical binding environment. Reported-by: Julien Cubizolles <j.cubizol...@free.fr> <http://permalink.gmane.org/gmane.emacs.orgmode/103124> --- lisp/ox-publish.el | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 90f307c..6c65e52 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -667,9 +667,7 @@ If `:auto-sitemap' is set, publish the sitemap too. If `:makeindex' is set, also produce a file \"theindex.org\"." (dolist (project (org-publish-expand-projects projects)) (let ((project-plist (cdr project))) - (let ((preparation-function - (plist-get project-plist :preparation-function))) - (when preparation-function (run-hooks 'preparation-function))) + (mapc #'funcall (plist-get project-plist :preparation-function)) ;; Each project uses its own cache file. (org-publish-initialize-cache (car project)) (when (plist-get project-plist :auto-sitemap) @@ -701,9 +699,7 @@ If `:auto-sitemap' is set, publish the sitemap too. If (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))) + (mapc #'funcall (plist-get project-plist :completion-function)) (org-publish-write-cache-file)))) (defun org-publish-org-sitemap (project &optional sitemap-filename) -- 2.6.2