|
5 | 5 | ;; Author: Adam Porter <adam@alphapapa.net> |
6 | 6 | ;; URL: http://github.com/alphapapa/magit-todos |
7 | 7 | ;; Version: 1.6-pre |
8 | | -;; Package-Requires: ((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0")) |
| 8 | +;; Package-Requires: ((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0") (transient "0.2.0")) |
9 | 9 | ;; Keywords: magit, vc |
10 | 10 |
|
11 | 11 | ;;; Commentary: |
|
73 | 73 | (require 'f) |
74 | 74 | (require 'hl-todo) |
75 | 75 | (require 'magit) |
| 76 | +(require 'transient) |
76 | 77 | (require 'pcre2el) |
77 | 78 | (require 's) |
78 | 79 |
|
@@ -117,11 +118,6 @@ This should be set automatically by customizing |
117 | 118 | Used to avoid running multiple simultaneous scans for a |
118 | 119 | magit-status buffer.") |
119 | 120 |
|
120 | | -;; FIXME: Jumping binds. In `magit-status-mode-map' now, "j" is bound |
121 | | -;; to `magit-status-jump', which is a Transient command; it's no |
122 | | -;; longer bound to a prefix map. There doesn't seem to be a way to |
123 | | -;; add binds to that Transient command's body. |
124 | | - |
125 | 121 | (defvar magit-todos-section-map |
126 | 122 | (let ((map (make-sparse-keymap))) |
127 | 123 | (define-key map "jT" #'magit-todos-jump-to-todos) |
@@ -373,18 +369,16 @@ from the \"topic2\" branch, this option could be set to |
373 | 369 | :global t |
374 | 370 | (if magit-todos-mode |
375 | 371 | (progn |
376 | | - (pcase (lookup-key magit-status-mode-map "jT") |
377 | | - ('nil (define-key magit-status-mode-map "jT" #'magit-todos-jump-to-todos)) |
378 | | - ('magit-todos-jump-to-todos nil) |
379 | | - (_ (message "magit-todos: Not overriding bind of \"jT\" in `magit-status-mode-map'."))) |
| 372 | + (transient-append-suffix #'magit-status-jump |
| 373 | + '(0 -1) '[("T" "Todos" magit-todos-jump-to-todos) |
| 374 | + ("l" "List todos" magit-todos-list)]) |
380 | 375 | (magit-add-section-hook 'magit-status-sections-hook |
381 | 376 | #'magit-todos--insert-todos |
382 | 377 | nil |
383 | 378 | 'append) |
384 | 379 | (add-hook 'magit-status-mode-hook #'magit-todos--add-to-status-buffer-kill-hook 'append)) |
385 | 380 | ;; Disable mode |
386 | | - (when (equal (lookup-key magit-status-mode-map "jT") #'magit-todos-jump-to-todos) |
387 | | - (define-key magit-status-mode-map "jT" nil)) |
| 381 | + (transient-remove-suffix #'magit-status-jump '(0 -1)) |
388 | 382 | (remove-hook 'magit-status-sections-hook #'magit-todos--insert-todos) |
389 | 383 | (remove-hook 'magit-status-mode-hook #'magit-todos--add-to-status-buffer-kill-hook))) |
390 | 384 |
|
|
0 commit comments