diff --git a/src/window.c b/src/window.c index eb16e2a433..aa60624d63 100644 --- a/src/window.c +++ b/src/window.c @@ -2556,8 +2556,10 @@ window_list (void) if (!CONSP (Vwindow_list)) { Lisp_Object tail, frame; + ptrdiff_t count = SPECPDL_INDEX (); Vwindow_list = Qnil; + specbind (Qinhibit_quit, Qt); FOR_EACH_FRAME (tail, frame) { Lisp_Object arglist = Qnil; @@ -2569,6 +2571,8 @@ window_list (void) arglist = Fnreverse (arglist); Vwindow_list = nconc2 (Vwindow_list, arglist); } + + unbind_to (count, Qnil); } return Vwindow_list; @@ -2865,11 +2869,16 @@ window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) rest = Fmemq (window, list); if (!NILP (rest) && !EQ (rest, list)) { + ptrdiff_t count = SPECPDL_INDEX (); + + specbind (Qinhibit_quit, Qt); for (tail = list; !EQ (XCDR (tail), rest); tail = XCDR (tail)) ; XSETCDR (tail, Qnil); list = nconc2 (rest, list); + unbind_to (count, Qnil); } + return list; }