]> git.eshelyaron.com Git - emacs.git/commitdiff
diff-mode-shared-map: Don't inherit from special-mode-map
authorSean Whitton <spwhitton@spwhitton.name>
Mon, 12 May 2025 09:11:18 +0000 (10:11 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 12 May 2025 19:55:43 +0000 (21:55 +0200)
* lisp/vc/diff-mode.el (diff-mode-shared-map): No longer inherit
from special-mode-map.
(diff-mode-map): Tidy up list of unbindings now that we no
longer need to override any bindings from special-mode-map.
(minor-mode-map-alist): <diff-mode-read-only>: Ensure that the
minor mode keymap continues to inherit from special-mode-map by
calling make-composed-keymap here.

Co-authored-by: Stefan Monnier <monnier@iro.umontreal.ca>
(cherry picked from commit 4ddafede8d7bebdaa795279cc4c527e5fe425add)

lisp/vc/diff-mode.el

index e0579331fa03eabd060ccb785046129685b33001..08ca9f26d1eb5636c0a3bd40a551511abb2a209c 100644 (file)
@@ -180,7 +180,6 @@ The default \"-b\" means to ignore whitespace-only changes,
 ;;;;
 
 (defvar-keymap diff-mode-shared-map
-  :parent special-mode-map
   "n" #'diff-hunk-next
   "N" #'diff-file-next
   "p" #'diff-hunk-prev
@@ -206,8 +205,7 @@ The default \"-b\" means to ignore whitespace-only changes,
           ;; 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" "w" "z" "?"
-                         "SPC" "S-SPC" "DEL"))
+          (dolist (key '("A" "r" "R" "W" "w"))
             (keymap-set map key nil))
           map)
   ;; From compilation-minor-mode.
@@ -1598,7 +1596,9 @@ else cover the whole buffer."
 ;; It should be lower than `outline-minor-mode' and `view-mode'.
 (or (assq 'diff-mode-read-only minor-mode-map-alist)
     (nconc minor-mode-map-alist
-           (list (cons 'diff-mode-read-only diff-mode-shared-map))))
+           (list (cons 'diff-mode-read-only
+                       (make-composed-keymap diff-mode-shared-map
+                                             special-mode-map)))))
 
 (defvar whitespace-style)
 (defvar whitespace-trailing-regexp)