diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-13 16:11:17 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-13 16:11:17 +0100 |
| commit | fa70e72f92985aeb99473d03770bd0404afcae5f (patch) | |
| tree | c960b2e28f02dce609a9b37e53619b360414d49e | |
| parent | e3926cfeaedc21fd5651c111e3fe49abab894901 (diff) | |
compat-29: Add test for keymap-global-set
| -rw-r--r-- | compat-29.el | 2 | ||||
| -rw-r--r-- | compat-tests.el | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/compat-29.el b/compat-29.el index 54ada6d..9d18f3a 100644 --- a/compat-29.el +++ b/compat-29.el @@ -624,7 +624,7 @@ parent keymap to be used." (keymap--check key) (compat--define-key keymap (key-parse key) nil remove)) -(compat-defun keymap-global-set (key command) ;; <UNTESTED> +(compat-defun keymap-global-set (key command) ;; <OK> "Give KEY a global binding as COMMAND. COMMAND is the command definition to use; usually it is a symbol naming an interactively-callable function. diff --git a/compat-tests.el b/compat-tests.el index 0a31650..e6f1aa8 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -561,6 +561,21 @@ (use-local-map orig)) (should-not (keymap-local-lookup "s-c")))) +(ert-deftest keymap-global-set () + (let ((orig (current-global-map))) + (unwind-protect + (progn + (use-global-map (make-sparse-keymap)) + (should-not (keymap-global-lookup "s-c")) + (should-not (keymap-global-lookup "x")) + (keymap-global-set "s-c" 'test) + (keymap-global-set "<t>" 'default) + (should-equal (keymap-global-lookup "s-c") 'test) + (should-equal (keymap-global-lookup "x" t) 'default) + (should-not (keymap-global-lookup "x"))) + (use-global-map orig)) + (should-not (keymap-global-lookup "s-c")))) + (ert-deftest keymap-global-lookup () (should-equal (keymap-global-lookup "C-x b") #'switch-to-buffer) (should-equal (keymap-global-lookup "C-x C-f") #'find-file) |
