summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-01-08 15:16:02 +0100
committerStefan Kangas <stefan@marxist.se>2021-01-08 15:16:02 +0100
commit5ac7b480757d8731fe2bda0452e48f0cd0356aa4 (patch)
tree5c4ad470ed58fc1fcfc51182de6617bf18eff341 /test/lisp
parentf5cfe5a0a9c64f001f1cec3f78b811a3b6e69b09 (diff)
downloademacs-5ac7b480757d8731fe2bda0452e48f0cd0356aa4.tar.gz
Lift define-prefix-command to Lisp
* lisp/subr.el (define-prefix-command): New defun. * src/keymap.c (Fdefine_prefix_command): Remove DEFUN. (syms_of_keymap): Remove defsubr for Fdefine_prefix_command. * test/lisp/subr-tests.el (subr-test-define-prefix-command): New test.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/subr-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 54f6eb4b2a1..83031c44fcd 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -70,6 +70,17 @@
(should (equal (kbd "RET") "\C-m"))
(should (equal (kbd "C-x a") "\C-xa")))
+(ert-deftest subr-test-define-prefix-command ()
+ (define-prefix-command 'foo-prefix-map)
+ (should (keymapp foo-prefix-map))
+ (should (fboundp #'foo-prefix-map))
+ ;; With optional argument.
+ (define-prefix-command 'bar-prefix 'bar-prefix-map)
+ (should (keymapp bar-prefix-map))
+ (should (fboundp #'bar-prefix))
+ ;; Returns the symbol.
+ (should (eq (define-prefix-command 'foo-bar) 'foo-bar)))
+
;;;; Mode hooks.