From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-todo-keywords-1 detection in asyn export Date: Fri, 18 Apr 2014 21:13:47 +0200 Message-ID: <87y4z21mdw.fsf@gmail.com> References: <87ppl1o9ok.fsf@gmail.com> <87sipc8me6.fsf@bzg.ath.cx> <87ha5scjdx.fsf@gmail.com> <87a9bj3e1a.fsf@gmail.com> <87d2ged8fx.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbEE4-00062j-Ge for emacs-orgmode@gnu.org; Fri, 18 Apr 2014 15:13:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WbEDv-0003UO-Bt for emacs-orgmode@gnu.org; Fri, 18 Apr 2014 15:13:28 -0400 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:46949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbEDv-0003UE-4a for emacs-orgmode@gnu.org; Fri, 18 Apr 2014 15:13:19 -0400 Received: by mail-we0-f174.google.com with SMTP id t60so1837904wes.19 for ; Fri, 18 Apr 2014 12:13:18 -0700 (PDT) In-Reply-To: <87d2ged8fx.fsf@gmail.com> (zwz's message of "Fri, 18 Apr 2014 22:21:54 +0800") 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: zwz Cc: emacs-orgmode@gnu.org zwz 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