[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/pkg c9625d96b4: Fix &key parameters called without arguments (bu
From: |
Gerd Moellmann |
Subject: |
feature/pkg c9625d96b4: Fix &key parameters called without arguments (bug#58714) |
Date: |
Sun, 23 Oct 2022 04:16:38 -0400 (EDT) |
branch: feature/pkg
commit c9625d96b4e61cda7b79b4c0b23d6982f5bc45ae
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
Fix &key parameters called without arguments (bug#58714)
* lisp/emacs-lisp/cl-macs.el (cl--do-arglist): Check for missing
argument.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-&key-arguments): New test.
---
lisp/emacs-lisp/cl-macs.el | 2 ++
test/lisp/emacs-lisp/cl-macs-tests.el | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index beafee1d63..43a2ed9205 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -656,6 +656,8 @@ its argument list allows full Common Lisp conventions."
(check `(while ,var
(cond
((memq (car ,var) ',(append keys allow))
+ (unless (cdr ,var)
+ (error "Missing argument for %s" (car ,var)))
(setq ,var (cdr (cdr ,var))))
((car (cdr (memq (quote ,@allow) ,restarg)))
(setq ,var nil))
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el
b/test/lisp/emacs-lisp/cl-macs-tests.el
index f742637ee3..160ac59113 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -803,4 +803,10 @@ See Bug#57915."
(macroexpand form)
(should (string-empty-p messages))))))))
+(ert-deftest cl-&key-arguments ()
+ (cl-flet ((fn (&key x) x))
+ (should-error (fn :x))
+ (should (eq (fn :x :a) :a))))
+
+
;;; cl-macs-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/pkg c9625d96b4: Fix &key parameters called without arguments (bug#58714),
Gerd Moellmann <=