emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Modifying org-latex-pdf-process doesn't modify the async export behaviour
@ 2018-04-06  9:13 Leo Vivier
  2018-04-07  7:59 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Vivier @ 2018-04-06  9:13 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I've encountered an issue trying to write a function to toggle between 
two org-latex-pdf-process states (short & long). The function works as 
intended when using synchronous export (the PDF is created with the 
appropriate number of steps), but it doesn't work with asynchronous 
export (org-latex-pdf-process isn't grabbed past the first run).

Here's my function:
# ----------------------------------------------------------------------
(defvar zaeph/org-latex-pdf-process-mode)
(defun zaeph/toggle-org-latex-pdf-process ()
   "Toggle the number of steps in the xelatex PDF process."
   (interactive)
   (if (or (not (bound-and-true-p zaeph/org-latex-pdf-process-mode))
	  (string= zaeph/org-latex-pdf-process-mode "short"))
       (progn (setq org-latex-pdf-process '("xelatex -shell-escape\
                                                     -interaction 
nonstopmode\
                                                     -output-directory 
%o %f"
					   "biber %b"
					   "xelatex -shell-escape\
                                                     -interaction 
nonstopmode\
                                                     -output-directory 
%o %f"
					   "xelatex -shell-escape\
                                                     -interaction 
nonstopmode\
                                                     -output-directory 
%o %f")
		   zaeph/org-latex-pdf-process-mode 'long)
	     (message "XeLaTeX process mode: Long"))
     (progn (setq org-latex-pdf-process '("xelatex -shell-escape\
                                                   -interaction nonstopmode\
                                                   -output-directory %o %f")
		 zaeph/org-latex-pdf-process-mode 'short)
	   (message "XeLaTeX process mode: Short"))))
(zaeph/toggle-org-latex-pdf-process)
# ----------------------------------------------------------------------

I've tried appending (org-reload) to my function, but it didn't work.
I've also tried modifying org-latex-pdf-process on a fresh emacs session 
prior to any async export, and I can confirm that it grabs the latest 
state of org-latex-pdf-process. I'd surmise that async export has a 
process running in the background, but I don't know how to force it to 
reload.

Would you have any idea?

Thanks.

Best,
-- 
Leo Vivier
English Studies & General Linguistics
Master Student, English Department
Rennes 2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: Modifying org-latex-pdf-process doesn't modify the async export behaviour
  2018-04-06  9:13 Bug: Modifying org-latex-pdf-process doesn't modify the async export behaviour Leo Vivier
@ 2018-04-07  7:59 ` Nicolas Goaziou
  2018-04-07  9:16   ` Leo Vivier
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2018-04-07  7:59 UTC (permalink / raw)
  To: Leo Vivier; +Cc: emacs-orgmode

Hello,

Leo Vivier <leo.vivier@gmail.com> writes:

> I've encountered an issue trying to write a function to toggle between
> two org-latex-pdf-process states (short & long). The function works as
> intended when using synchronous export (the PDF is created with the
> appropriate number of steps), but it doesn't work with asynchronous
> export (org-latex-pdf-process isn't grabbed past the first run).

[...]

> I've tried appending (org-reload) to my function, but it didn't work.
> I've also tried modifying org-latex-pdf-process on a fresh emacs
> session prior to any async export, and I can confirm that it grabs the
> latest state of org-latex-pdf-process. I'd surmise that async export
> has a process running in the background, but I don't know how to force
> it to reload.

The background process doesn't use whatever configuration is loaded in
current Emacs. Instead it loads a configuration file. See
`org-export-async-init-file'.

You may also use local variables in your document, or switch async
configuration files.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: Modifying org-latex-pdf-process doesn't modify the async export behaviour
  2018-04-07  7:59 ` Nicolas Goaziou
@ 2018-04-07  9:16   ` Leo Vivier
  2018-04-07  9:44     ` Neil Jerram
  2018-04-07 10:41     ` Rasmus
  0 siblings, 2 replies; 5+ messages in thread
From: Leo Vivier @ 2018-04-07  9:16 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hello,

Thank you for pointing me in the right direction. I've created another 
init file just for async-export, and not only have I got it to work, but 
it's also quite a lot faster than it used to be.

All that remains now is to find a way to re-write my function. My 
knowledge of elisp if fairly limited, and I don't see how to communicate 
with the background process other than by writing the value of my 
toggle-variable to a file. I guess I could also make a modularise 
async-init.el and control which module is loaded from the main init.el.

At any rate, thank you for your prompt reply.

Best,

On 07/04/18 09:59, Nicolas Goaziou wrote:
> Hello,
> 
> Leo Vivier <leo.vivier@gmail.com> writes:
> 
>> I've encountered an issue trying to write a function to toggle between
>> two org-latex-pdf-process states (short & long). The function works as
>> intended when using synchronous export (the PDF is created with the
>> appropriate number of steps), but it doesn't work with asynchronous
>> export (org-latex-pdf-process isn't grabbed past the first run).
> 
> [...]
> 
>> I've tried appending (org-reload) to my function, but it didn't work.
>> I've also tried modifying org-latex-pdf-process on a fresh emacs
>> session prior to any async export, and I can confirm that it grabs the
>> latest state of org-latex-pdf-process. I'd surmise that async export
>> has a process running in the background, but I don't know how to force
>> it to reload.
> 
> The background process doesn't use whatever configuration is loaded in
> current Emacs. Instead it loads a configuration file. See
> `org-export-async-init-file'.
> 
> You may also use local variables in your document, or switch async
> configuration files.
> 
> Regards,
> 

-- 
Leo Vivier
English Studies & General Linguistics
Master Student, English Department
Rennes 2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: Modifying org-latex-pdf-process doesn't modify the async export behaviour
  2018-04-07  9:16   ` Leo Vivier
@ 2018-04-07  9:44     ` Neil Jerram
  2018-04-07 10:41     ` Rasmus
  1 sibling, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2018-04-07  9:44 UTC (permalink / raw)
  To: Leo Vivier, Nicolas Goaziou; +Cc: emacs-orgmode

Leo Vivier <leo.vivier@gmail.com> writes:

> Hello,
>
> Thank you for pointing me in the right direction. I've created another 
> init file just for async-export, and not only have I got it to work, but 
> it's also quite a lot faster than it used to be.
>
> All that remains now is to find a way to re-write my function. My 
> knowledge of elisp if fairly limited, and I don't see how to communicate 
> with the background process other than by writing the value of my 
> toggle-variable to a file.

Hi Leo,

In general, one would communicate with a subprocess through its input
and output, and to do that in elisp please see (elisp) Input to
Processes.

        Neil

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: Modifying org-latex-pdf-process doesn't modify the async export behaviour
  2018-04-07  9:16   ` Leo Vivier
  2018-04-07  9:44     ` Neil Jerram
@ 2018-04-07 10:41     ` Rasmus
  1 sibling, 0 replies; 5+ messages in thread
From: Rasmus @ 2018-04-07 10:41 UTC (permalink / raw)
  To: emacs-orgmode

Leo Vivier <leo.vivier@gmail.com> writes:

> Hello,
>
> Thank you for pointing me in the right direction. I've created another
> init file just for async-export, and not only have I got it to work,
> but it's also quite a lot faster than it used to be.
>
> All that remains now is to find a way to re-write my function. My
> knowledge of elisp if fairly limited, and I don't see how to
> communicate with the background process other than by writing the
> value of my toggle-variable to a file. I guess I could also make a
> modularise async-init.el and control which module is loaded from the
> main init.el.

Would it be possible to use latexmk or rubber or one of the other
"intelligent" LaTeX compilers?  That /should/ automatically make the
compilation as short as possible.

Rasmus

-- 
I almost cut my hair, it happened just the other day

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-07 10:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06  9:13 Bug: Modifying org-latex-pdf-process doesn't modify the async export behaviour Leo Vivier
2018-04-07  7:59 ` Nicolas Goaziou
2018-04-07  9:16   ` Leo Vivier
2018-04-07  9:44     ` Neil Jerram
2018-04-07 10:41     ` Rasmus

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).