+ (use-package git)
+
+ (defun org-git-version ()
+ "The Git version of org-mode.
+ Inserted by installing org-mode or when a release is made."
+ (require 'git)
+ (let ((git-repo (expand-file-name
+ "straight/repos/org/" user-emacs-directory)))
+ (string-trim
+ (git-run "describe"
+ "--match=release\*"
+ "--abbrev=6"
+ "HEAD"))))
+
+ (defun org-release ()
+ "The release version of org-mode.
+ Inserted by installing org-mode or when a release is made."
+ (require 'git)
+ (let ((git-repo (expand-file-name
+ "straight/repos/org/" user-emacs-directory)))
+ (string-trim
+ (string-remove-prefix
+ "release_"
+ (git-run "describe"
+ "--match=release\*"
+ "--abbrev=0"
+ "HEAD")))))
+
+(provide 'org-version)
+#+end_src
+
+We will use the =org-plus-contrib= package to get the whole deal:
+
+#+begin_src emacs-lisp
+(straight-use-package 'org-plus-contrib)
+#+end_src
+
+And here's where my actual Org configurations begin:
+
+#+begin_src emacs-lisp
+(use-feature org
+ :defer 0.5
+ :config
+ (setq org-src-tab-acts-natively t
+ org-src-preserve-indentation nil
+ org-edit-src-content-indentation 0
+ org-email-link-description-format "Email %c: %s" ; %.30s
+ org-highlight-latex-and-related '(entities)
+ org-use-speed-commands t
+ org-startup-folded 'content
+ org-catch-invisible-edits 'show-and-error
+ org-log-done 'time)
+ (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t)
+ (font-lock-add-keywords
+ 'org-mode
+ '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
+ (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
+ (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
+ (4 '(:foreground "#c5c8c6") t))) ; title
+ t)
+ :bind (:map org-mode-map ("M-L" . org-insert-last-stored-link))
+ :hook ((org-mode . org-indent-mode)
+ (org-mode . auto-fill-mode)
+ (org-mode . flyspell-mode))
+ :custom
+ (org-latex-packages-alist '(("" "listings") ("" "color")))
+ :custom-face
+ '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21"))))
+ '(org-block ((t (:background "#1d1f21"))))
+ '(org-latex-and-related ((t (:foreground "#b294bb")))))
+
+(use-feature ox-latex
+ :after ox
+ :config
+ (setq org-latex-listings 'listings
+ ;; org-latex-prefer-user-labels t
+ )
+ (add-to-list 'org-latex-packages-alist '("" "listings"))
+ (add-to-list 'org-latex-packages-alist '("" "color"))
+ (add-to-list 'org-latex-classes
+ '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
+ ("\\section{%s}" . "\\section*{%s}")
+ ("\\subsection{%s}" . "\\subsection*{%s}")
+ ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
+ ("\\paragraph{%s}" . "\\paragraph*{%s}")
+ ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
+ t))
+
+(use-feature ox-beamer
+ :after ox)
+#+end_src
+
+**** asynchronous tangle
+
+=a/async-babel-tangle= is a function closely inspired by [[https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles][dieggsy's
+d/async-babel-tangle]] which uses [[https://github.com/jwiegley/emacs-async][async]] to asynchronously tangle an org
+file.
+
+#+begin_src emacs-lisp
+(with-eval-after-load 'org
+ (defvar a/show-async-tangle-results nil
+ "Keep *emacs* async buffers around for later inspection.")
+
+ (defvar a/show-async-tangle-time nil
+ "Show the time spent tangling the file.")
+
+ (defvar a/async-tangle-post-compile "make ti"
+ "If non-nil, pass to `compile' after successful tangle.")
+
+ (defun a/async-babel-tangle ()
+ "Tangle org file asynchronously."
+ (interactive)
+ (let* ((file-tangle-start-time (current-time))
+ (file (buffer-file-name))
+ (file-nodir (file-name-nondirectory file))
+ ;; (async-quiet-switch "-q")
+ )
+ (async-start
+ `(lambda ()
+ (require 'org)
+ (org-babel-tangle-file ,file))
+ (unless a/show-async-tangle-results
+ `(lambda (result)
+ (if result
+ (progn
+ (message "Tangled %s%s"
+ ,file-nodir
+ (if a/show-async-tangle-time
+ (format " (%.3fs)"
+ (float-time (time-subtract (current-time)
+ ',file-tangle-start-time)))
+ ""))
+ (when a/async-tangle-post-compile
+ (compile a/async-tangle-post-compile)))
+ (message "Tangling %s failed" ,file-nodir))))))))
+
+(add-to-list
+ 'safe-local-variable-values
+ '(eval add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local))