Function: bytecomp--check-keyword-args
bytecomp--check-keyword-args is a byte-compiled function defined in
bytecomp.el.gz.
Signature
(bytecomp--check-keyword-args FORM ARGLIST ALLOWED-KEYS REQUIRED-KEYS)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun bytecomp--check-keyword-args (form arglist allowed-keys required-keys)
(let ((fun (car form)))
(cl-flet ((missing (form keyword)
(byte-compile-warn-x
form
"`%S´ called without required keyword argument %S"
fun keyword))
(unrecognized (form keyword)
(byte-compile-warn-x
form
"`%S´ called with unknown keyword argument %S"
fun keyword))
(duplicate (form keyword)
(byte-compile-warn-x
form
"`%S´ called with repeated keyword argument %S"
fun keyword))
(missing-val (form keyword)
(byte-compile-warn-x
form
"missing value for keyword argument %S"
keyword)))
(let* ((seen '())
(l arglist))
(while (consp l)
(let ((key (car l)))
(cond ((and (keywordp key) (memq key allowed-keys))
(cond ((memq key seen)
(duplicate l key))
(t
(push key seen))))
(t (unrecognized l key)))
(when (null (cdr l))
(missing-val l key)))
(setq l (cddr l)))
(dolist (key required-keys)
(unless (memq key seen)
(missing form key))))))
form)