diff options
| author | 2026-05-05 11:44:38 -0700 | |
|---|---|---|
| committer | 2026-05-05 11:44:38 -0700 | |
| commit | 1f1605f865adbc8b161512b09e86f004529f6fb3 (patch) | |
| tree | 398c5036e5d66cc757ddd3bf9c4c1f39181209ba | |
| parent | c8296b17ef24ba010b67bdbc6b9a9d970754d155 (diff) | |
| download | emacs-config-1f1605f865adbc8b161512b09e86f004529f6fb3.tar.gz emacs-config-1f1605f865adbc8b161512b09e86f004529f6fb3.zip | |
oni-magit: Add highlighter for Linear tickets
| -rw-r--r-- | oni-magit.el | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/oni-magit.el b/oni-magit.el index 9e34fcd..a0fc451 100644 --- a/oni-magit.el +++ b/oni-magit.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; Keywords: local -;; Version: 2026.0106.150051 +;; Version: 2026.0427.130949 ;; Package-Requires: (magit magit-popup oni-hydra) ;; This program is free software; you can redistribute it and/or modify @@ -70,5 +70,25 @@ _i_: Init ;;;###autoload (global-set-key (kbd "C-c v") '("Magit commands" . oni-hydra-magit/body)) +(defun oni-magit-highlight-linear-keywords () + "Highlight and link Linear links." + (while (re-search-forward (rx "[" (or "15U" "GOL" "OPT") "-" (minimal-match (one-or-more digit)) "]") nil t) + (let ((match-text (buffer-substring-no-properties + (1+ (match-beginning 0)) + (1- (match-end 0))))) + (put-text-property (match-beginning 0) + (match-end 0) + 'font-lock-face 'link) + (put-text-property (match-beginning 0) + (match-end 0) + 'local-map (let ((keymap (make-sparse-keymap))) + (define-key keymap (kbd "RET") + (lambda () + (interactive) + (browse-url (format "https://linear.app/goldcoin/issue/%s" match-text)))) + keymap))))) + +(add-hook 'forge-topic-wash-title-hook 'oni-magit-highlight-linear-keywords) + (provide 'oni-magit) ;;; oni-magit.el ends here |
