/organ

Primary LanguageCommon Lisp

organ

This is a modular tool for extracting information from emacs org-mode files. It’s highly opinionated and only suited for parsing my documents. This means I may introduce syntax which is not supported by or which can’t be interpreted by Emacs Org-Mode. It also means that the complete Org-element API will not be supported. The most troublesome of org-mode features are simply ignored.

This project is driven by the idea that org-mode is pretty cool, but that previous attempts to build a robust parser implementation have been hindered by their attempts to clone the functionality as well.

  • Goals
    org->sxp
    takes org-mode stream outputs SXP forms
    parallel
    take advantage of multi-threading to parse multiple trees simultaneously
    composable
    specialized methods for combining and composing org-mode nodes
  • Dependencies
    SBCL
    cl-ppcre
    (ql:quickload :cl-ppcre)
    sxp
    https://lab.rwest.io/ellis/sxp
    macs
    https://lab.rwest.io/ellis/macs

Tests

(load "tests.lisp")
(setq log:*log-level* nil) ;; :debug,t
(setq rt:*catch-test-errors* t)
(setq rt:*compile-tests* nil)
(list (multiple-value-list (rt:do-tests :organ)) (rt:test-results rt:*test-suite*))
in suite ORGAN with 6/6 tests:
#<PASS OUTPUT> 
#<PASS SUBCMDS> 
#<PASS SANITY> 
#<PASS ORG-HEADLINE> 
#<PASS ORG-LINES> 
#<PASS ORG-FILE> 
No tests failed.

Ideas

parse org-elements as sxp

  • State “TODO” from [2023-09-25 Mon 15:23]
(slime-start)
(ql:quickload :organ)
(macroexpand-1 (org-element-parse-buffer))
(let ((sxp (sxp:make-sxp)))
  ;; SIMPLE-READER-ERROR #\) when using read
  (sxp:wrap-from-string! sxp in)
  (describe sxp))