about summary refs log tree commit diff
path: root/users/grfn/emacs.d
diff options
context:
space:
mode:
Diffstat (limited to 'users/grfn/emacs.d')
-rw-r--r--users/grfn/emacs.d/config.el36
-rw-r--r--users/grfn/emacs.d/org-query.el7
2 files changed, 22 insertions, 21 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)
diff --git a/users/grfn/emacs.d/org-query.el b/users/grfn/emacs.d/org-query.el
index 49e057da2aa9..e403c9e56fd3 100644
--- a/users/grfn/emacs.d/org-query.el
+++ b/users/grfn/emacs.d/org-query.el
@@ -117,9 +117,10 @@
 
 (defun grfn/org-clocked-in-jira-ticket-id ()
   (grfn/at-org-clocked-in-item
-   (org-tracker-backend/extract-issue-id
-    (org-tracker-current-backend)
-    (cadr (org-element-at-point)))))
+   (when (org-tracker-current-backend t)
+     (org-tracker-backend/extract-issue-id
+      (org-tracker-current-backend)
+      (cadr (org-element-at-point))))))
 
 (comment
  (grfn/at-org-clocked-in-item