From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Cubizolles Subject: :completion function isn't run anymore? Date: Fri, 27 Nov 2015 00:01:07 +0100 Message-ID: <87ziy0xt58.fsf@free.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a25Xc-0007gP-Uu for emacs-orgmode@gnu.org; Thu, 26 Nov 2015 18:01:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a25XX-0002tK-UN for emacs-orgmode@gnu.org; Thu, 26 Nov 2015 18:01:28 -0500 Received: from plane.gmane.org ([80.91.229.3]:41331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a25XX-0002t1-Mp for emacs-orgmode@gnu.org; Thu, 26 Nov 2015 18:01:23 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a25XR-00005E-SR for emacs-orgmode@gnu.org; Fri, 27 Nov 2015 00:01:17 +0100 Received: from gas45-3-82-244-252-119.fbx.proxad.net ([82.244.252.119]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Nov 2015 00:01:17 +0100 Received: from j.cubizolles by gas45-3-82-244-252-119.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Nov 2015 00:01:17 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org I noticed that the :preparation-function defined in org-publish-project-alist isn't run anymore when publishing a project. Consider the following, it's a stripped-down version of the setup I have been using on many documents for a few years. --8<---------------cut here---------------start------------->8--- #+begin_src emacs-lisp :tangle none :exports none (setq org-export-in-background nil) (defun remove-org-suffix (name) "Remove the .org from a file name" (if (string-match "\\(.*\\)\\.org" name) (substring name (match-beginning 1) (match-end 1)) name)) (defun jc-org-publish-rename (suffix version) "Rename file.suffix to file-version.suffix when buffer is visiting file.org" (let* ((file-base-name (remove-org-suffix (buffer-file-name))) (file-suffix-name (concat file-base-name "." suffix)) (file-version-suffix-name (concat file-base-name "-" version "." suffix))) (if (file-exists-p file-suffix-name) (rename-file file-suffix-name file-version-suffix-name t)) ) ) (defun jc-org-publish-rename-pdf (suffix) "Rename file.pdf to file-suffix.pdf when buffer is visiting file.org" (let* ((file-base-name (remove-org-suffix (buffer-file-name))) (file-pdf-name (concat file-base-name ".pdf")) (file-suffix-pdf-name (concat file-base-name "-" suffix ".pdf"))) (if (file-exists-p file-pdf-name) (rename-file file-pdf-name file-suffix-pdf-name 1)) ) ) (defun jc-org-publish-rename-beamer-pdf () "Rename file.pdf to file-beamer.pdf and file.tex to file-beamer.tex when buffer is visiting file.org" (jc-org-publish-rename '"pdf" '"beamer") (jc-org-publish-rename '"tex" '"beamer")) (setq org-publish-project-alist `(("beamer" :base-directory "./" :publishing-directory "./" :publishing-function org-beamer-publish-to-pdf :exclude ".*" :include ,(list (file-name-nondirectory buffer-file-name)) :completion-function jc-org-publish-rename-beamer-pdf ) )) #+end_src #+RESULTS: | beamer | :base-directory | ./ | :publishing-directory | ./ | :publishing-function | org-beamer-publish-to-pdf | :exclude | .* | :include | (test.org) | :completion-function | jc-org-publish-rename-beamer-pdf | * 1st section ** 1st subsection ** 2nd subsection --8<---------------cut here---------------end--------------->8--- Save the to test.org and publish using the "beamer" project. org-beamer-publish-to-pdf creates test.pdf as it should but the completion-function should rename test.tex and test.pdf test-beamer.tex and test-beamer.pdf. It doesn't. Even worse, you can type whatever function name for :completion-function, even if it's not defined, and the exporter won't complain. However, with emacs -Q (and the version of org-mode shipped with it), I recover the expected behaviour With emacs -Q -l ~/test.el, the problem reoccurs ~/test.el --8<---------------cut here---------------start------------->8--- (add-to-list 'load-path "~/info/emacs/org-mode/lisp") (add-to-list 'load-path "~/info/emacs/org-mode/contrib/lisp") --8<---------------cut here---------------end--------------->8--- ~/info/emacs/org-mode/ is my git repo of org-mode. I'm running GNU Emacs 25.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.14.13) of 2015-10-21 Julien.