From: Stefan Kangas Date: Thu, 16 Dec 2021 02:14:31 +0000 (+0100) Subject: Prefer command remapping in ses.el X-Git-Tag: emacs-29.0.90~3592^2~9 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ab33404c65a5bcafa1a1de4816cd5f5b778a9d70;p=emacs.git Prefer command remapping in ses.el * lisp/ses.el (ses-mode-print-map): Use command remapping instead of substitute-key-definition. --- diff --git a/lisp/ses.el b/lisp/ses.el index 5e2d254881b..8496aeec8e8 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -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))