summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshoshin <shoshin@cicadas.surf>2022-11-16 21:05:51 -0600
committershoshin <shoshin@cicadas.surf>2022-11-16 21:05:51 -0600
commit869dc60168e0904ed4965848d7d3e731375beac7 (patch)
treefdac1b9c06dc07be420f359f6d0a019edd3b1ce4
parent1c26619c4fb218fe0cdd641e7b2a79d896b8df9f (diff)
Add: trivial implementation of find-property-drawer
-rw-r--r--coorgi-client.el3
-rw-r--r--coorgi-client.org31
2 files changed, 23 insertions, 11 deletions
diff --git a/coorgi-client.el b/coorgi-client.el
index 6739837..526cc70 100644
--- a/coorgi-client.el
+++ b/coorgi-client.el
@@ -38,6 +38,9 @@
(org-element-property :raw-value headline))
hl)))))
+(defun coorgi--find-property-drawer (headline)
+ (caddr (caddr headline)))
+
(defun coorgify-at-point ()
(interactive)
(save-excursion
diff --git a/coorgi-client.org b/coorgi-client.org
index 35ec5b5..5cc4f6f 100644
--- a/coorgi-client.org
+++ b/coorgi-client.org
@@ -1,7 +1,7 @@
#+PROPERTY: header-args:emacs-lisp :lexical t
-* Coorgi Client - A collaborative org document sync client.
-
+* Coorgi Client - A collaborative org document sync client.
+** Overview
If you evaluate the following block, it will effecively "eval-buffer"
on the whole shebang.
@@ -18,6 +18,8 @@ on the whole shebang.
<<coorgi--find-headline>>
+ <<coorgi--find-property-drawer>>
+
<<coorgify-at-point>>
;;; coorgi-client.el ends here
@@ -73,7 +75,6 @@ Converts the current org outline section into a coorgi-node data structure.
unless (member key coorgi-properties)
append (list key value)))
(content-bounds (cons (progn (org-down-element) (org-forward-element) (point)) (plist-get (cadr entry) :contents-end))))
- (print parsed)
`( type entry
headline ,(plist-get (cadr entry) :title)
version ,(string-to-number (plist-get props :COORGI-VERSION))
@@ -251,27 +252,35 @@ we're turning into coorgi nodes and get the relevant data to pack it up recursiv
(:parent #2)))))
#+end_src
-** coorgi--property-drawer-p
+** coorgi--find-property-drawer
It is useful to know whether or not a headline has a property drawer.
+
If not, we know that Coorgi doesn't know about it yet.
+
If so, we need to parse the existing properties into the coorgified
entry data structure.
+
In addition, we get more information about the org document's structure
as it gets parsed into its various elements.
-#+begin_src emacs-lisp
- (defun coorgi--property-drawer-p (headline)
- )
+#+name: coorgi--find-property-drawer
+#+begin_src emacs-lisp :results none
+ (defun coorgi--find-property-drawer (headline)
+ (caddr (caddr headline)))
#+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))
+#+begin_src emacs-lisp :var org-doc=trivial-example()
+ (let* ((org-data (with-temp-buffer (insert org-doc) (org-element-parse-buffer)))
+ (headline (coorgi--find-headline '(headline (:raw-value "MOO")) org-data)))
+ (when (equal (car (coorgi--find-property-drawer headline)) 'property-drawer) "PASS"))
#+end_src
+
+#+RESULTS:
+: PASS
+
* Copyright
#+begin_src emacs-lisp :noweb-ref copyright