Convert diff-mode.el from easy-mmode-defmap to define-keymap
* lisp/vc/diff-mode.el (diff-mode-shared-map, diff-mode-map) (diff-minor-mode-map): Convert from easy-mmode-defmap to defvar-keymap.
This commit is contained in:
parent
2ae3b66fa8
commit
9efa67f764
1 changed files with 51 additions and 53 deletions
|
@ -162,57 +162,55 @@ and hunk-based syntax highlighting otherwise as a fallback."
|
|||
;;;; keymap, menu, ...
|
||||
;;;;
|
||||
|
||||
(easy-mmode-defmap diff-mode-shared-map
|
||||
'(("n" . diff-hunk-next)
|
||||
("N" . diff-file-next)
|
||||
("p" . diff-hunk-prev)
|
||||
("P" . diff-file-prev)
|
||||
("\t" . diff-hunk-next)
|
||||
([backtab] . diff-hunk-prev)
|
||||
("k" . diff-hunk-kill)
|
||||
("K" . diff-file-kill)
|
||||
("}" . diff-file-next) ; From compilation-minor-mode.
|
||||
("{" . diff-file-prev)
|
||||
("\C-m" . diff-goto-source)
|
||||
([mouse-2] . diff-goto-source)
|
||||
("W" . widen)
|
||||
("o" . diff-goto-source) ; other-window
|
||||
("A" . diff-ediff-patch)
|
||||
("r" . diff-restrict-view)
|
||||
("R" . diff-reverse-direction)
|
||||
([remap undo] . diff-undo))
|
||||
"Basic keymap for `diff-mode', bound to various prefix keys."
|
||||
:inherit special-mode-map)
|
||||
(defvar-keymap diff-mode-shared-map
|
||||
:inherit special-mode-map
|
||||
"n" #'diff-hunk-next
|
||||
"N" #'diff-file-next
|
||||
"p" #'diff-hunk-prev
|
||||
"P" #'diff-file-prev
|
||||
["TAB"] #'diff-hunk-next
|
||||
[backtab] #'diff-hunk-prev
|
||||
"k" #'diff-hunk-kill
|
||||
"K" #'diff-file-kill
|
||||
"}" #'diff-file-next ; From compilation-minor-mode.
|
||||
"{" #'diff-file-prev
|
||||
["RET"] #'diff-goto-source
|
||||
[mouse-2] #'diff-goto-source
|
||||
"W" #'widen
|
||||
"o" #'diff-goto-source ; other-window
|
||||
"A" #'diff-ediff-patch
|
||||
"r" #'diff-restrict-view
|
||||
"R" #'diff-reverse-direction
|
||||
[remap undo] #'diff-undo)
|
||||
|
||||
(easy-mmode-defmap diff-mode-map
|
||||
`(("\e" . ,(let ((map (make-sparse-keymap)))
|
||||
;; We want to inherit most bindings from diff-mode-shared-map,
|
||||
;; but not all since they may hide useful M-<foo> global
|
||||
;; bindings when editing.
|
||||
(set-keymap-parent map diff-mode-shared-map)
|
||||
(dolist (key '("A" "r" "R" "g" "q" "W" "z"))
|
||||
(define-key map key nil))
|
||||
map))
|
||||
;; From compilation-minor-mode.
|
||||
("\C-c\C-c" . diff-goto-source)
|
||||
;; By analogy with the global C-x 4 a binding.
|
||||
("\C-x4A" . diff-add-change-log-entries-other-window)
|
||||
;; Misc operations.
|
||||
("\C-c\C-a" . diff-apply-hunk)
|
||||
("\C-c\C-e" . diff-ediff-patch)
|
||||
("\C-c\C-n" . diff-restrict-view)
|
||||
("\C-c\C-s" . diff-split-hunk)
|
||||
("\C-c\C-t" . diff-test-hunk)
|
||||
("\C-c\C-r" . diff-reverse-direction)
|
||||
("\C-c\C-u" . diff-context->unified)
|
||||
;; `d' because it duplicates the context :-( --Stef
|
||||
("\C-c\C-d" . diff-unified->context)
|
||||
("\C-c\C-w" . diff-ignore-whitespace-hunk)
|
||||
;; `l' because it "refreshes" the hunk like C-l refreshes the screen
|
||||
("\C-c\C-l" . diff-refresh-hunk)
|
||||
("\C-c\C-b" . diff-refine-hunk) ;No reason for `b' :-(
|
||||
("\C-c\C-f" . next-error-follow-minor-mode))
|
||||
"Keymap for `diff-mode'. See also `diff-mode-shared-map'.")
|
||||
(defvar-keymap diff-mode-map
|
||||
:doc "Keymap for `diff-mode'. See also `diff-mode-shared-map'."
|
||||
["ESC"] (let ((map (define-keymap :parent diff-mode-shared-map)))
|
||||
;; We want to inherit most bindings from
|
||||
;; `diff-mode-shared-map', but not all since they may hide
|
||||
;; useful `M-<foo>' global bindings when editing.
|
||||
(dolist (key '("A" "r" "R" "g" "q" "W" "z"))
|
||||
(define-key map key nil))
|
||||
map)
|
||||
;; From compilation-minor-mode.
|
||||
["C-c C-c"] #'diff-goto-source
|
||||
;; By analogy with the global C-x 4 a binding.
|
||||
["C-x 4 A"] #'diff-add-change-log-entries-other-window
|
||||
;; Misc operations.
|
||||
["C-c C-a"] #'diff-apply-hunk
|
||||
["C-c C-e"] #'diff-ediff-patch
|
||||
["C-c C-n"] #'diff-restrict-view
|
||||
["C-c C-s"] #'diff-split-hunk
|
||||
["C-c C-t"] #'diff-test-hunk
|
||||
["C-c C-r"] #'diff-reverse-direction
|
||||
["C-c C-u"] #'diff-context->unified
|
||||
;; `d' because it duplicates the context :-( --Stef
|
||||
["C-c C-d"] #'diff-unified->context
|
||||
["C-c C-w"] #'diff-ignore-whitespace-hunk
|
||||
;; `l' because it "refreshes" the hunk like C-l refreshes the screen
|
||||
["C-c C-l"] #'diff-refresh-hunk
|
||||
["C-c C-b"] #'diff-refine-hunk ;No reason for `b' :-(
|
||||
["C-c C-f"] #'next-error-follow-minor-mode)
|
||||
|
||||
(easy-menu-define diff-mode-menu diff-mode-map
|
||||
"Menu for `diff-mode'."
|
||||
|
@ -269,9 +267,9 @@ and hunk-based syntax highlighting otherwise as a fallback."
|
|||
"Prefix key for `diff-minor-mode' commands."
|
||||
:type '(choice (string "\e") (string "C-c=") string))
|
||||
|
||||
(easy-mmode-defmap diff-minor-mode-map
|
||||
`((,diff-minor-mode-prefix . ,diff-mode-shared-map))
|
||||
"Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'.")
|
||||
(defvar-keymap diff-minor-mode-map
|
||||
:doc "Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'."
|
||||
diff-minor-mode-prefix diff-mode-shared-map)
|
||||
|
||||
(define-minor-mode diff-auto-refine-mode
|
||||
"Toggle automatic diff hunk finer highlighting (Diff Auto Refine mode).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue