From 622eef687cedb8fbaf8ca529239f46968c2487f7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 21 Apr 2014 17:18:12 -0400 Subject: [PATCH] * lisp/emacs-lisp/cl-macs.el (cl--loop-let): Avoid `nil' as var name. --- lisp/ChangeLog | 8 ++++++-- lisp/emacs-lisp/cl-macs.el | 6 ++++-- test/automated/cl-lib.el | 3 +++ 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 @@ +2014-04-21 Stefan Monnier + + * emacs-lisp/cl-macs.el (cl--loop-let): Avoid `nil' as var name. + 2014-04-21 Michael Albinus - * 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. 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." (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) 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 @@ (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))) -- 2.11.4.GIT