(Emacs/config)-org compile to PDF on save

This commit is contained in:
2024-08-16 12:23:52 +01:00
parent 515fc7fab8
commit a19da412b5

View File

@@ -930,6 +930,7 @@ configuration for an example.
Here's a collection of keywords and possible associated symbols for Here's a collection of keywords and possible associated symbols for
any prog language of choice. Mostly for reference and copying. any prog language of choice. Mostly for reference and copying.
#+begin_example #+begin_example
("null" . "Ø") ("null" . "Ø")
("list" . "") ("list" . "")
@@ -2977,32 +2978,6 @@ time a clock out occurs.")
(setq-local +org/clock-out-toggle-report (setq-local +org/clock-out-toggle-report
(not +org/clock-out-toggle-report))))) (not +org/clock-out-toggle-report)))))
#+end_src #+end_src
** Org compile to PDF on save
If ~+org/compile-to-pdf-on-save-p~ is non-nil, then compile to
\(\LaTeX\) and run an async process to compile it to a PDF. Doesn't
make Emacs hang (like ~org-latex-export-to-pdf~) and doesn't randomly
crash (like the async handler for org-export).
#+begin_src emacs-lisp
(use-package org
:defer t
:init
(defvar +org/compile-to-pdf-on-save-p
nil
"Non-nil to activate compile functionality.")
:general
(local-leader
:keymaps 'org-mode-map
"C" (proc (interactive)
(if (+org/compile-to-pdf-on-save-f)
(setq-local +org/compile-to-pdf-on-save-p nil)
(setq-local +org/compile-to-pdf-on-save-p t))))
:config
(+oreo/create-auto-save
(and (eq major-mode 'org-mode) +org/compile-to-pdf-on-save-p)
(start-process-shell-command
"" "*pdflatex*"
(concat "pdflatex -shell-escape " (org-latex-export-to-latex)))))
#+end_src
** WAIT Org ref ** WAIT Org ref
:PROPERTIES: :PROPERTIES:
:header-args:emacs-lisp: :tangle no :header-args:emacs-lisp: :tangle no