branch: elpa/casual
commit c7bfcf32129385899f1218011c96bb62a018b9e9
Merge: 483600a941 bd0505f5ce
Author: Charles Choi <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #391 from 
kickingvegas/386-support-item-description-in-casual-org
    
    Support Casual Org item description
---
 lisp/casual-org-utils.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lisp/casual-org-utils.el b/lisp/casual-org-utils.el
index a9a1bb5f11..e8d18e6c5e 100644
--- a/lisp/casual-org-utils.el
+++ b/lisp/casual-org-utils.el
@@ -223,14 +223,15 @@ which is done with `org-ctrl-c-ctrl-c'."
 
 (defun casual-org--item-description ()
   "Description string for Org item."
-  ;; TODO: Figure out how to item content.
-  ;; (buffer-substring-no-properties
-  ;;  (org-element-contents-begin (org-element-context))
-  ;;  (org-element-contents-end (org-element-context)))
-  (let ((heading (org-get-heading t nil t t)))
-    (if heading
-        (format "Org List: %s" (substring-no-properties heading))
-      (format "Org List: %s" (buffer-name)))))
+  (let* ((context (org-element-context))
+         (start (org-element-contents-begin context))
+         (end (org-element-contents-end context))
+         (buf (if (and start end)
+                  (buffer-substring-no-properties start end)
+                nil)))
+    (if buf
+        (format "Org Item: %s"(nth 0 (string-split buf "\n")))
+      "Org Item")))
 
 
 ;; -------------------------------------------------------------------

Reply via email to