1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Prefer command remapping in ses.el

* lisp/ses.el (ses-mode-print-map): Use command remapping instead of
substitute-key-definition.
This commit is contained in:
Stefan Kangas 2021-12-16 03:14:31 +01:00
parent 2893cb6a21
commit ab33404c65

View 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))