emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-todo-keywords-1 detection in asyn export


From: Nicolas Goaziou
Subject: Re: [O] org-todo-keywords-1 detection in asyn export
Date: Fri, 18 Apr 2014 21:13:47 +0200

zwz <address@hidden> writes:

> Can you give me some example code?

I was thinking about something like this (untested):

--8<---------------cut here---------------start------------->8---
(let (template)
  (defun ngz-set-template (new)
    (setq template new))
  (defun ngz-latex-process (file)
    (case template
      (a (do-something-with file))
      (b (do-something-else-with file))
      (otherwise (do-default-with file)))))

(defun ngz-latex-class-to-template (info backend)
  (when (org-export-derived-backend-p backend 'latex)
    (ngz-set-template
     (let ((value (plist-get info :latex-class)))
       (cond ((string= value "classA") 'a)
             ((string= value "classB") 'b)
             (t nil))))
    info))

(add-to-list 'org-export-filter-options-functions
             'ngz-latex-class-to-template)

(setq org-latex-pdf-process #'ngz-latex-process)
--8<---------------cut here---------------end--------------->8---

Obviously, you need to activate lexical binding.

> I am not sure if I get you totally.

I was talking about BIND keyword, not about your initial implementation.

> Here is what I put in my org-export-async-init-file:
> (defun ox-xetex-setup ()
>   (if (member "XeTeX" org-todo-keywords-1)
>       (setq org-latex-default-packages-alist
>                       (remove '("AUTO" "inputenc" t)
>                               org-latex-default-packages-alist)
>                       org-latex-pdf-process
>                       '("latexmk -xelatex -pdf -silent -f %f"))))
>
> (add-hook 'org-mode-hook (lambda () (ox-xetex-setup)))
> ;; instead of add-hook as above, you can just put
> ;; (ox-xetex-setup)
> ;; but again, it still calls pdflatex when export asynchronously
>

[...]

> When I export it asynchronously, org-export calls pdflatex rather than
> xelatex to generate pdf.

I think the problem comes from `org-todo-keywords-1'. Its value is
probably not updated during export.


Regards,

-- 
Nicolas Goaziou



reply via email to

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