30 lines
806 B
EmacsLisp
30 lines
806 B
EmacsLisp
|
;;; +ox.el --- org-export helpers -*- lexical-binding: t; -*-
|
||
|
|
||
|
;;; Commentary:
|
||
|
|
||
|
;;; Code:
|
||
|
|
||
|
(require 'ox)
|
||
|
|
||
|
;;; Run hooks before doing any exporting at all
|
||
|
|
||
|
(defcustom +org-export-pre-hook nil
|
||
|
"Functions to run /before/ `org-export-as' does anything.
|
||
|
These will run on the buffer about to be exported, NOT a copy."
|
||
|
:type 'hook)
|
||
|
|
||
|
(defun +org-export-pre-run-hooks (&rest _)
|
||
|
"Run hooks in `+org-export-pre-hook'."
|
||
|
(run-hooks '+org-export-pre-hook))
|
||
|
|
||
|
(defun +org-export-pre-hooks-insinuate ()
|
||
|
"Advise `org-export-as' to run `+org-export-pre-hook'."
|
||
|
(advice-add 'org-export-as :before #'+org-export-pre-run-hooks))
|
||
|
|
||
|
(defun +org-export-pre-hooks-remove ()
|
||
|
"Remove pre-hook advice on `org-export-as'."
|
||
|
(advice-remove 'org-export-as #'+org-export-pre-run-hooks))
|
||
|
|
||
|
(provide '+ox)
|
||
|
;;; +ox.el ends here
|