From 5debd49d6474d0f0ddd2003b282d157f6a1a5a37 Mon Sep 17 00:00:00 2001 From: shoshin Date: Wed, 16 Nov 2022 20:22:24 -0600 Subject: Clean: heading -> headline and some org doc notes --- coorgi-client.org | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'coorgi-client.org') diff --git a/coorgi-client.org b/coorgi-client.org index af342ec..35ec5b5 100644 --- a/coorgi-client.org +++ b/coorgi-client.org @@ -2,7 +2,10 @@ * Coorgi Client - A collaborative org document sync client. -#+begin_src emacs-lisp :tangle yes :noweb no-export +If you evaluate the following block, it will effecively "eval-buffer" +on the whole shebang. + +#+begin_src emacs-lisp :tangle yes :noweb no-export :results silent ;;; coorgi-client.el --- A collaborative org document sync client. -*- lexical-binding: t; -*- <> @@ -13,7 +16,7 @@ <> - <> + <> <> @@ -57,6 +60,7 @@ Converts the current org outline section into a coorgi-node data structure. #+name: coorgify-at-point #+begin_src emacs-lisp :results none (defun coorgify-at-point () + (interactive) (save-excursion (let* ((current-element (org-element-at-point)) (entry (if (not (equal (car current-element) 'heading)) @@ -199,24 +203,24 @@ a cow another cow #+end_src -** coorgi--find-heading +** coorgi--find-headline We need to used the parsed version of the org buffer to look up the elements we're turning into coorgi nodes and get the relevant data to pack it up recursively. -#+name: coorgi--find-heading +#+name: coorgi--find-headline #+begin_src emacs-lisp :results none - (defun coorgi--find-heading (heading org-data) + (defun coorgi--find-headline (headline org-data) (car (org-element-map org-data 'headline (lambda (hl) (when (string-equal (org-element-property :raw-value hl) - (org-element-property :raw-value heading)) + (org-element-property :raw-value headline)) hl))))) #+end_src #+begin_src emacs-lisp :var org-doc=trivial-example() :results code (let ((org-data (with-temp-buffer (insert org-doc) (org-element-parse-buffer)))) - (coorgi--find-heading '(headline (:raw-value "MOO")) org-data)) + (coorgi--find-headline '(headline (:raw-value "MOO")) org-data)) #+end_src #+RESULTS: @@ -261,6 +265,13 @@ as it gets parsed into its various elements. ) #+end_src +*** tests + +#+begin_src emacs-lisp + (let ((org-data (with-temp-buffer (insert org-doc) (org-element-parse-buffer))) + (headline (coorgi--find-headline '(headline (:raw-value "MOO")) org-data))) + (coorgi--property-drawer-p headline)) +#+end_src * Copyright #+begin_src emacs-lisp :noweb-ref copyright -- cgit v1.2.3