daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Oct 11th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/emacs --script
  2. ;;; naive build system for Org-mode files
  3.  
  4. (defun build-doc(doc-file)
  5.   "Export .org file as HTML"
  6.   (find-file-read-only doc-file)
  7.   (org-export-as-html 3)) ;; 3 is: how many levels of the outline should become headlines
  8.  
  9. (defun build-docs()
  10.   "Export all the .org files in the current directory"
  11.   (setq docs (directory-files "." t "^[^.#].*\.*org$"))
  12.   (while docs
  13.     (build-doc (car docs))
  14.     (setq docs (cdr docs))))
  15.  
  16. (defun run-build-loop()
  17.   "Endlessly: wait for some .org file modification, and re-export all the *.org"
  18.   (while t
  19.     (shell-command "inotifywait -e move_self -e modify -e close_write [^#]*.org")
  20.     (build-docs)
  21.     (mapc 'kill-buffer (buffer-list))))
  22.  
  23. (run-build-loop)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top