From 7f37518e4792f040a753a5d8d68d51e76cc0b2be Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Sat, 13 Jul 2024 17:55:47 -0400 Subject: Initial migration to org-reader Long-term I would like to merge the =posts-assets= and =posts= directories but currently Haunt will crash if something exists in the =posts= directory that can't be processed by a reader --- haunt/jakob/reader/org-mode.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'haunt/jakob/reader/org-mode.scm') diff --git a/haunt/jakob/reader/org-mode.scm b/haunt/jakob/reader/org-mode.scm index 7f064f1..b55dbf3 100644 --- a/haunt/jakob/reader/org-mode.scm +++ b/haunt/jakob/reader/org-mode.scm @@ -49,6 +49,10 @@ (or (getenv "HAUNT_ORG_READER_CACHE_DIR") "./.org-mode-reader-cache/")))) +;; File name of Elisp script to execute before anything else +(define %additional-emacs-preamble + (make-parameter (getenv "HAUNT_ORG_READER_EMACS_PREAMBLE"))) + ;; Additional Org-mode keywords to include in the extracted metadata. (define %additional-keys (make-parameter '("CROSSPOST" "SCRIPTS" "META-TAGS"))) @@ -62,7 +66,13 @@ If `%use-emacsclient' is truthy, evaluate FORM in the current running Emacs daemon. Assumes that FORM does not write to `standard-output'." - (let* (;; We need to explicitly request that Emacs write the result if using + (let* (;; If `HAUNT_ORG_READER_PREAMBLE' is specified, load that. + (form (if (%additional-emacs-preamble) + `(progn + (load-file ,(%additional-emacs-preamble)) + ,form) + form)) + ;; We need to explicitly request that Emacs write the result if using ;; Emacs batch mode (which is how we evaluate forms without ;; `emacsclient'.) (form (if (not (%use-emacsclient)) -- cgit v1.3