diff options
author | Griffin Smith <grfn@gws.fyi> | 2022-04-06T14·21-0400 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-04-06T14·28+0000 |
commit | aa389c8cc197dacfb2da2a9f00ac0ae98c996a58 (patch) | |
tree | 4334115e6ac3649bac9ffd092ef502161cb958a7 /users/grfn/emacs.d/config.el | |
parent | 119155c7277e79ea2fdd41d9b0b50b725e0395f2 (diff) |
fix(grfn/emacs): Don't fail on non-tracker clocked-in task r/3933
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
Diffstat (limited to 'users/grfn/emacs.d/config.el')
-rw-r--r-- | users/grfn/emacs.d/config.el | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/users/grfn/emacs.d/config.el b/users/grfn/emacs.d/config.el index 2fdcb7c9305b..9ddfe07afb95 100644 --- a/users/grfn/emacs.d/config.el +++ b/users/grfn/emacs.d/config.el @@ -476,21 +476,20 @@ (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 - (goto-char (point-min)) - ;; Don't add one if we've already got one - (unless (search-forward-regexp grfn/jira-refs-re nil t) - (or - (and - (search-forward-regexp (rx line-start "Change-Id:") nil t) - (forward-line -1)) - (and - (search-forward-regexp (rx line-start "# Please enter") nil t) - (forward-line -2))) - (insert (format "\nRefs: %s" jira-id)))))))) + (when-let* ((jira-id (grfn/org-clocked-in-jira-ticket-id))) + (save-excursion + (save-match-data + (goto-char (point-min)) + ;; Don't add one if we've already got one + (unless (search-forward-regexp grfn/jira-refs-re nil t) + (or + (and + (search-forward-regexp (rx line-start "Change-Id:") nil t) + (forward-line -1)) + (and + (search-forward-regexp (rx line-start "# Please enter") nil t) + (forward-line -2))) + (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) |