about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-03-18T19·17-0400
committerGriffin Smith <root@gws.fyi>2020-03-18T19·18-0400
commit24c36b781b09ee20dfb34f84c91f7ac736de7d66 (patch)
tree7dfb8feb6a47020a8faf91363e9eeba68a31e215
parentc033b9161c4d2d30418094e15ce067de09f736bb (diff)
Add org-clubhouse-clocked-in-story-id
Add an org-clubhouse-clocked-in-story-id function, for programmatically
querying the currently clocked-in clubhouse story ID
-rw-r--r--org-clubhouse.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/org-clubhouse.el b/org-clubhouse.el
index 07c3220998c0..81aab9ad3fc3 100644
--- a/org-clubhouse.el
+++ b/org-clubhouse.el
@@ -258,6 +258,23 @@ If set to nil, will never create stories with labels")
   (org-element-extract-clubhouse-id
    (org-element-find-headline)))
 
+(defun org-clubhouse-clocked-in-story-id ()
+  "Return the clubhouse story-id of the currently clocked-in org entry, if any."
+  (save-mark-and-excursion
+    (save-current-buffer
+      (when (org-clocking-p)
+        (set-buffer (marker-buffer org-clock-marker))
+        (save-restriction
+          (when (or (< org-clock-marker (point-min))
+                    (> org-clock-marker (point-max)))
+            (widen))
+          (goto-char org-clock-marker)
+          (org-element-clubhouse-id))))))
+
+(comment
+ (org-clubhouse-clocked-in-story-id)
+ )
+
 (defun org-element-and-children-at-point ()
   (let* ((elt (org-element-find-headline))
          (contents-begin (or (plist-get elt :contents-begin)