Created
February 23, 2020 00:42
-
-
Save jobez/ef2e9c73261ad9bfe26708eb6ec26a38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defvar EITBW/ontos | |
| '((world-system "61776D45-034D-441D-B306-30925F674126") | |
| (paidea "902f5a3b-3db3-4d36-89d8-6e86179f0862") | |
| (identity-formation "6E3E56A6-9198-4BF6-A34B-E07D46292D47") | |
| (technology "0822AA89-0FC3-4F6C-844C-79D3067018C1") | |
| (education "7C455BF6-9B6E-45D8-824B-96B3DDCFA73D"))) | |
| (defun x-open-me () | |
| "open a file, using current line as file name/path" | |
| (interactive) | |
| (find-file | |
| (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) | |
| (require 'ov) | |
| (defun narrow-clone-at-id (id &optional clone-buffer-name) | |
| (-if-let* (((filename . lino) | |
| (org-id-find id))) | |
| (-let* ((file-buff (get-file-buffer filename)) | |
| (clone-of-file-buffer (make-indirect-buffer | |
| file-buff | |
| clone-buffer-name))) | |
| (with-current-buffer clone-of-file-buffer | |
| (goto-char lino) | |
| (org-show-context) | |
| (org-narrow-to-element) | |
| ;; (olivetti-mode) | |
| (org-mode) | |
| ) | |
| clone-of-file-buffer))) | |
| (setq *EITBW* | |
| (narrow-clone-at-id "f21c2f2b-5d35-418f-aa5f-ba1ed01580a0" "EITBW")) | |
| (defun jhnn-ov-regexp (regexp &optional beg end) | |
| "Make overlays spanning the regions that match REGEXP. | |
| If BEG and END are numbers, they specify the bounds of the search." | |
| (save-excursion | |
| (goto-char (or beg (point-min))) | |
| (let (ov-or-ovs finish) | |
| (ov-recenter (point-max)) | |
| (while (and (not finish) (re-search-forward regexp end t)) | |
| (-let* ((match-string (buffer-substring-no-properties (match-beginning 0) (match-end 0))) | |
| (plainstated-ontoname (substring match-string 1 -1))) | |
| (setq ov-or-ovs (cons (ov-set (ov-make (match-beginning 0) | |
| (match-end 0) | |
| nil (not ov-sticky-front) ov-sticky-rear) | |
| 'onto-name plainstated-ontoname) | |
| ov-or-ovs))) | |
| (when (= (match-beginning 0) (match-end 0)) | |
| (if (eobp) | |
| (setq finish t) | |
| (forward-char 1)))) | |
| ov-or-ovs))) | |
| (with-current-buffer *EITBW* | |
| (setq *eitbw/onto-resonators* | |
| (jhnn-ov-regexp "<[^>]+>") | |
| ;; (ov-set "<[^>]+>" 'face '(:foreground "yellow") 'paideia t) | |
| )) | |
| (ov-set (ov-regexp "^.ov-") 'display "λλ-" 'before-string "(" 'line-prefix "<λ>") | |
| (setq *eitbw/overlays-by-ontoname* | |
| (-> (--group-by (-> it | |
| (ov-val 'onto-name) | |
| ) | |
| *eitbw/onto-resonators*) | |
| (cl-sort (lambda (a b) | |
| (< (length b) | |
| (length a)))))) | |
| (quelpa | |
| '(quelpa-use-package | |
| :fetcher git | |
| :url "https://github.com/quelpa/quelpa-use-package.git")) | |
| (require 'quelpa-use-package) | |
| (use-package om | |
| :quelpa (om :fetcher github :repo "ndwarshuis/om.el")) | |
| (require 'om) | |
| (with-current-buffer (get-buffer-create "*EITBW by ontos*") | |
| (erase-buffer) | |
| (loop for onto-overlays in *eitbw/overlays-by-ontoname* | |
| do (-let* (((ontoname &rest overlays) onto-overlays) | |
| (overlays (cdr onto-overlays))) | |
| (setq jhnn-dbg overlays) | |
| (->> | |
| (om-build-headline! :title-text ontoname | |
| :level 1 | |
| :section-children | |
| (--map | |
| (-> (concat (number-to-string (ov-beg it)) | |
| " " | |
| (number-to-string (ov-end it))) | |
| om-build-paragraph | |
| om-build-item | |
| om-build-plain-list) | |
| overlays)) | |
| om-to-trimmed-string | |
| insert) | |
| (newline))) | |
| (org-mode) | |
| (olivetti-mode)) | |
| (-let* (((ontoname &rest overlays) jhnn-dbg)) | |
| (cdr jhnn-dbg)) | |
| (om-build-plain-list | |
| (car (--map | |
| (-> (concat (number-to-string (ov-beg it)) | |
| " " | |
| (number-to-string (ov-end it))) | |
| om-build-paragraph | |
| om-build-item) | |
| jhnn-dbg))) | |
| ;; (comment | |
| ;; (insert (propertize | |
| ;; ontoname | |
| ;; 'face | |
| ;; '(:background "orange"))) | |
| ;; (newline) | |
| ;; (insert " " (number-to-string (length overlays))) | |
| ;; (newline)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment