Mercurial > emacs
comparison lisp/emacs-lisp/cl-macs.el @ 111787:4ba82556d7dd
cl-macs `loop' fix for bug#7492.
* lisp/emacs-lisp/cl-macs.el (cl-parse-loop-clause):
Avoid infinite loop over windows.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Thu, 02 Dec 2010 09:36:45 -0800 |
parents | 7094295b2a61 |
children | 417b1e4d63cd |
comparison
equal
deleted
inserted
replaced
111786:1441c8ae52a0 | 111787:4ba82556d7dd |
---|---|
963 (push (list var (list 'next-frame var)) | 963 (push (list var (list 'next-frame var)) |
964 loop-for-steps))) | 964 loop-for-steps))) |
965 | 965 |
966 ((memq word '(window windows)) | 966 ((memq word '(window windows)) |
967 (let ((scr (and (memq (car loop-args) '(in of)) (cl-pop2 loop-args))) | 967 (let ((scr (and (memq (car loop-args) '(in of)) (cl-pop2 loop-args))) |
968 (temp (make-symbol "--cl-var--"))) | 968 (temp (make-symbol "--cl-var--")) |
969 (minip (make-symbol "--cl-minip--"))) | |
969 (push (list var (if scr | 970 (push (list var (if scr |
970 (list 'frame-selected-window scr) | 971 (list 'frame-selected-window scr) |
971 '(selected-window))) | 972 '(selected-window))) |
973 loop-for-bindings) | |
974 ;; If we started in the minibuffer, we need to | |
975 ;; ensure that next-window will bring us back there | |
976 ;; at some point. (Bug#7492). | |
977 ;; (Consider using walk-windows instead of loop if | |
978 ;; you care about such things.) | |
979 (push (list minip `(minibufferp (window-buffer ,var))) | |
972 loop-for-bindings) | 980 loop-for-bindings) |
973 (push (list temp nil) loop-for-bindings) | 981 (push (list temp nil) loop-for-bindings) |
974 (push (list 'prog1 (list 'not (list 'eq var temp)) | 982 (push (list 'prog1 (list 'not (list 'eq var temp)) |
975 (list 'or temp (list 'setq temp var))) | 983 (list 'or temp (list 'setq temp var))) |
976 loop-body) | 984 loop-body) |
977 (push (list var (list 'next-window var)) loop-for-steps))) | 985 (push (list var (list 'next-window var minip)) |
986 loop-for-steps))) | |
978 | 987 |
979 (t | 988 (t |
980 (let ((handler (and (symbolp word) | 989 (let ((handler (and (symbolp word) |
981 (get word 'cl-loop-for-handler)))) | 990 (get word 'cl-loop-for-handler)))) |
982 (if handler | 991 (if handler |