From 24c36b781b09ee20dfb34f84c91f7ac736de7d66 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 18 Mar 2020 15:17:47 -0400 Subject: [PATCH] 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 --- org-clubhouse.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/org-clubhouse.el b/org-clubhouse.el index 07c322099..81aab9ad3 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)