aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-04-21 17:18:12 -0400
committerStefan Monnier2014-04-21 17:18:12 -0400
commit622eef687cedb8fbaf8ca529239f46968c2487f7 (patch)
tree7bde00069a04ff17f8c20b5f7acb8899ccabfb8d
parent505fa2ab43f38f623fb8f1653371a3a35d5d4b7f (diff)
downloademacs-622eef687cedb8fbaf8ca529239f46968c2487f7.tar.gz
emacs-622eef687cedb8fbaf8ca529239f46968c2487f7.zip
* lisp/emacs-lisp/cl-macs.el (cl--loop-let): Avoid `nil' as var name.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/emacs-lisp/cl-macs.el6
-rw-r--r--test/automated/cl-lib.el3
3 files changed, 13 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c1aef0c0f90..d25bf4b7597 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,7 +1,11 @@
12014-04-21 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/cl-macs.el (cl--loop-let): Avoid `nil' as var name.
4
12014-04-21 Michael Albinus <michael.albinus@gmx.de> 52014-04-21 Michael Albinus <michael.albinus@gmx.de>
2 6
3 * net/tramp-sh.el (tramp-sh-handle-file-name-all-completions): Set 7 * net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
4 "IFS=" when using read builtin, in order to preserve spaces in 8 Set "IFS=" when using read builtin, in order to preserve spaces in
5 the file name. Add test messages for hunting a bug on hydra. 9 the file name. Add test messages for hunting a bug on hydra.
6 (tramp-get-ls-command): Undo using "-b" argument. It doesn't help. 10 (tramp-get-ls-command): Undo using "-b" argument. It doesn't help.
7 11
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index cd2d52a4b21..1c163273b64 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1542,12 +1542,14 @@ If BODY is `setq', then use SPECS for assignments rather than for bindings."
1542 (if (and (cl--unused-var-p temp) (null expr)) 1542 (if (and (cl--unused-var-p temp) (null expr))
1543 nil ;; Don't bother declaring/setting `temp' since it won't 1543 nil ;; Don't bother declaring/setting `temp' since it won't
1544 ;; be used when `expr' is nil, anyway. 1544 ;; be used when `expr' is nil, anyway.
1545 (when (and (eq body 'setq) (cl--unused-var-p temp)) 1545 (when (or (null temp)
1546 (and (eq body 'setq) (cl--unused-var-p temp)))
1546 ;; Prefer a fresh uninterned symbol over "_to", to avoid 1547 ;; Prefer a fresh uninterned symbol over "_to", to avoid
1547 ;; warnings that we set an unused variable. 1548 ;; warnings that we set an unused variable.
1548 (setq temp (make-symbol "--cl-var--")) 1549 (setq temp (make-symbol "--cl-var--"))
1549 ;; Make sure this temp variable is locally declared. 1550 ;; Make sure this temp variable is locally declared.
1550 (push (list (list temp)) cl--loop-bindings)) 1551 (when (eq body 'setq)
1552 (push (list (list temp)) cl--loop-bindings)))
1551 (push (list temp expr) new)) 1553 (push (list temp expr) new))
1552 (while (consp spec) 1554 (while (consp spec)
1553 (push (list (pop spec) 1555 (push (list (pop spec)
diff --git a/test/automated/cl-lib.el b/test/automated/cl-lib.el
index f7f4314e1cb..0587bf92b7c 100644
--- a/test/automated/cl-lib.el
+++ b/test/automated/cl-lib.el
@@ -195,6 +195,9 @@
195 (should (eql (cl-mismatch "Aa" "aA") 0)) 195 (should (eql (cl-mismatch "Aa" "aA") 0))
196 (should (eql (cl-mismatch '(a b c) '(a b d)) 2))) 196 (should (eql (cl-mismatch '(a b c) '(a b d)) 2)))
197 197
198(ert-deftest cl-lib-test-loop ()
199 (should (eql (cl-loop with (a b c) = '(1 2 3) return (+ a b c)) 6)))
200
198(ert-deftest cl-lib-keyword-names-versus-values () 201(ert-deftest cl-lib-keyword-names-versus-values ()
199 (should (equal 202 (should (equal
200 (funcall (cl-function (lambda (&key a b) (list a b))) 203 (funcall (cl-function (lambda (&key a b) (list a b)))