1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 03:20:39 -08:00

Lift {global,local}-key-binding to Lisp

* lisp/subr.el (local-key-binding, global-key-binding): New defuns.
* src/keymap.c (Flocal_key_binding, Fglobal_key_binding): Remove DEFUNs.
(syms_of_keymap): Remove defsubrs for above DEFUNs.
* test/lisp/subr-tests.el (subr-test-local-key-binding)
(subr-test-global-key-binding): New tests.
This commit is contained in:
Stefan Kangas 2021-01-13 18:54:09 +01:00
parent be9b7e83bc
commit a9658cd5b0
3 changed files with 35 additions and 35 deletions

View file

@ -87,6 +87,17 @@
;; Returns the symbol.
(should (eq (define-prefix-command 'foo-bar) 'foo-bar)))
(ert-deftest subr-test-local-key-binding ()
(with-temp-buffer
(emacs-lisp-mode)
(should (keymapp (local-key-binding [menu-bar])))
(should-not (local-key-binding [f12]))))
(ert-deftest subr-test-global-key-binding ()
(should (eq (global-key-binding [f1]) 'help-command))
(should (eq (global-key-binding "x") 'self-insert-command))
(should-not (global-key-binding [f12])))
;;;; Mode hooks.