Fix cl-loop destructuring under `with' clause
authorDaniel Colascione <dancol@dancol.org>
Mon, 21 Apr 2014 01:03:39 +0000 (18:03 -0700)
committerDaniel Colascione <dancol@dancol.org>
Mon, 21 Apr 2014 01:03:39 +0000 (18:03 -0700)
lisp/ChangeLog
lisp/emacs-lisp/cl-macs.el
test/ChangeLog
test/automated/cl-lib.el

index 28b9c79..cb91bbc 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-21  Daniel Colascione  <dancol@dancol.org>
+
+       * emacs-lisp/cl-macs.el:
+       (cl--loop-let): Properly destructure `while' clauses.
+
 2014-04-20  Daniel Colascione  <dancol@dancol.org>
 
        * vc/vc.el (vc-root-dir): New public autoloaded function for
index 5fc8c9f..5b9e17a 100644 (file)
@@ -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--"))
index 940ed0b..2e6e1ae 100644 (file)
@@ -1,3 +1,7 @@
+2014-04-21  Daniel Colascione  <dancol@dancol.org>
+
+       * automated/cl-lib.el (cl-loop-destructuring-with): New test.
+
 2014-04-20  Daniel Colascione  <dancol@dancol.org>
 
        * automated/cl-lib.el (cl-lib-struct-accessors,cl-the): New tests.
index a0df07e..2c73c82 100644 (file)
     (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