From 2fa1b97db098c04810763e742e956c63b9527989 Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Sun, 20 Apr 2014 18:03:39 -0700 Subject: [PATCH] Fix cl-loop destructuring under `with' clause --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/cl-macs.el | 2 +- test/ChangeLog | 4 ++++ test/automated/cl-lib.el | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 28b9c79079e..cb91bbcb4d9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-04-21 Daniel Colascione + + * emacs-lisp/cl-macs.el: + (cl--loop-let): Properly destructure `while' clauses. + 2014-04-20 Daniel Colascione * vc/vc.el (vc-root-dir): New public autoloaded function for diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 5fc8c9f9a42..5b9e17af23a 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -1550,7 +1550,7 @@ If BODY is `setq', then use SPECS for assignments rather than for bindings." (if (and (cl--unused-var-p temp) (null expr)) nil ;; Don't bother declaring/setting `temp' since it won't ;; be used when `expr' is nil, anyway. - (when (and (eq body 'setq) (cl--unused-var-p temp)) + (when (cl--unused-var-p temp) ;; Prefer a fresh uninterned symbol over "_to", to avoid ;; warnings that we set an unused variable. (setq temp (make-symbol "--cl-var--")) diff --git a/test/ChangeLog b/test/ChangeLog index 940ed0b0b91..2e6e1aefeb1 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2014-04-21 Daniel Colascione + + * automated/cl-lib.el (cl-loop-destructuring-with): New test. + 2014-04-20 Daniel Colascione * automated/cl-lib.el (cl-lib-struct-accessors,cl-the): New tests. diff --git a/test/automated/cl-lib.el b/test/automated/cl-lib.el index a0df07e54ea..2c73c82ba98 100644 --- a/test/automated/cl-lib.el +++ b/test/automated/cl-lib.el @@ -220,4 +220,7 @@ (should (= (the integer (incf sideffect)) 1)) (should (= sideffect 1)))) +(ert-deftest cl-loop-destructuring-with () + (should (equal (cl-loop with (a b c) = '(1 2 3) return (+ a b c)) 6))) + ;;; cl-lib.el ends here -- 2.39.5