emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] :completion function isn't run anymore?


From: Julien Cubizolles
Subject: [O] :completion function isn't run anymore?
Date: Fri, 27 Nov 2015 00:01:07 +0100
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]