about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el8
-rw-r--r--lisp/+ox.el29
2 files changed, 35 insertions, 2 deletions
diff --git a/init.el b/init.el index 6e80b41..ca0c507 100644 --- a/init.el +++ b/init.el
@@ -796,7 +796,8 @@
796 org-attach-id-uuid-folder-format))) 796 org-attach-id-uuid-folder-format)))
797 797
798(setup ox ; org-export 798(setup ox ; org-export
799 (:also-load ox-md) 799 (:also-load +ox
800 ox-md)
800 (:option org-export-coding-system 'utf-8-unix 801 (:option org-export-coding-system 'utf-8-unix
801 org-export-headline-levels 8 802 org-export-headline-levels 8
802 org-export-with-drawers nil 803 org-export-with-drawers nil
@@ -804,8 +805,11 @@
804 org-export-with-smart-quotes t 805 org-export-with-smart-quotes t
805 org-export-with-sub-superscripts t 806 org-export-with-sub-superscripts t
806 org-export-with-toc nil) 807 org-export-with-toc nil)
808 (with-eval-after-load 'ox
809 (+org-export-pre-hooks-insinuate))
810 (add-hook '+org-export-pre-hook #'+flyspell-correct-buffer)
807 (with-eval-after-load 'user-save 811 (with-eval-after-load 'user-save
808 (advice-add 'org-export-as :before #'user-save-run-hooks))) 812 (add-hook '+org-export-pre-hook #'user-save-run-hooks)))
809 813
810(setup password-cache 814(setup password-cache
811 (:option password-cache t 815 (:option password-cache t
diff --git a/lisp/+ox.el b/lisp/+ox.el new file mode 100644 index 0000000..8748a55 --- /dev/null +++ b/lisp/+ox.el
@@ -0,0 +1,29 @@
1;;; +ox.el --- org-export helpers -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;;; Code:
6
7(require 'ox)
8
9;;; Run hooks before doing any exporting at all
10
11(defcustom +org-export-pre-hook nil
12 "Functions to run /before/ `org-export-as' does anything.
13These will run on the buffer about to be exported, NOT a copy."
14 :type 'hook)
15
16(defun +org-export-pre-run-hooks (&rest _)
17 "Run hooks in `+org-export-pre-hook'."
18 (run-hooks '+org-export-pre-hook))
19
20(defun +org-export-pre-hooks-insinuate ()
21 "Advise `org-export-as' to run `+org-export-pre-hook'."
22 (advice-add 'org-export-as :before #'+org-export-pre-run-hooks))
23
24(defun +org-export-pre-hooks-remove ()
25 "Remove pre-hook advice on `org-export-as'."
26 (advice-remove 'org-export-as #'+org-export-pre-run-hooks))
27
28(provide '+ox)
29;;; +ox.el ends here