]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/cl-macs.el (cl--loop-let): Avoid `nil' as var name.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 21 Apr 2014 21:18:12 +0000 (17:18 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 21 Apr 2014 21:18:12 +0000 (17:18 -0400)
lisp/ChangeLog
lisp/emacs-lisp/cl-macs.el
test/automated/cl-lib.el

index c1aef0c0f90cad70c45d72c77ce0fd53fda40222..d25bf4b75979f6afb78d9ff8ac65a324c5f5c33b 100644 (file)
@@ -1,7 +1,11 @@
+2014-04-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-macs.el (cl--loop-let): Avoid `nil' as var name.
+
 2014-04-21  Michael Albinus  <michael.albinus@gmx.de>
 
-       * net/tramp-sh.el (tramp-sh-handle-file-name-all-completions): Set
-       "IFS=" when using read builtin, in order to preserve spaces in
+       * net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
+       Set "IFS=" when using read builtin, in order to preserve spaces in
        the file name.  Add test messages for hunting a bug on hydra.
        (tramp-get-ls-command): Undo using "-b" argument.  It doesn't help.
 
index cd2d52a4b213842f77304372a026fcb517c7bb09..1c163273b64deda15205d91e6e170a908e4b5ba9 100644 (file)
@@ -1542,12 +1542,14 @@ 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 (or (null temp)
+                          (and (eq body 'setq) (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--"))
                   ;; Make sure this temp variable is locally declared.
-                  (push (list (list temp)) cl--loop-bindings))
+                  (when (eq body 'setq)
+                    (push (list (list temp)) cl--loop-bindings)))
                 (push (list temp expr) new))
               (while (consp spec)
                 (push (list (pop spec)
index f7f4314e1cb9ee2491f84db9c99faf86b89f8e3e..0587bf92b7ca0c0ee2dd53e6157c173498f09282 100644 (file)
   (should (eql (cl-mismatch "Aa" "aA") 0))
   (should (eql (cl-mismatch '(a b c) '(a b d)) 2)))
 
+(ert-deftest cl-lib-test-loop ()
+  (should (eql (cl-loop with (a b c) = '(1 2 3) return (+ a b c)) 6)))
+
 (ert-deftest cl-lib-keyword-names-versus-values ()
   (should (equal
            (funcall (cl-function (lambda (&key a b) (list a b)))