From 2df4c1ca040a5e6f18a89fec5845da34987f9d5f Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 11 Dec 2009 08:40:19 +0100 Subject: [PATCH] New hook org-export-first-hook --- lisp/ChangeLog | 16 ++++++++++++++++ lisp/org-ascii.el | 1 + lisp/org-docbook.el | 2 ++ lisp/org-exp.el | 4 ++++ lisp/org-html.el | 1 + lisp/org-latex.el | 2 ++ lisp/org-xoxo.el | 1 + 7 files changed, 27 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index de6aff05d..d24e46f38 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,19 @@ +2009-12-11 Carsten Dominik + + * org-xoxo.el (org-export-as-xoxo): Run `org-export-first-hook'. + + * org-latex.el (org-export-region-as-latex): Run + `org-export-first-hook'. + + * org-html.el (org-export-as-html): Run `org-export-first-hook'. + + * org-docbook.el (org-export-as-docbook): Run + `org-export-first-hook'. + + * org-ascii.el (org-export-as-ascii): Run `org-export-first-hook'. + + * org-exp.el (org-export-first-hook): New hook. + 2009-12-10 Carsten Dominik * org-list.el (org-previous-item): Exit at the beginning of the diff --git a/lisp/org-ascii.el b/lisp/org-ascii.el index 947c2e48a..3019a1a00 100644 --- a/lisp/org-ascii.el +++ b/lisp/org-ascii.el @@ -156,6 +156,7 @@ resulting ASCII as a string. When BODY-ONLY is set, don't produce the file header and footer. When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) (setq-default org-todo-line-regexp org-todo-line-regexp) (let* ((opt-plist (org-combine-plists (org-default-export-plist) ext-plist diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index 0153fd970..2a0431040 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -384,6 +384,8 @@ header and footer, simply return the content of the document (all top-level sections). When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) + ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) (not buffer-file-name)) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 797f1f04d..ca8d2f639 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -357,6 +357,10 @@ drawer names to export." (repeat :tag "Selected drawers" (string :tag "Drawer name")))) +(defvar org-export-first-hook nil + "Hook called as the first thing in each exporter. +Good for general initialization") + (defvar org-export-preprocess-hook nil "Hook for preprocessing an export buffer. Pretty much the first thing when exporting is running this hook.") diff --git a/lisp/org-html.el b/lisp/org-html.el index b012a7547..8869ad6b1 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -539,6 +539,7 @@ the file header and footer, simply return the content of ..., without even the body tags themselves. When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 8403bf9d0..f73576df2 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -521,6 +521,8 @@ simply return the content of \begin{document}...\end{document}, without even the \begin{document} and \end{document} commands. when PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) + ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) (not buffer-file-name)) diff --git a/lisp/org-xoxo.el b/lisp/org-xoxo.el index 40feef2b4..a46f5d128 100644 --- a/lisp/org-xoxo.el +++ b/lisp/org-xoxo.el @@ -43,6 +43,7 @@ "Export the org buffer as XOXO. The XOXO buffer is named *xoxo-*" (interactive (list (current-buffer))) + (run-hooks 'org-export-first-hook) ;; A quickie abstraction ;; Output everything as XOXO