From a9658cd5b07e88a5d413cbb4dfd8f9d9d0c8bbf5 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 13 Jan 2021 18:54:09 +0100 Subject: 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. --- test/lisp/subr-tests.el | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index e0826208b60..fc5a1eba6d8 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -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. -- cgit v1.2.1