summaryrefslogtreecommitdiff
path: root/coorgi-client.org
diff options
context:
space:
mode:
Diffstat (limited to 'coorgi-client.org')
-rw-r--r--coorgi-client.org25
1 files changed, 18 insertions, 7 deletions
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; -*-
<<copyright>>
@@ -13,7 +16,7 @@
<<defvars>>
- <<coorgi--find-heading>>
+ <<coorgi--find-headline>>
<<coorgify-at-point>>
@@ -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