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.
This commit is contained in:
Gerd Möllmann 2022-10-23 10:14:10 +02:00 committed by Stefan Kangas
parent c64d94c849
commit 6d9065b748
2 changed files with 8 additions and 0 deletions

View file

@ -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))