org-latex-preview: Get a list of all started tasks

* lisp/org-latex-preview.el (org-latex-preview--create-image-async):
Instead of just returning the main tex-compile task, return a list of
all async tasks created (i.e. the dvipng task, when used).  This will
allow for `org-async-wait-for' to be used on the list to wait until all
processing has completed.
This commit is contained in:
TEC 2023-02-26 20:32:29 +08:00
parent f592d7b3cc
commit c769032876
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 7 additions and 4 deletions

View File

@ -1262,7 +1262,9 @@ generated fragment image being placed in the buffer.
LATEX-PROCESSOR is a member of `org-latex-compilers' which is guessed if unset.
When provided, LATEX-PREAMBLE overrides the default LaTeX preamble."
When provided, LATEX-PREAMBLE overrides the default LaTeX preamble.
Returns a list of async tasks started."
(let* ((processing-type
(or processing-type org-latex-preview-default-process))
(latex-processor
@ -1381,10 +1383,11 @@ When provided, LATEX-PREAMBLE overrides the default LaTeX preamble."
#'org-latex-preview--check-all-fragments-produced))))
(if (and (eq processing-type 'dvipng)
(member "--follow" (cadr img-extract-async)))
(org-async-call img-extract-async)
(list (org-async-call tex-compile-async)
(org-async-call img-extract-async))
(plist-put (cddr tex-compile-async) :success img-extract-async)
(plist-put (cddr tex-compile-async) :failure img-extract-async))
(org-async-call tex-compile-async))))
(plist-put (cddr tex-compile-async) :failure img-extract-async)
(list (org-async-call tex-compile-async))))))
(defun org-latex-preview--failure-callback (_exit _buf extended-info)
"Clear overlays corresponding to previews that failed to generate.