From: Glenn Morris Date: Thu, 2 Dec 2010 17:36:45 +0000 (-0800) Subject: cl-macs `loop' fix for bug#7492. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~45^2~82 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=05907bb3aa0e68c594a0a06c5adaa75fe9817fbf;p=emacs.git cl-macs `loop' fix for bug#7492. * lisp/emacs-lisp/cl-macs.el (cl-parse-loop-clause): Avoid infinite loop over windows. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 135cfe952c7..502a6c65f42 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-12-02 Glenn Morris + * emacs-lisp/cl-macs.el (cl-parse-loop-clause): + Avoid infinite loop over windows. (Bug#7492) + * progmodes/flymake.el (flymake-check-file-limit): Allow nil to mean "no limit". (flymake-check-patch-master-file-buffer): Update for above change. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 76f677c6198..725b98354af 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -965,16 +965,25 @@ Valid clauses are: ((memq word '(window windows)) (let ((scr (and (memq (car loop-args) '(in of)) (cl-pop2 loop-args))) - (temp (make-symbol "--cl-var--"))) + (temp (make-symbol "--cl-var--")) + (minip (make-symbol "--cl-minip--"))) (push (list var (if scr (list 'frame-selected-window scr) '(selected-window))) loop-for-bindings) + ;; If we started in the minibuffer, we need to + ;; ensure that next-window will bring us back there + ;; at some point. (Bug#7492). + ;; (Consider using walk-windows instead of loop if + ;; you care about such things.) + (push (list minip `(minibufferp (window-buffer ,var))) + loop-for-bindings) (push (list temp nil) loop-for-bindings) (push (list 'prog1 (list 'not (list 'eq var temp)) (list 'or temp (list 'setq temp var))) loop-body) - (push (list var (list 'next-window var)) loop-for-steps))) + (push (list var (list 'next-window var minip)) + loop-for-steps))) (t (let ((handler (and (symbolp word)