diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 153 |
1 files changed, 55 insertions, 98 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 921ce82b390..348fdb29514 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -479,19 +479,6 @@ int message_buf_print; | |||
| 479 | 479 | ||
| 480 | static Lisp_Object Vmax_mini_window_height; | 480 | static Lisp_Object Vmax_mini_window_height; |
| 481 | 481 | ||
| 482 | /* Window configuration saved in resize_mini_window. */ | ||
| 483 | |||
| 484 | Lisp_Object Vresize_mini_config; | ||
| 485 | |||
| 486 | /* Frmae of the mini-window being resized by resize_mini_window. */ | ||
| 487 | |||
| 488 | struct frame *resize_mini_frame; | ||
| 489 | |||
| 490 | /* Initial height of the mini-window having been resized | ||
| 491 | by resize_mini_window. */ | ||
| 492 | |||
| 493 | int resize_mini_initial_height; | ||
| 494 | |||
| 495 | /* A scratch glyph row with contents used for generating truncation | 482 | /* A scratch glyph row with contents used for generating truncation |
| 496 | glyphs. Also used in direct_output_for_insert. */ | 483 | glyphs. Also used in direct_output_for_insert. */ |
| 497 | 484 | ||
| @@ -599,7 +586,6 @@ enum move_it_result | |||
| 599 | 586 | ||
| 600 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); | 587 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); |
| 601 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); | 588 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); |
| 602 | static int resize_mini_window P_ ((struct window *)); | ||
| 603 | static void clear_garbaged_frames P_ ((void)); | 589 | static void clear_garbaged_frames P_ ((void)); |
| 604 | static int current_message_1 P_ ((Lisp_Object *)); | 590 | static int current_message_1 P_ ((Lisp_Object *)); |
| 605 | static int truncate_message_1 P_ ((int)); | 591 | static int truncate_message_1 P_ ((int)); |
| @@ -2720,9 +2706,9 @@ load_overlay_strings (it) | |||
| 2720 | /* Process overlay before the overlay center. */ | 2706 | /* Process overlay before the overlay center. */ |
| 2721 | for (ov = current_buffer->overlays_before; | 2707 | for (ov = current_buffer->overlays_before; |
| 2722 | CONSP (ov); | 2708 | CONSP (ov); |
| 2723 | ov = XCONS (ov)->cdr) | 2709 | ov = XCDR (ov)) |
| 2724 | { | 2710 | { |
| 2725 | overlay = XCONS (ov)->car; | 2711 | overlay = XCAR (ov); |
| 2726 | xassert (OVERLAYP (overlay)); | 2712 | xassert (OVERLAYP (overlay)); |
| 2727 | start = OVERLAY_POSITION (OVERLAY_START (overlay)); | 2713 | start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 2728 | end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 2714 | end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| @@ -2756,9 +2742,9 @@ load_overlay_strings (it) | |||
| 2756 | /* Process overlays after the overlay center. */ | 2742 | /* Process overlays after the overlay center. */ |
| 2757 | for (ov = current_buffer->overlays_after; | 2743 | for (ov = current_buffer->overlays_after; |
| 2758 | CONSP (ov); | 2744 | CONSP (ov); |
| 2759 | ov = XCONS (ov)->cdr) | 2745 | ov = XCDR (ov)) |
| 2760 | { | 2746 | { |
| 2761 | overlay = XCONS (ov)->car; | 2747 | overlay = XCAR (ov); |
| 2762 | xassert (OVERLAYP (overlay)); | 2748 | xassert (OVERLAYP (overlay)); |
| 2763 | start = OVERLAY_POSITION (OVERLAY_START (overlay)); | 2749 | start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 2764 | end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 2750 | end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| @@ -5432,7 +5418,7 @@ display_echo_area_1 (w) | |||
| 5432 | /* Resize mini-window W to fit the size of its contents. Value is | 5418 | /* Resize mini-window W to fit the size of its contents. Value is |
| 5433 | non-zero if the window height has been changed. */ | 5419 | non-zero if the window height has been changed. */ |
| 5434 | 5420 | ||
| 5435 | static int | 5421 | int |
| 5436 | resize_mini_window (w) | 5422 | resize_mini_window (w) |
| 5437 | struct window *w; | 5423 | struct window *w; |
| 5438 | { | 5424 | { |
| @@ -5485,50 +5471,18 @@ resize_mini_window (w) | |||
| 5485 | SET_TEXT_POS (start, BEGV, BEGV_BYTE); | 5471 | SET_TEXT_POS (start, BEGV, BEGV_BYTE); |
| 5486 | SET_MARKER_FROM_TEXT_POS (w->start, start); | 5472 | SET_MARKER_FROM_TEXT_POS (w->start, start); |
| 5487 | 5473 | ||
| 5488 | if (NILP (Vresize_mini_config)) | 5474 | /* Let it grow only, until we display an empty message, in which |
| 5475 | case the window shrinks again. */ | ||
| 5476 | if (height > XFASTINT (w->height) | ||
| 5477 | || BEGV == ZV) | ||
| 5489 | { | 5478 | { |
| 5490 | if (height != XFASTINT (w->height)) | 5479 | Lisp_Object old_selected_window; |
| 5491 | { | ||
| 5492 | Lisp_Object old_selected_window; | ||
| 5493 | Lisp_Object config; | ||
| 5494 | struct gcpro gcpro1; | ||
| 5495 | |||
| 5496 | resize_mini_initial_height = XFASTINT (w->height); | ||
| 5497 | config = Fcurrent_window_configuration (Qnil); | ||
| 5498 | GCPRO1 (config); | ||
| 5499 | |||
| 5500 | old_selected_window = selected_window; | ||
| 5501 | XSETWINDOW (selected_window, w); | ||
| 5502 | change_window_height (height - XFASTINT (w->height), 0); | ||
| 5503 | selected_window = old_selected_window; | ||
| 5504 | |||
| 5505 | window_height_changed_p = 1; | ||
| 5506 | |||
| 5507 | /* Set this after changing window sizes, or else | ||
| 5508 | Vresize_mini_config would be reset in | ||
| 5509 | adjust_frame_glyphs. */ | ||
| 5510 | resize_mini_frame = XFRAME (w->frame); | ||
| 5511 | Vresize_mini_config = config; | ||
| 5512 | UNGCPRO; | ||
| 5513 | } | ||
| 5514 | } | ||
| 5515 | else if (height != XFASTINT (w->height)) | ||
| 5516 | { | ||
| 5517 | if (height == resize_mini_initial_height) | ||
| 5518 | { | ||
| 5519 | Fset_window_configuration (Vresize_mini_config); | ||
| 5520 | Vresize_mini_config = Qnil; | ||
| 5521 | resize_mini_frame = NULL; | ||
| 5522 | } | ||
| 5523 | else | ||
| 5524 | { | ||
| 5525 | Lisp_Object old_selected_window; | ||
| 5526 | old_selected_window = selected_window; | ||
| 5527 | XSETWINDOW (selected_window, w); | ||
| 5528 | change_window_height (height - XFASTINT (w->height), 0); | ||
| 5529 | selected_window = old_selected_window; | ||
| 5530 | } | ||
| 5531 | 5480 | ||
| 5481 | freeze_window_starts (f, height > XFASTINT (w->height)); | ||
| 5482 | old_selected_window = selected_window; | ||
| 5483 | XSETWINDOW (selected_window, w); | ||
| 5484 | change_window_height (height - XFASTINT (w->height), 0); | ||
| 5485 | selected_window = old_selected_window; | ||
| 5532 | window_height_changed_p = 1; | 5486 | window_height_changed_p = 1; |
| 5533 | } | 5487 | } |
| 5534 | } | 5488 | } |
| @@ -5985,9 +5939,9 @@ x_consider_frame_title (frame) | |||
| 5985 | int len; | 5939 | int len; |
| 5986 | struct it it; | 5940 | struct it it; |
| 5987 | 5941 | ||
| 5988 | for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) | 5942 | for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) |
| 5989 | { | 5943 | { |
| 5990 | struct frame *tf = XFRAME (XCONS (tail)->car); | 5944 | struct frame *tf = XFRAME (XCAR (tail)); |
| 5991 | 5945 | ||
| 5992 | if (tf != f | 5946 | if (tf != f |
| 5993 | && FRAME_KBOARD (tf) == FRAME_KBOARD (f) | 5947 | && FRAME_KBOARD (tf) == FRAME_KBOARD (f) |
| @@ -7404,14 +7358,14 @@ update: | |||
| 7404 | 7358 | ||
| 7405 | pause = 0; | 7359 | pause = 0; |
| 7406 | 7360 | ||
| 7407 | for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) | 7361 | for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) |
| 7408 | { | 7362 | { |
| 7409 | struct frame *f; | 7363 | struct frame *f; |
| 7410 | 7364 | ||
| 7411 | if (!FRAMEP (XCONS (tail)->car)) | 7365 | if (!FRAMEP (XCAR (tail))) |
| 7412 | continue; | 7366 | continue; |
| 7413 | 7367 | ||
| 7414 | f = XFRAME (XCONS (tail)->car); | 7368 | f = XFRAME (XCAR (tail)); |
| 7415 | 7369 | ||
| 7416 | if ((FRAME_WINDOW_P (f) || f == selected_frame) | 7370 | if ((FRAME_WINDOW_P (f) || f == selected_frame) |
| 7417 | && FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f)) | 7371 | && FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f)) |
| @@ -8400,7 +8354,8 @@ redisplay_window (window, just_this_one_p) | |||
| 8400 | 8354 | ||
| 8401 | /* Handle case where place to start displaying has been specified, | 8355 | /* Handle case where place to start displaying has been specified, |
| 8402 | unless the specified location is outside the accessible range. */ | 8356 | unless the specified location is outside the accessible range. */ |
| 8403 | if (!NILP (w->force_start)) | 8357 | if (!NILP (w->force_start) |
| 8358 | || w->frozen_window_start_p) | ||
| 8404 | { | 8359 | { |
| 8405 | w->force_start = Qnil; | 8360 | w->force_start = Qnil; |
| 8406 | w->vscroll = 0; | 8361 | w->vscroll = 0; |
| @@ -8449,7 +8404,7 @@ redisplay_window (window, just_this_one_p) | |||
| 8449 | goto restore_buffers; | 8404 | goto restore_buffers; |
| 8450 | } | 8405 | } |
| 8451 | 8406 | ||
| 8452 | if (w->cursor.vpos < 0) | 8407 | if (w->cursor.vpos < 0 && !w->frozen_window_start_p) |
| 8453 | { | 8408 | { |
| 8454 | /* If point does not appear, or on a line that is not fully | 8409 | /* If point does not appear, or on a line that is not fully |
| 8455 | visible, move point so it does appear. The desired | 8410 | visible, move point so it does appear. The desired |
| @@ -11538,7 +11493,7 @@ display_mode_element (it, depth, field_width, precision, elt) | |||
| 11538 | to at least that many characters. | 11493 | to at least that many characters. |
| 11539 | If first element is a symbol, process the cadr or caddr recursively | 11494 | If first element is a symbol, process the cadr or caddr recursively |
| 11540 | according to whether the symbol's value is non-nil or nil. */ | 11495 | according to whether the symbol's value is non-nil or nil. */ |
| 11541 | car = XCONS (elt)->car; | 11496 | car = XCAR (elt); |
| 11542 | if (EQ (car, QCeval) && CONSP (XCDR (elt))) | 11497 | if (EQ (car, QCeval) && CONSP (XCDR (elt))) |
| 11543 | { | 11498 | { |
| 11544 | /* An element of the form (:eval FORM) means evaluate FORM | 11499 | /* An element of the form (:eval FORM) means evaluate FORM |
| @@ -11555,7 +11510,7 @@ display_mode_element (it, depth, field_width, precision, elt) | |||
| 11555 | else if (SYMBOLP (car)) | 11510 | else if (SYMBOLP (car)) |
| 11556 | { | 11511 | { |
| 11557 | tem = Fboundp (car); | 11512 | tem = Fboundp (car); |
| 11558 | elt = XCONS (elt)->cdr; | 11513 | elt = XCDR (elt); |
| 11559 | if (!CONSP (elt)) | 11514 | if (!CONSP (elt)) |
| 11560 | goto invalid; | 11515 | goto invalid; |
| 11561 | /* elt is now the cdr, and we know it is a cons cell. | 11516 | /* elt is now the cdr, and we know it is a cons cell. |
| @@ -11564,23 +11519,26 @@ display_mode_element (it, depth, field_width, precision, elt) | |||
| 11564 | { | 11519 | { |
| 11565 | tem = Fsymbol_value (car); | 11520 | tem = Fsymbol_value (car); |
| 11566 | if (!NILP (tem)) | 11521 | if (!NILP (tem)) |
| 11567 | { elt = XCONS (elt)->car; goto tail_recurse; } | 11522 | { |
| 11523 | elt = XCAR (elt); | ||
| 11524 | goto tail_recurse; | ||
| 11525 | } | ||
| 11568 | } | 11526 | } |
| 11569 | /* Symbol's value is nil (or symbol is unbound) | 11527 | /* Symbol's value is nil (or symbol is unbound) |
| 11570 | Get the cddr of the original list | 11528 | Get the cddr of the original list |
| 11571 | and if possible find the caddr and use that. */ | 11529 | and if possible find the caddr and use that. */ |
| 11572 | elt = XCONS (elt)->cdr; | 11530 | elt = XCDR (elt); |
| 11573 | if (NILP (elt)) | 11531 | if (NILP (elt)) |
| 11574 | break; | 11532 | break; |
| 11575 | else if (!CONSP (elt)) | 11533 | else if (!CONSP (elt)) |
| 11576 | goto invalid; | 11534 | goto invalid; |
| 11577 | elt = XCONS (elt)->car; | 11535 | elt = XCAR (elt); |
| 11578 | goto tail_recurse; | 11536 | goto tail_recurse; |
| 11579 | } | 11537 | } |
| 11580 | else if (INTEGERP (car)) | 11538 | else if (INTEGERP (car)) |
| 11581 | { | 11539 | { |
| 11582 | register int lim = XINT (car); | 11540 | register int lim = XINT (car); |
| 11583 | elt = XCONS (elt)->cdr; | 11541 | elt = XCDR (elt); |
| 11584 | if (lim < 0) | 11542 | if (lim < 0) |
| 11585 | { | 11543 | { |
| 11586 | /* Negative int means reduce maximum width. */ | 11544 | /* Negative int means reduce maximum width. */ |
| @@ -11612,8 +11570,8 @@ display_mode_element (it, depth, field_width, precision, elt) | |||
| 11612 | && (precision <= 0 || n < precision)) | 11570 | && (precision <= 0 || n < precision)) |
| 11613 | { | 11571 | { |
| 11614 | n += display_mode_element (it, depth, field_width - n, | 11572 | n += display_mode_element (it, depth, field_width - n, |
| 11615 | precision - n, XCONS (elt)->car); | 11573 | precision - n, XCAR (elt)); |
| 11616 | elt = XCONS (elt)->cdr; | 11574 | elt = XCDR (elt); |
| 11617 | } | 11575 | } |
| 11618 | } | 11576 | } |
| 11619 | } | 11577 | } |
| @@ -12431,28 +12389,28 @@ invisible_p (propval, list) | |||
| 12431 | Lisp_Object list; | 12389 | Lisp_Object list; |
| 12432 | { | 12390 | { |
| 12433 | register Lisp_Object tail, proptail; | 12391 | register Lisp_Object tail, proptail; |
| 12434 | for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr) | 12392 | for (tail = list; CONSP (tail); tail = XCDR (tail)) |
| 12435 | { | 12393 | { |
| 12436 | register Lisp_Object tem; | 12394 | register Lisp_Object tem; |
| 12437 | tem = XCONS (tail)->car; | 12395 | tem = XCAR (tail); |
| 12438 | if (EQ (propval, tem)) | 12396 | if (EQ (propval, tem)) |
| 12439 | return 1; | 12397 | return 1; |
| 12440 | if (CONSP (tem) && EQ (propval, XCONS (tem)->car)) | 12398 | if (CONSP (tem) && EQ (propval, XCAR (tem))) |
| 12441 | return 1; | 12399 | return 1; |
| 12442 | } | 12400 | } |
| 12443 | if (CONSP (propval)) | 12401 | if (CONSP (propval)) |
| 12444 | for (proptail = propval; CONSP (proptail); | 12402 | for (proptail = propval; CONSP (proptail); |
| 12445 | proptail = XCONS (proptail)->cdr) | 12403 | proptail = XCDR (proptail)) |
| 12446 | { | 12404 | { |
| 12447 | Lisp_Object propelt; | 12405 | Lisp_Object propelt; |
| 12448 | propelt = XCONS (proptail)->car; | 12406 | propelt = XCAR (proptail); |
| 12449 | for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr) | 12407 | for (tail = list; CONSP (tail); tail = XCDR (tail)) |
| 12450 | { | 12408 | { |
| 12451 | register Lisp_Object tem; | 12409 | register Lisp_Object tem; |
| 12452 | tem = XCONS (tail)->car; | 12410 | tem = XCAR (tail); |
| 12453 | if (EQ (propelt, tem)) | 12411 | if (EQ (propelt, tem)) |
| 12454 | return 1; | 12412 | return 1; |
| 12455 | if (CONSP (tem) && EQ (propelt, XCONS (tem)->car)) | 12413 | if (CONSP (tem) && EQ (propelt, XCAR (tem))) |
| 12456 | return 1; | 12414 | return 1; |
| 12457 | } | 12415 | } |
| 12458 | } | 12416 | } |
| @@ -12472,27 +12430,29 @@ invisible_ellipsis_p (propval, list) | |||
| 12472 | Lisp_Object list; | 12430 | Lisp_Object list; |
| 12473 | { | 12431 | { |
| 12474 | register Lisp_Object tail, proptail; | 12432 | register Lisp_Object tail, proptail; |
| 12475 | for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr) | 12433 | |
| 12434 | for (tail = list; CONSP (tail); tail = XCDR (tail)) | ||
| 12476 | { | 12435 | { |
| 12477 | register Lisp_Object tem; | 12436 | register Lisp_Object tem; |
| 12478 | tem = XCONS (tail)->car; | 12437 | tem = XCAR (tail); |
| 12479 | if (CONSP (tem) && EQ (propval, XCONS (tem)->car)) | 12438 | if (CONSP (tem) && EQ (propval, XCAR (tem))) |
| 12480 | return ! NILP (XCONS (tem)->cdr); | 12439 | return ! NILP (XCDR (tem)); |
| 12481 | } | 12440 | } |
| 12441 | |||
| 12482 | if (CONSP (propval)) | 12442 | if (CONSP (propval)) |
| 12483 | for (proptail = propval; CONSP (proptail); | 12443 | for (proptail = propval; CONSP (proptail); proptail = XCDR (proptail)) |
| 12484 | proptail = XCONS (proptail)->cdr) | ||
| 12485 | { | 12444 | { |
| 12486 | Lisp_Object propelt; | 12445 | Lisp_Object propelt; |
| 12487 | propelt = XCONS (proptail)->car; | 12446 | propelt = XCAR (proptail); |
| 12488 | for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr) | 12447 | for (tail = list; CONSP (tail); tail = XCDR (tail)) |
| 12489 | { | 12448 | { |
| 12490 | register Lisp_Object tem; | 12449 | register Lisp_Object tem; |
| 12491 | tem = XCONS (tail)->car; | 12450 | tem = XCAR (tail); |
| 12492 | if (CONSP (tem) && EQ (propelt, XCONS (tem)->car)) | 12451 | if (CONSP (tem) && EQ (propelt, XCAR (tem))) |
| 12493 | return ! NILP (XCONS (tem)->cdr); | 12452 | return ! NILP (XCDR (tem)); |
| 12494 | } | 12453 | } |
| 12495 | } | 12454 | } |
| 12455 | |||
| 12496 | return 0; | 12456 | return 0; |
| 12497 | } | 12457 | } |
| 12498 | 12458 | ||
| @@ -12505,9 +12465,6 @@ invisible_ellipsis_p (propval, list) | |||
| 12505 | void | 12465 | void |
| 12506 | syms_of_xdisp () | 12466 | syms_of_xdisp () |
| 12507 | { | 12467 | { |
| 12508 | Vresize_mini_config = Qnil; | ||
| 12509 | staticpro (&Vresize_mini_config); | ||
| 12510 | |||
| 12511 | Vwith_echo_area_save_vector = Qnil; | 12468 | Vwith_echo_area_save_vector = Qnil; |
| 12512 | staticpro (&Vwith_echo_area_save_vector); | 12469 | staticpro (&Vwith_echo_area_save_vector); |
| 12513 | 12470 | ||