fix(grfn/emacs): Don't fail on non-tracker clocked-in task
Change-Id: I171e06f67abec2ccc60ec0ff444d7d5b0378485d Reviewed-on: https://cl.tvl.fyi/c/depot/+/5436 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
119155c727
commit
aa389c8cc1
2 changed files with 22 additions and 21 deletions
|
@ -476,7 +476,6 @@
|
|||
|
||||
(defun grfn/add-jira-reference-to-commit-message ()
|
||||
(interactive)
|
||||
(when (org-tracker-current-backend t)
|
||||
(when-let* ((jira-id (grfn/org-clocked-in-jira-ticket-id)))
|
||||
(save-excursion
|
||||
(save-match-data
|
||||
|
@ -490,7 +489,7 @@
|
|||
(and
|
||||
(search-forward-regexp (rx line-start "# Please enter") nil t)
|
||||
(forward-line -2)))
|
||||
(insert (format "\nRefs: %s" jira-id))))))))
|
||||
(insert (format "\nRefs: %s" jira-id)))))))
|
||||
|
||||
(defun grfn/switch-jira-refs-fixes ()
|
||||
(interactive)
|
||||
|
@ -580,11 +579,12 @@
|
|||
["c"]
|
||||
(list "M" "Rename branch to Tracker ticket" #'magit-rename-org-tracker-branch))
|
||||
|
||||
(add-hook 'git-commit-setup-hook #'grfn/add-jira-reference-to-commit-message)
|
||||
(map! (:map git-commit-mode-map
|
||||
"C-c C-f" #'grfn/switch-jira-refs-fixes))
|
||||
)
|
||||
|
||||
(add-hook 'git-commit-setup-hook #'grfn/add-jira-reference-to-commit-message)
|
||||
(map! (:map git-commit-mode-map
|
||||
"C-c C-f" #'grfn/switch-jira-refs-fixes))
|
||||
|
||||
;; (defun grfn/split-window-more-sensibly (&optional window)
|
||||
;; (let ((window (or window (selected-window))))
|
||||
;; (or (and (window-splittable-p window)
|
||||
|
|
|
@ -117,9 +117,10 @@
|
|||
|
||||
(defun grfn/org-clocked-in-jira-ticket-id ()
|
||||
(grfn/at-org-clocked-in-item
|
||||
(when (org-tracker-current-backend t)
|
||||
(org-tracker-backend/extract-issue-id
|
||||
(org-tracker-current-backend)
|
||||
(cadr (org-element-at-point)))))
|
||||
(cadr (org-element-at-point))))))
|
||||
|
||||
(comment
|
||||
(grfn/at-org-clocked-in-item
|
||||
|
|
Loading…
Reference in a new issue