emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: zwz <zhangweize@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-todo-keywords-1 detection in asyn export
Date: Sat, 19 Apr 2014 21:47:39 +0800	[thread overview]
Message-ID: <874n1pctxg.fsf@gmail.com> (raw)
In-Reply-To: 87y4z21mdw.fsf@gmail.com

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> zwz <zhangweize@gmail.com> 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,

      reply	other threads:[~2014-04-19 14:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01  6:17 org-todo-keywords-1 detection in asyn export zwz
2014-04-17  7:07 ` Bastien
2014-04-17 10:58   ` zwz
2014-04-17 20:18     ` Nicolas Goaziou
2014-04-18 14:21       ` zwz
2014-04-18 19:13         ` Nicolas Goaziou
2014-04-19 13:47           ` zwz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874n1pctxg.fsf@gmail.com \
    --to=zhangweize@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).