[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] org-todo-keywords-1 detection in asyn export
From: |
zwz |
Subject: |
Re: [O] org-todo-keywords-1 detection in asyn export |
Date: |
Sat, 19 Apr 2014 21:47:39 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Nicolas Goaziou <address@hidden> writes:
> zwz <address@hidden> writes:
>
>> Can you give me some example code?
>
> I was thinking about something like this (untested):
>
> (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)
>
> 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.
Thank you, Nicolas.
I used BIND before, but never like what your example code does.
>
>> 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.
Yes, I guess so.
But it worked during *synchronous* export, even when I put
#+TODO: XeTeX
in a common option-template file, which is then included by #+SETUPFILE
in many org files.
>
>
> Regards,