John Kitchin <
jkit...@andrew.cmu.edu> writes:
> I have figured out most of it by looking at other extensions, but there
> have been a few points that still aren't clear, mostly related to
> keymaps, menu items, etc.. that I thought there might be some
> documentation somewhere on.
Some information on sections and their keymaps is here:
https://magit.vc/manual/magit/Creating-Sections.html#Creating-Sections
The main point is that a section type can be associated with a keymap,
magit-TYPE-section-map.
> Also, how to hook into pressing return to magit-visit-thing, or k to
> magit-delete-thing, etc.
If you have your own section type, you can remap magit-visit-thing and
magit-delete-thing in the keymap. For example, here's the key map for
the "unstaged" section type:
(defvar magit-unstaged-section-map
(let ((map (make-sparse-keymap)))
(define-key map [remap magit-visit-thing] 'magit-diff-unstaged)
(define-key map [remap magit-delete-thing] 'magit-discard)
(define-key map "s" 'magit-stage)
(define-key map "u" 'magit-unstage)
map)
"Keymap for the `unstaged' section.")
--
Kyle