fix org async export

This commit is contained in:
2022-12-12 21:39:34 +01:00
parent 1eadf8f6ff
commit 7168c8204a
5 changed files with 94 additions and 94 deletions

View File

@@ -249,6 +249,7 @@ Example defines
:load-path (lambda () (list (concat config-dir "lisp/org")))
:delight (org-mode "Org") ;; "Org " "\u01F15E"
:defer t
:after (ob-csharp)
;;:bind (("C-c <del>" . org-mark-ring-goto)) ;; normally at C-c & but it is redefined by yasnippet
:init
(setq org-export-backends '(ascii html icalendar latex md odt reveal tufte))
@@ -613,7 +614,7 @@ Updating an old preamble.org should remove this warning."))
:after (org))
(use-package ob-csharp
:after (org org-contrib))
:after (org-contrib))
(use-package ob-ditaa
:defer t
@@ -1113,45 +1114,6 @@ Uses function `my-org-headline-string-element'"
"maf" ;; minitoc package; list of discardable auxiliary files used by minitoc
"mtc0" ;; minitoc package; table of contents for a chapter
))
(defun my-org-latex-export-to-pdf
(&optional async subtreep visible-only body-only ext-plist)
"Like `org-latex-export-to-pdf' but with additional notification.
And using the rewritten design for an article
`my-org-article-latex-export-to-pdf' (article-latex instead of
latex)."
(interactive)
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-to-file 'article-latex outfile
async subtreep visible-only body-only ext-plist
(lambda (file) ;; is called with FILE and has to return a file name.
(let ((output (org-latex-compile file)))
(when my-dbusp
(use-package notifications)
(notifications-notify
:title "Emacs Org Latex Export to PDF"
:body "Export <b>done</b>."
:timeout 60000
:urgency 'normal
:category "transfer"))
output))))) ;; is needed for the asynchronous task
(defun my-org-export-pdf (&optional async)
(interactive)
(save-buffer)
(when (get-buffer "*gnuplot*")
(kill-buffer "*gnuplot*")) ;; to get a new session
(my-org-latex-export-to-pdf async))
(defun my-org-export-pdf-async ()
"For async a new emacs session starts using
`org-export-async-init-file'."
;; TODO: define org-export-async-init-file
(interactive)
(my-org-export-pdf t))
(org-defkey org-mode-map [f6] 'my-org-export-pdf)
(org-defkey org-mode-map [C-f6] 'my-org-export-pdf-async)
;; overwrite org ox-latex
(defun org-latex--inline-image (link info)
@@ -1332,43 +1294,6 @@ used as a communication channel."
(use-package ox-tufte ;; https://melpa.org/#/ox-tufte
:defer t ;; will be loaded via `org-export-backends' see above inside `org'
:config
(defun my-org-tufte-export-to-file (&optional async subtreep visible-only)
"Like `org-tufte-export-to-file' but with additional notification."
(interactive)
(let ((outfile (org-export-output-file-name ".html" subtreep))
;; need to bind this because tufte treats footnotes specially, so we
;; don't want to display them at the bottom
(org-html-footnotes-section (if org-tufte-include-footnotes-at-bottom
org-html-footnotes-section
"<!-- %s --><!-- %s -->")))
(org-export-to-file 'tufte-html outfile
async subtreep visible-only nil nil
(lambda (file) ;; is called with FILE and has to return a file name.
(progn
(when my-dbusp
(use-package notifications)
(notifications-notify
:title "Emacs Org Tufte (HTML) Export to File"
:body "Export <b>done</b>."
:timeout 60000
:urgency 'normal
:category "transfer"))
file))))) ;; is needed for the asynchronous task
(defun my-org-export-html (&optional async)
(interactive)
(save-buffer)
(when (get-buffer "*gnuplot*")
(kill-buffer "*gnuplot*")) ;; to get a new session
(my-org-tufte-export-to-file async))
(defun my-org-export-html-async ()
(interactive)
(my-org-export-html t))
(org-defkey org-mode-map [f5] 'my-org-export-html)
(org-defkey org-mode-map [C-f5] 'my-org-export-html-async)
(defun org-tufte-src-block (src-block _contents info)
"Transcode a SRC-BLOCK element from Org to HTML.
CONTENTS holds the contents of the item. INFO is a plist holding