From c6b0fbe7dba2ed10fa390a8772a2c2b5d6485b2a Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Sat, 22 Mar 2014 22:50:24 -0700 Subject: [PATCH] Fix cl-defun keyword arg parsing. Please bootstrap. --- lisp/ChangeLog | 7 +++++++ lisp/emacs-lisp/cl-macs.el | 3 ++- test/ChangeLog | 5 +++++ test/automated/cl-lib.el | 6 ++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3e49f70f0b2..78229507684 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-03-23 Daniel Colascione + + * emacs-lisp/cl-macs.el (cl--do-arglist): Use a little `cl-loop' + list to look for keyword arguments instead of `memq', fixing + (Bug#3647) --- unfortunately, only for freshly-compiled code. + Please make bootstrap. + 2014-03-22 Glenn Morris * dired.el (dired-read-regexp): Make obsolete. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index b1861cf7dfa..ae939c9c0e9 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -503,7 +503,8 @@ its argument list allows full Common Lisp conventions." (varg (if (consp (car arg)) (cl-cadar arg) (car arg))) (def (if (cdr arg) (cadr arg) (or (car cl--bind-defs) (cadr (assq varg cl--bind-defs))))) - (look `(memq ',karg ,restarg))) + (look `(cl-loop for cl--arg on ,restarg by #'cddr + when (eq (car cl--arg) ',karg) return cl--arg))) (and def cl--bind-enquote (setq def `',def)) (if (cddr arg) (let* ((temp (or (nth 2 arg) (make-symbol "--cl-var--"))) diff --git a/test/ChangeLog b/test/ChangeLog index c87022cd948..183fb409f1f 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2014-03-23 Daniel Colascione + + * automated/cl-lib.el (cl-lib-keyword-names-versus-values): New + test: correct parsing of keyword arguments. + 2014-03-07 Michael Albinus * automated/tramp-tests.el (tramp-copy-size-limit): Declare. diff --git a/test/automated/cl-lib.el b/test/automated/cl-lib.el index 8b6ed6d6634..f7f4314e1cb 100644 --- a/test/automated/cl-lib.el +++ b/test/automated/cl-lib.el @@ -195,4 +195,10 @@ (should (eql (cl-mismatch "Aa" "aA") 0)) (should (eql (cl-mismatch '(a b c) '(a b d)) 2))) +(ert-deftest cl-lib-keyword-names-versus-values () + (should (equal + (funcall (cl-function (lambda (&key a b) (list a b))) + :b :a :a 42) + '(42 :a)))) + ;;; cl-lib.el ends here -- 2.39.5