From da03ef8a9d38ef6f059aaeddb8c97dc7e76d3917 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 9 Nov 2012 15:45:10 -0500 Subject: [PATCH] * lisp/subr.el (dolist): Don't bind VAR in RESULT. --- etc/NEWS | 5 +++++ lisp/ChangeLog | 2 ++ lisp/subr.el | 4 +--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index bb8bcd6cb56..177f91066ac 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -28,6 +28,11 @@ so we will look at it and add it to the manual. * Changes in Specialized Modes and Packages in Emacs 24.4 * New Modes and Packages in Emacs 24.4 * Incompatible Lisp Changes in Emacs 24.4 + +** `dolist' in lexical-binding mode does not bind VAR in RESULT any more. +VAR was bound to nil which was not tremendously useful and just lead to +spurious warnings about an unused var. + * Lisp changes in Emacs 24.4 ** Docstrings can be made dynamic by adding a `dynamic-docstring-function' diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 612cdc33d52..6f10e311eac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-11-09 Stefan Monnier + * subr.el (dolist): Don't bind VAR in RESULT. + * emacs-lisp/advice.el: Miscellaneous cleanup. Use lexical-binding. (fset, documentation): Don't save real def since we don't advise. (ad-do-advised-functions): Remove problematic `result-form'. diff --git a/lisp/subr.el b/lisp/subr.el index 9c89bd3e045..0ba932a3efe 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -222,9 +222,7 @@ Then evaluate RESULT to get return value, default nil. (let ((,(car spec) (car ,temp))) ,@body (setq ,temp (cdr ,temp)))) - ,@(if (cdr (cdr spec)) - ;; FIXME: This let often leads to "unused var" warnings. - `((let ((,(car spec) nil)) ,@(cdr (cdr spec)))))) + ,@(cdr (cdr spec))) `(let ((,temp ,(nth 1 spec)) ,(car spec)) (while ,temp -- 2.39.2