about summary refs log tree commit diff
path: root/users/grfn/emacs.d/org-query.el
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2023-11-06T15·40-0500
committerclbot <clbot@tvl.fyi>2023-11-06T15·46+0000
commitf3dea2ffbc4255c64d01a80e2668b2060b676e9e (patch)
tree77d5f9c54ec3e822aec6d50752f7575a95fc52d7 /users/grfn/emacs.d/org-query.el
parent81047cfcd7e527722a32dc7987cfb0e288ddd1eb (diff)
fix(grfn/emacs): Fix clocked-in-ticket-id for linear tickets r/6965
Change-Id: Id0e8883c1b621afb99edde3d256cccd057e89097
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9972
Autosubmit: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'users/grfn/emacs.d/org-query.el')
-rw-r--r--users/grfn/emacs.d/org-query.el20
1 files changed, 16 insertions, 4 deletions
diff --git a/users/grfn/emacs.d/org-query.el b/users/grfn/emacs.d/org-query.el
index e403c9e56fd3..9d3b3358a9d3 100644
--- a/users/grfn/emacs.d/org-query.el
+++ b/users/grfn/emacs.d/org-query.el
@@ -115,11 +115,22 @@
  (grfn/org-current-clocked-in-task-message)
  )
 
-(defun grfn/org-clocked-in-jira-ticket-id ()
+(cl-defgeneric grfn/org-tracker-ticket-id-label (backend elt)
+  (org-tracker-backend/extract-issue-id backend elt))
+(cl-defmethod grfn/org-tracker-ticket-id-label
+  ((backend org-tracker-linear-backend) elt)
+  (when-let* ((link (plist-get elt :LINEAR-KEY)))
+    (string-match
+     (rx "[[" (one-or-more anything) "]"
+         "[" (group (one-or-more anything)) "]]")
+     link)
+    (match-string 1 link)))
+
+(defun grfn/org-clocked-in-ticket-id ()
   (grfn/at-org-clocked-in-item
-   (when (org-tracker-current-backend t)
-     (org-tracker-backend/extract-issue-id
-      (org-tracker-current-backend)
+   (when-let* ((backend (org-tracker-current-backend t)))
+     (grfn/org-tracker-ticket-id-label
+      backend
       (cadr (org-element-at-point))))))
 
 (comment
@@ -128,4 +139,5 @@
    (org-tracker-current-backend)
    (cadr (org-element-at-point))))
 
+ (grfn/org-clocked-in-ticket-id)
  )