emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat e3926cfeae: compat-29: Add test for keymap-local


From: ELPA Syncer
Subject: [elpa] externals/compat e3926cfeae: compat-29: Add test for keymap-local-set
Date: Fri, 13 Jan 2023 07:57:36 -0500 (EST)

branch: externals/compat
commit e3926cfeaedc21fd5651c111e3fe49abab894901
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    compat-29: Add test for keymap-local-set
---
 compat-29.el    |  2 +-
 compat-tests.el | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/compat-29.el b/compat-29.el
index d44a5ec674..54ada6d5e5 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -638,7 +638,7 @@ that you make with this function.
 NOTE: The compatibility version is not a command."
   (keymap-set (current-global-map) key command))
 
-(compat-defun keymap-local-set (key command) ;; <UNTESTED>
+(compat-defun keymap-local-set (key command) ;; <OK>
   "Give KEY a local 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 3773e1da50..0a316500c3 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -546,6 +546,21 @@
           (should-equal (keymap-local-lookup "x" t) 'compat-default-command))
       (use-local-map orig))))
 
+(ert-deftest keymap-local-set ()
+  (let ((orig (current-local-map)))
+    (unwind-protect
+        (progn
+          (use-local-map (make-sparse-keymap))
+          (should-not (keymap-local-lookup "s-c"))
+          (should-not (keymap-local-lookup "x"))
+          (keymap-local-set "s-c" 'test)
+          (keymap-local-set "<t>" 'default)
+          (should-equal (keymap-local-lookup "s-c") 'test)
+          (should-equal (keymap-local-lookup "x" t) 'default)
+          (should-not (keymap-local-lookup "x")))
+      (use-local-map orig))
+    (should-not (keymap-local-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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]