]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer command remapping in ses.el
authorStefan Kangas <stefan@marxist.se>
Thu, 16 Dec 2021 02:14:31 +0000 (03:14 +0100)
committerStefan Kangas <stefan@marxist.se>
Thu, 16 Dec 2021 02:14:31 +0000 (03:14 +0100)
* lisp/ses.el (ses-mode-print-map): Use command remapping instead of
substitute-key-definition.

lisp/ses.el

index 5e2d254881bfeb7c0243009ea6f1e131a15a42eb..8496aeec8e8a0dede6dfea2a45d640d1b6a0c283 100644 (file)
@@ -227,12 +227,6 @@ Used for listing local printers or renamed cells.")
                "w"       ses-set-column-width
                "x"       ses-export-keymap
                "\M-p"    ses-read-column-printer))
-       (repl '(;;We'll replace these wherever they appear in the keymap
-               clipboard-kill-region ses-kill-override
-               end-of-line           ses-end-of-line
-               kill-line             ses-delete-row
-               kill-region           ses-kill-override
-               open-line             ses-insert-row))
        (numeric "0123456789.-")
        (newmap (make-keymap)))
     ;;Get rid of printables
@@ -240,13 +234,11 @@ Used for listing local printers or renamed cells.")
     ;;These keys insert themselves as the beginning of a numeric value
     (dotimes (x (length numeric))
       (define-key newmap (substring numeric x (1+ x)) 'ses-read-cell))
-    ;;Override these global functions wherever they're bound
-    (while repl
-      (substitute-key-definition (car repl) (cadr repl) newmap
-                                (current-global-map))
-      (setq repl (cddr repl)))
-    ;;Apparently substitute-key-definition doesn't catch this?
-    (define-key newmap [(menu-bar) edit cut] 'ses-kill-override)
+    (define-key newmap [remap clipboard-kill-region] #'ses-kill-override)
+    (define-key newmap [remap end-of-line]           #'ses-end-of-line)
+    (define-key newmap [remap kill-line]             #'ses-delete-row)
+    (define-key newmap [remap kill-region]           #'ses-kill-override)
+    (define-key newmap [remap open-line]             #'ses-insert-row)
     ;;Define our other local keys
     (while keys
       (define-key newmap (car keys) (cadr keys))