summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ennu.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/ennu.el b/ennu.el
index 3eac9a4..5d37a71 100644
--- a/ennu.el
+++ b/ennu.el
@@ -10,7 +10,10 @@
 (defvar ennu-version "0.1.0"
   "Ennu version string")
 
-(defmacro ennu--with-file-contents (file &rest body)
+(defmacro ennu-with-file-contents (file &rest body)
+  "Create a temporary buffer, insert contents of FILE into that
+buffer and evaluate BODY. The value returned is the value of the
+last form in BODY."
   (declare (indent defun))
   `(with-temp-buffer
      (insert-file-contents ,file)
@@ -24,7 +27,7 @@
   `((,post)
     (,(ennu--org-output-filename post))
     ,(lambda (output-file)
-       (ennu--with-file-contents post
+       (ennu-with-file-contents post
          (org-export-to-file 'ennu-html output-file))
        ;; (when-let (tangle-dir (or (plist-get posts-plist :valai-tangle-directory)
        ;;                           valai-tangle-directory))
@@ -46,7 +49,7 @@
         (file-name-as-directory pages-directory)
         page)))
     ,(lambda (output-file)
-       (ennu--with-file-contents page
+       (ennu-with-file-contents page
          (org-export-to-file 'html output-file)))))
 
 (defun ennu-video-poster (video)
@@ -168,7 +171,7 @@
              (name ,(plist-get metadata :author))
              (email ,user-mail-address))
             (content :type "html" :xml:lang ,lang
-                     ,(ennu--with-file-contents post
+                     ,(ennu-with-file-contents post
                         (org-export-as 'ennu-html nil nil t)))
             (link :rel "alternate" :href ,link)
             ,@(seq-map (lambda (tag) `(category :term ,tag))
@@ -228,7 +231,7 @@
   `((,file) (,file) ,(apply-partially 'copy-file file)))
 
 (defun ennu-post-links (post)
-  (ennu--with-file-contents post
+  (ennu-with-file-contents post
     (org-element-map (org-element-parse-buffer) 'link
       (lambda (link)
         (pcase link
@@ -250,7 +253,7 @@
          (file-attributes post))))
 
 (defmemoize ennu--post-metadata-memoized (post last-modified)
-  (ennu--with-file-contents post
+  (ennu-with-file-contents post
     (let ((metadata (org-export-get-environment 'ennu-html))
           (export (apply-partially 'org-export-with-backend 'ennu-html)))
       (seq-do (lambda (key)