* org-todo-keywords-1 detection in asyn export
@ 2014-04-01 6:17 zwz
2014-04-17 7:07 ` Bastien
0 siblings, 1 reply; 7+ messages in thread
From: zwz @ 2014-04-01 6:17 UTC (permalink / raw)
To: emacs-orgmode
Before I adopt asyn export, I config in an org file
#+TODO: XeTeX
to locally set xelatex for org-latex-pdf-process by:
(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")))
But when I move the config to my org-export-async-init-file, it does not
take effect in asyn export. The default org-latex-pdf-process pdflatex
runs instead of xelatex.
How to locally set org-latex-pdf-process?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-todo-keywords-1 detection in asyn export
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
0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2014-04-17 7:07 UTC (permalink / raw)
To: zwz; +Cc: emacs-orgmode
zwz <zhangweize@gmail.com> writes:
> How to locally set org-latex-pdf-process?
#+BIND: org-latex-pdf-process ...
should work.
--
Bastien
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-todo-keywords-1 detection in asyn export
2014-04-17 7:07 ` Bastien
@ 2014-04-17 10:58 ` zwz
2014-04-17 20:18 ` Nicolas Goaziou
0 siblings, 1 reply; 7+ messages in thread
From: zwz @ 2014-04-17 10:58 UTC (permalink / raw)
To: emacs-orgmode
Bastien <bzg@gnu.org> writes:
> zwz <zhangweize@gmail.com> writes:
>
>> How to locally set org-latex-pdf-process?
>
> #+BIND: org-latex-pdf-process ...
>
> should work.
Thank you, Bastien.
Sometimes my org-latex-pdf-process is quite complicated, as I will
set or add-to-list some extra process, for example:
if "XeTeX" is a member of org-todo-keywords-1, I would set the local
org-latex-pdf-process to use xelatex instead of pdflatex;
if "handout" is a member of org-todo-keywords-1, I would add-to-list
some preprocessing steps and even "pdfnup" into org-latex-pdf-process to
generate a ready-for-print version at the same time;
...
So here what I mean by "locally" is to adjust the org-latex-pdf-process
by some keywords, instead of binding it with some specific code/value
(which is difficult for modification)
However I found it does not work in asyn export.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-todo-keywords-1 detection in asyn export
2014-04-17 10:58 ` zwz
@ 2014-04-17 20:18 ` Nicolas Goaziou
2014-04-18 14:21 ` zwz
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2014-04-17 20:18 UTC (permalink / raw)
To: zwz; +Cc: emacs-orgmode
Hello,
zwz <zhangweize@gmail.com> writes:
> So here what I mean by "locally" is to adjust the org-latex-pdf-process
> by some keywords, instead of binding it with some specific code/value
> (which is difficult for modification)
`org-latex-pdf-process' can be a function. You could send it a message
telling it what functions to use. For example, a hook could find out
what LaTeX class you're using and send the appropriate message to the
function.
> However I found it does not work in asyn export.
Is is not related to async export.
A few variables live outside the scope of BIND keywords.
`org-latex-pdf-process' is one of them. Though, you can always define it
as a file local variable.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-todo-keywords-1 detection in asyn export
2014-04-17 20:18 ` Nicolas Goaziou
@ 2014-04-18 14:21 ` zwz
2014-04-18 19:13 ` Nicolas Goaziou
0 siblings, 1 reply; 7+ messages in thread
From: zwz @ 2014-04-18 14:21 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Hello,
>
> zwz <zhangweize@gmail.com> writes:
>
>> So here what I mean by "locally" is to adjust the org-latex-pdf-process
>> by some keywords, instead of binding it with some specific code/value
>> (which is difficult for modification)
>
> `org-latex-pdf-process' can be a function. You could send it a message
> telling it what functions to use. For example, a hook could find out
> what LaTeX class you're using and send the appropriate message to the
> function.
>
Thank you, Nicolas.
Can you give me some example code?
>> However I found it does not work in asyn export.
>
> Is is not related to async export.
I am not sure if I get you totally.
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
And in some test.org:
#+TODO: XeTeX
* test
blah blah
When I export it asynchronously, org-export calls pdflatex rather than
xelatex to generate pdf.
And even I put (ox-xetex-setup) directly in org-export-async-init-file,
it still does not work as expected.
>
> A few variables live outside the scope of BIND keywords.
> `org-latex-pdf-process' is one of them. Though, you can always define it
> as a file local variable.
>
>
> Regards,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-todo-keywords-1 detection in asyn export
2014-04-18 14:21 ` zwz
@ 2014-04-18 19:13 ` Nicolas Goaziou
2014-04-19 13:47 ` zwz
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2014-04-18 19:13 UTC (permalink / raw)
To: zwz; +Cc: emacs-orgmode
zwz <zhangweize@gmail.com> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-todo-keywords-1 detection in asyn export
2014-04-18 19:13 ` Nicolas Goaziou
@ 2014-04-19 13:47 ` zwz
0 siblings, 0 replies; 7+ messages in thread
From: zwz @ 2014-04-19 13:47 UTC (permalink / raw)
To: emacs-orgmode
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,
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-04-19 14:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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).