diff options
| author | Jim Blandy | 1992-09-13 12:29:01 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-09-13 12:29:01 +0000 |
| commit | d06a8a56c2d7e113eca9a77a850c9bab9d1234c6 (patch) | |
| tree | 7b28e82cd45bb0adcd872c9ae480fe3f55ace988 /src | |
| parent | 4b93635c3e4e80fe4f212eb81fcf86261c550e19 (diff) | |
| download | emacs-d06a8a56c2d7e113eca9a77a850c9bab9d1234c6.tar.gz emacs-d06a8a56c2d7e113eca9a77a850c9bab9d1234c6.zip | |
* frame.c (choose_minibuf_frame): abort if the selected frame has
nil in its minibuffer_window slot; this shouldn't happen any more.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.c | 113 |
1 files changed, 73 insertions, 40 deletions
diff --git a/src/frame.c b/src/frame.c index 6c0ab79a8bc..1a8261c5269 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -401,10 +401,10 @@ DEFUN ("frame-list", Fframe_list, Sframe_list, | |||
| 401 | #ifdef MULTI_FRAME | 401 | #ifdef MULTI_FRAME |
| 402 | 402 | ||
| 403 | /* Return the next frame in the frame list after FRAME. | 403 | /* Return the next frame in the frame list after FRAME. |
| 404 | If MINIBUF is non-nil, include all frames. | ||
| 405 | If MINIBUF is nil, exclude minibuffer-only frames. | 404 | If MINIBUF is nil, exclude minibuffer-only frames. |
| 406 | If MINIBUF is a window, include only frames using that window for | 405 | If MINIBUF is a window, include only frames using that window for |
| 407 | their minibuffer. */ | 406 | their minibuffer. |
| 407 | If MINIBUF is non-nil, and not a window, include all frames. */ | ||
| 408 | Lisp_Object | 408 | Lisp_Object |
| 409 | next_frame (frame, minibuf) | 409 | next_frame (frame, minibuf) |
| 410 | Lisp_Object frame; | 410 | Lisp_Object frame; |
| @@ -420,29 +420,45 @@ next_frame (frame, minibuf) | |||
| 420 | while (1) | 420 | while (1) |
| 421 | for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) | 421 | for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) |
| 422 | { | 422 | { |
| 423 | Lisp_Object f = XCONS (tail)->car; | ||
| 424 | |||
| 423 | if (passed) | 425 | if (passed) |
| 424 | { | 426 | { |
| 425 | Lisp_Object f = XCONS (tail)->car; | 427 | /* Decide whether this frame is eligible to be returned. */ |
| 426 | 428 | ||
| 427 | /* Decide whether this frame is eligible to be returned, | 429 | /* If we've looped all the way around without finding any |
| 428 | according to minibuf. */ | 430 | eligible frames, return the original frame. */ |
| 429 | if ((NILP (minibuf) && ! FRAME_MINIBUF_ONLY_P (XFRAME (f))) | 431 | if (EQ (f, frame)) |
| 430 | || XTYPE (minibuf) != Lisp_Window | 432 | return f; |
| 431 | || EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf) | 433 | |
| 432 | || EQ (f, frame)) | 434 | /* Let minibuf decide if this frame is acceptable. */ |
| 435 | if (NILP (minibuf)) | ||
| 436 | { | ||
| 437 | if (! FRAME_MINIBUF_ONLY_P (XFRAME (f))) | ||
| 438 | return f; | ||
| 439 | } | ||
| 440 | else if (XTYPE (minibuf) == Lisp_Window) | ||
| 441 | { | ||
| 442 | if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf)) | ||
| 443 | return f; | ||
| 444 | } | ||
| 445 | else | ||
| 433 | return f; | 446 | return f; |
| 434 | } | 447 | } |
| 435 | 448 | ||
| 436 | if (EQ (frame, XCONS (tail)->car)) | 449 | if (EQ (frame, f)) |
| 437 | passed++; | 450 | passed++; |
| 438 | } | 451 | } |
| 439 | } | 452 | } |
| 440 | 453 | ||
| 454 | #if 0 | ||
| 455 | /* Nobody seems to be using this code right now. */ | ||
| 456 | |||
| 441 | /* Return the previous frame in the frame list before FRAME. | 457 | /* Return the previous frame in the frame list before FRAME. |
| 442 | If MINIBUF is non-nil, include all frames. | ||
| 443 | If MINIBUF is nil, exclude minibuffer-only frames. | 458 | If MINIBUF is nil, exclude minibuffer-only frames. |
| 444 | If MINIBUF is a window, include only frames using that window for | 459 | If MINIBUF is a window, include only frames using that window for |
| 445 | their minibuffer. */ | 460 | their minibuffer. |
| 461 | If MINIBUF is non-nil and not a window, include all frames. */ | ||
| 446 | Lisp_Object | 462 | Lisp_Object |
| 447 | prev_frame (frame, minibuf) | 463 | prev_frame (frame, minibuf) |
| 448 | Lisp_Object frame; | 464 | Lisp_Object frame; |
| @@ -456,40 +472,52 @@ prev_frame (frame, minibuf) | |||
| 456 | abort (); | 472 | abort (); |
| 457 | 473 | ||
| 458 | prev = Qnil; | 474 | prev = Qnil; |
| 459 | while (1) | 475 | for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) |
| 460 | { | 476 | { |
| 461 | for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) | 477 | Lisp_Object f = XCONS (tail)->car; |
| 462 | { | ||
| 463 | Lisp_Object scr = XCONS (tail)->car; | ||
| 464 | 478 | ||
| 465 | if (XTYPE (scr) != Lisp_Frame) | 479 | if (XTYPE (f) != Lisp_Frame) |
| 466 | abort (); | 480 | abort (); |
| 467 | 481 | ||
| 468 | if (EQ (frame, scr) && !NILP (prev)) | 482 | if (EQ (frame, f) && !NILP (prev)) |
| 469 | return prev; | 483 | return prev; |
| 470 | 484 | ||
| 471 | /* Decide whether this frame is eligible to be returned, | 485 | /* Decide whether this frame is eligible to be returned, |
| 472 | according to minibuf. */ | 486 | according to minibuf. */ |
| 473 | if ((NILP (minibuf) && ! FRAME_MINIBUF_ONLY_P (XFRAME (scr))) | 487 | if (NILP (minibuf)) |
| 474 | || XTYPE (minibuf) != Lisp_Window | 488 | { |
| 475 | || EQ (FRAME_MINIBUF_WINDOW (XFRAME (scr)), minibuf)) | 489 | if (! FRAME_MINIBUF_ONLY_P (XFRAME (f))) |
| 476 | prev = scr; | 490 | prev = f; |
| 477 | } | 491 | } |
| 478 | 492 | else if (XTYPE (minibuf) == Lisp_Window) | |
| 479 | if (NILP (prev)) | 493 | { |
| 480 | /* We went through the whole frame list without finding a single | 494 | if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf)) |
| 481 | acceptable frame. Return the original frame. */ | 495 | prev = f; |
| 482 | prev = frame; | 496 | } |
| 497 | else | ||
| 498 | prev = f; | ||
| 483 | } | 499 | } |
| 484 | 500 | ||
| 501 | /* We've scanned the entire list. */ | ||
| 502 | if (NILP (prev)) | ||
| 503 | /* We went through the whole frame list without finding a single | ||
| 504 | acceptable frame. Return the original frame. */ | ||
| 505 | return frame; | ||
| 506 | else | ||
| 507 | /* There were no acceptable frames in the list before FRAME; otherwise, | ||
| 508 | we would have returned directly from the loop. Since PREV is the last | ||
| 509 | acceptable frame in the list, return it. */ | ||
| 510 | return prev; | ||
| 485 | } | 511 | } |
| 512 | #endif | ||
| 486 | 513 | ||
| 487 | DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0, | 514 | DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0, |
| 488 | "Return the next frame in the frame list after FRAME.\n\ | 515 | "Return the next frame in the frame list after FRAME.\n\ |
| 489 | If optional argument MINIBUF is non-nil, include all frames. If\n\ | 516 | If omitted, FRAME defaults to the selected frame.\n\ |
| 490 | MINIBUF is nil or omitted, exclude minibuffer-only frames. If\n\ | 517 | If optional argument MINIBUF is nil or omitted, exclude minibuffer-only frames.\n\ |
| 491 | MINIBUF is a window, include only frames using that window for their\n\ | 518 | If MINIBUF is a window, include only frames using that window for their\n\ |
| 492 | minibuffer.") | 519 | minibuffer.\n\ |
| 520 | If MINIBUF is non-nil and not a window, include all frames.") | ||
| 493 | (frame, miniframe) | 521 | (frame, miniframe) |
| 494 | Lisp_Object frame, miniframe; | 522 | Lisp_Object frame, miniframe; |
| 495 | { | 523 | { |
| @@ -1213,11 +1241,16 @@ choose_minibuf_frame () | |||
| 1213 | { | 1241 | { |
| 1214 | /* For lowest-level minibuf, put it on currently selected frame | 1242 | /* For lowest-level minibuf, put it on currently selected frame |
| 1215 | if frame has a minibuffer. */ | 1243 | if frame has a minibuffer. */ |
| 1244 | |||
| 1216 | if (minibuf_level == 0 | 1245 | if (minibuf_level == 0 |
| 1217 | && selected_frame != 0 | 1246 | && selected_frame != 0 |
| 1218 | && !EQ (minibuf_window, selected_frame->minibuffer_window) | 1247 | && !EQ (minibuf_window, selected_frame->minibuffer_window)) |
| 1219 | && !EQ (Qnil, selected_frame->minibuffer_window)) | ||
| 1220 | { | 1248 | { |
| 1249 | /* I don't think that any frames may validly have a null minibuffer | ||
| 1250 | window anymore. */ | ||
| 1251 | if (NILP (selected_frame->minibuffer_window)) | ||
| 1252 | abort (); | ||
| 1253 | |||
| 1221 | Fset_window_buffer (selected_frame->minibuffer_window, | 1254 | Fset_window_buffer (selected_frame->minibuffer_window, |
| 1222 | XWINDOW (minibuf_window)->buffer); | 1255 | XWINDOW (minibuf_window)->buffer); |
| 1223 | minibuf_window = selected_frame->minibuffer_window; | 1256 | minibuf_window = selected_frame->minibuffer_window; |
| @@ -1325,7 +1358,7 @@ For values specific to the separate minibuffer frame, see\n\ | |||
| 1325 | #endif /* HAVE_X11 */ | 1358 | #endif /* HAVE_X11 */ |
| 1326 | } | 1359 | } |
| 1327 | 1360 | ||
| 1328 | #else /* not MULTI_SCREEN */ | 1361 | #else /* not MULTI_FRAME */ |
| 1329 | 1362 | ||
| 1330 | /* If we're not using multi-frame stuff, we still need to provide some | 1363 | /* If we're not using multi-frame stuff, we still need to provide some |
| 1331 | support functions. */ | 1364 | support functions. */ |