diff options
| author | Kenichi Handa | 2004-04-16 12:51:06 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-04-16 12:51:06 +0000 |
| commit | 6b61353c0a0320ee15bb6488149735381fed62ec (patch) | |
| tree | e69adba60e504a5a37beb556ad70084de88a7aab /src/window.c | |
| parent | dc6a28319312fe81f7a1015e363174022313f0bd (diff) | |
| download | emacs-6b61353c0a0320ee15bb6488149735381fed62ec.tar.gz emacs-6b61353c0a0320ee15bb6488149735381fed62ec.zip | |
Sync to HEAD
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 333 |
1 files changed, 274 insertions, 59 deletions
diff --git a/src/window.c b/src/window.c index fd35ac8a9d8..47bbf0806ee 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -279,6 +279,7 @@ make_window () | |||
| 279 | p->fringes_outside_margins = Qnil; | 279 | p->fringes_outside_margins = Qnil; |
| 280 | p->scroll_bar_width = Qnil; | 280 | p->scroll_bar_width = Qnil; |
| 281 | p->vertical_scroll_bar_type = Qt; | 281 | p->vertical_scroll_bar_type = Qt; |
| 282 | p->overlay_arrow_bitmap = 0; | ||
| 282 | 283 | ||
| 283 | Vwindow_list = Qnil; | 284 | Vwindow_list = Qnil; |
| 284 | return val; | 285 | return val; |
| @@ -305,7 +306,8 @@ used by that frame. */) | |||
| 305 | } | 306 | } |
| 306 | 307 | ||
| 307 | DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, | 308 | DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, |
| 308 | doc: /* Returns non-nil if WINDOW is a minibuffer window. */) | 309 | doc: /* Returns non-nil if WINDOW is a minibuffer window. |
| 310 | WINDOW defaults to the selected window. */) | ||
| 309 | (window) | 311 | (window) |
| 310 | Lisp_Object window; | 312 | Lisp_Object window; |
| 311 | { | 313 | { |
| @@ -392,6 +394,17 @@ decode_window (window) | |||
| 392 | return XWINDOW (window); | 394 | return XWINDOW (window); |
| 393 | } | 395 | } |
| 394 | 396 | ||
| 397 | static struct window * | ||
| 398 | decode_any_window (window) | ||
| 399 | register Lisp_Object window; | ||
| 400 | { | ||
| 401 | if (NILP (window)) | ||
| 402 | return XWINDOW (selected_window); | ||
| 403 | |||
| 404 | CHECK_WINDOW (window); | ||
| 405 | return XWINDOW (window); | ||
| 406 | } | ||
| 407 | |||
| 395 | DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, | 408 | DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, |
| 396 | doc: /* Return the buffer that WINDOW is displaying. */) | 409 | doc: /* Return the buffer that WINDOW is displaying. */) |
| 397 | (window) | 410 | (window) |
| @@ -405,7 +418,7 @@ DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, | |||
| 405 | (window) | 418 | (window) |
| 406 | Lisp_Object window; | 419 | Lisp_Object window; |
| 407 | { | 420 | { |
| 408 | return decode_window (window)->total_lines; | 421 | return decode_any_window (window)->total_lines; |
| 409 | } | 422 | } |
| 410 | 423 | ||
| 411 | DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0, | 424 | DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0, |
| @@ -416,7 +429,7 @@ use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */) | |||
| 416 | (window) | 429 | (window) |
| 417 | Lisp_Object window; | 430 | Lisp_Object window; |
| 418 | { | 431 | { |
| 419 | return make_number (window_box_text_cols (decode_window (window))); | 432 | return make_number (window_box_text_cols (decode_any_window (window))); |
| 420 | } | 433 | } |
| 421 | 434 | ||
| 422 | DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | 435 | DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, |
| @@ -489,7 +502,7 @@ To get the edges of the actual text area, use `window-inside-edges'. */) | |||
| 489 | (window) | 502 | (window) |
| 490 | Lisp_Object window; | 503 | Lisp_Object window; |
| 491 | { | 504 | { |
| 492 | register struct window *w = decode_window (window); | 505 | register struct window *w = decode_any_window (window); |
| 493 | 506 | ||
| 494 | return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), | 507 | return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), |
| 495 | Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), | 508 | Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), |
| @@ -509,7 +522,7 @@ To get the edges of the actual text area, use `window-inside-pixel-edges'. */) | |||
| 509 | (window) | 522 | (window) |
| 510 | Lisp_Object window; | 523 | Lisp_Object window; |
| 511 | { | 524 | { |
| 512 | register struct window *w = decode_window (window); | 525 | register struct window *w = decode_any_window (window); |
| 513 | 526 | ||
| 514 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), | 527 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), |
| 515 | Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), | 528 | Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), |
| @@ -528,7 +541,7 @@ display margins, fringes, header line, and/or mode line. */) | |||
| 528 | (window) | 541 | (window) |
| 529 | Lisp_Object window; | 542 | Lisp_Object window; |
| 530 | { | 543 | { |
| 531 | register struct window *w = decode_window (window); | 544 | register struct window *w = decode_any_window (window); |
| 532 | 545 | ||
| 533 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) | 546 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) |
| 534 | + WINDOW_LEFT_MARGIN_COLS (w) | 547 | + WINDOW_LEFT_MARGIN_COLS (w) |
| @@ -552,7 +565,7 @@ display margins, fringes, header line, and/or mode line. */) | |||
| 552 | (window) | 565 | (window) |
| 553 | Lisp_Object window; | 566 | Lisp_Object window; |
| 554 | { | 567 | { |
| 555 | register struct window *w = decode_window (window); | 568 | register struct window *w = decode_any_window (window); |
| 556 | 569 | ||
| 557 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) | 570 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) |
| 558 | + WINDOW_LEFT_MARGIN_WIDTH (w) | 571 | + WINDOW_LEFT_MARGIN_WIDTH (w) |
| @@ -632,8 +645,7 @@ coordinates_in_window (w, x, y) | |||
| 632 | scroll bars. */ | 645 | scroll bars. */ |
| 633 | 646 | ||
| 634 | if (WINDOW_WANTS_MODELINE_P (w) | 647 | if (WINDOW_WANTS_MODELINE_P (w) |
| 635 | && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w) | 648 | && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) |
| 636 | && *y < bottom_y) | ||
| 637 | { | 649 | { |
| 638 | part = ON_MODE_LINE; | 650 | part = ON_MODE_LINE; |
| 639 | 651 | ||
| @@ -662,7 +674,6 @@ coordinates_in_window (w, x, y) | |||
| 662 | } | 674 | } |
| 663 | 675 | ||
| 664 | if (WINDOW_WANTS_HEADER_LINE_P (w) | 676 | if (WINDOW_WANTS_HEADER_LINE_P (w) |
| 665 | && *y >= top_y | ||
| 666 | && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) | 677 | && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) |
| 667 | { | 678 | { |
| 668 | part = ON_HEADER_LINE; | 679 | part = ON_HEADER_LINE; |
| @@ -708,7 +719,7 @@ coordinates_in_window (w, x, y) | |||
| 708 | ? (*x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) | 719 | ? (*x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) |
| 709 | : (*x < left_x + lmargin_width))) | 720 | : (*x < left_x + lmargin_width))) |
| 710 | { | 721 | { |
| 711 | *x -= x0; | 722 | *x -= left_x; |
| 712 | if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) | 723 | if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) |
| 713 | *x -= WINDOW_LEFT_FRINGE_WIDTH (w); | 724 | *x -= WINDOW_LEFT_FRINGE_WIDTH (w); |
| 714 | *y -= top_y; | 725 | *y -= top_y; |
| @@ -773,7 +784,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ | |||
| 773 | int x, y; | 784 | int x, y; |
| 774 | Lisp_Object lx, ly; | 785 | Lisp_Object lx, ly; |
| 775 | 786 | ||
| 776 | CHECK_LIVE_WINDOW (window); | 787 | CHECK_WINDOW (window); |
| 777 | w = XWINDOW (window); | 788 | w = XWINDOW (window); |
| 778 | f = XFRAME (w->frame); | 789 | f = XFRAME (w->frame); |
| 779 | CHECK_CONS (coordinates); | 790 | CHECK_CONS (coordinates); |
| @@ -1831,6 +1842,7 @@ enum window_loop | |||
| 1831 | DELETE_BUFFER_WINDOWS, /* Arg is buffer */ | 1842 | DELETE_BUFFER_WINDOWS, /* Arg is buffer */ |
| 1832 | GET_LARGEST_WINDOW, | 1843 | GET_LARGEST_WINDOW, |
| 1833 | UNSHOW_BUFFER, /* Arg is buffer */ | 1844 | UNSHOW_BUFFER, /* Arg is buffer */ |
| 1845 | REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ | ||
| 1834 | CHECK_ALL_WINDOWS | 1846 | CHECK_ALL_WINDOWS |
| 1835 | }; | 1847 | }; |
| 1836 | 1848 | ||
| @@ -2029,6 +2041,17 @@ window_loop (type, obj, mini, frames) | |||
| 2029 | } | 2041 | } |
| 2030 | break; | 2042 | break; |
| 2031 | 2043 | ||
| 2044 | case REDISPLAY_BUFFER_WINDOWS: | ||
| 2045 | if (EQ (w->buffer, obj)) | ||
| 2046 | { | ||
| 2047 | mark_window_display_accurate (window, 0); | ||
| 2048 | w->update_mode_line = Qt; | ||
| 2049 | XBUFFER (obj)->prevent_redisplay_optimizations_p = 1; | ||
| 2050 | ++update_mode_lines; | ||
| 2051 | best_window = window; | ||
| 2052 | } | ||
| 2053 | break; | ||
| 2054 | |||
| 2032 | /* Check for a window that has a killed buffer. */ | 2055 | /* Check for a window that has a killed buffer. */ |
| 2033 | case CHECK_ALL_WINDOWS: | 2056 | case CHECK_ALL_WINDOWS: |
| 2034 | if (! NILP (w->buffer) | 2057 | if (! NILP (w->buffer) |
| @@ -2055,6 +2078,7 @@ check_all_windows () | |||
| 2055 | 2078 | ||
| 2056 | DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, | 2079 | DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
| 2057 | doc: /* Return the window least recently selected or used for display. | 2080 | doc: /* Return the window least recently selected or used for display. |
| 2081 | Return a full-width window if possible. | ||
| 2058 | If optional argument FRAME is `visible', search all visible frames. | 2082 | If optional argument FRAME is `visible', search all visible frames. |
| 2059 | If FRAME is 0, search all visible and iconified frames. | 2083 | If FRAME is 0, search all visible and iconified frames. |
| 2060 | If FRAME is t, search all frames. | 2084 | If FRAME is t, search all frames. |
| @@ -2538,6 +2562,118 @@ adjust_window_margins (w) | |||
| 2538 | return 1; | 2562 | return 1; |
| 2539 | } | 2563 | } |
| 2540 | 2564 | ||
| 2565 | /* Calculate new sizes for windows in the list FORWARD when the window size | ||
| 2566 | goes from TOTAL to SIZE. TOTAL must be greater than SIZE. | ||
| 2567 | The number of windows in FORWARD is NCHILDREN, and the number that | ||
| 2568 | can shrink is SHRINKABLE. | ||
| 2569 | The minimum size a window can have is MIN_SIZE. | ||
| 2570 | If we are shrinking fixed windows, RESIZE_FIXED_P is non-zero. | ||
| 2571 | If we are shrinking columns, WIDTH_P is non-zero, otherwise we are | ||
| 2572 | shrinking rows. | ||
| 2573 | |||
| 2574 | This function returns an allocated array of new sizes that the caller | ||
| 2575 | must free. The size -1 means the window is fixed and RESIZE_FIXED_P | ||
| 2576 | is zero. Array index 0 refers to the first window in FORWARD, 1 to | ||
| 2577 | the second, and so on. | ||
| 2578 | |||
| 2579 | This function tries to keep windows at least at the minimum size | ||
| 2580 | and resize other windows before it resizes any window to zero (i.e. | ||
| 2581 | delete that window). | ||
| 2582 | |||
| 2583 | Windows are resized proportional to their size, so bigger windows | ||
| 2584 | shrink more than smaller windows. */ | ||
| 2585 | static int * | ||
| 2586 | shrink_windows (total, size, nchildren, shrinkable, | ||
| 2587 | min_size, resize_fixed_p, forward, width_p) | ||
| 2588 | int total, size, nchildren, shrinkable, min_size; | ||
| 2589 | int resize_fixed_p, width_p; | ||
| 2590 | Lisp_Object forward; | ||
| 2591 | { | ||
| 2592 | int available_resize = 0; | ||
| 2593 | int *new_sizes; | ||
| 2594 | struct window *c; | ||
| 2595 | Lisp_Object child; | ||
| 2596 | int smallest = total; | ||
| 2597 | int total_removed = 0; | ||
| 2598 | int total_shrink = total - size; | ||
| 2599 | int i; | ||
| 2600 | |||
| 2601 | new_sizes = xmalloc (sizeof (*new_sizes) * nchildren); | ||
| 2602 | |||
| 2603 | for (i = 0, child = forward; !NILP (child); child = c->next, ++i) | ||
| 2604 | { | ||
| 2605 | int child_size; | ||
| 2606 | |||
| 2607 | c = XWINDOW (child); | ||
| 2608 | child_size = width_p ? XINT (c->total_cols) : XINT (c->total_lines); | ||
| 2609 | |||
| 2610 | if (! resize_fixed_p && window_fixed_size_p (c, width_p, 0)) | ||
| 2611 | new_sizes[i] = -1; | ||
| 2612 | else | ||
| 2613 | { | ||
| 2614 | new_sizes[i] = child_size; | ||
| 2615 | if (child_size > min_size) | ||
| 2616 | available_resize += child_size - min_size; | ||
| 2617 | } | ||
| 2618 | } | ||
| 2619 | /* We might need to shrink some windows to zero. Find the smallest | ||
| 2620 | windows and set them to 0 until we can fulfil the new size. */ | ||
| 2621 | |||
| 2622 | while (shrinkable > 1 && size + available_resize < total) | ||
| 2623 | { | ||
| 2624 | for (i = 0; i < nchildren; ++i) | ||
| 2625 | if (new_sizes[i] > 0 && smallest > new_sizes[i]) | ||
| 2626 | smallest = new_sizes[i]; | ||
| 2627 | |||
| 2628 | for (i = 0; i < nchildren; ++i) | ||
| 2629 | if (new_sizes[i] == smallest) | ||
| 2630 | { | ||
| 2631 | /* Resize this window down to zero. */ | ||
| 2632 | new_sizes[i] = 0; | ||
| 2633 | if (smallest > min_size) | ||
| 2634 | available_resize -= smallest - min_size; | ||
| 2635 | available_resize += smallest; | ||
| 2636 | --shrinkable; | ||
| 2637 | total_removed += smallest; | ||
| 2638 | |||
| 2639 | /* Out of for, just remove one window at the time and | ||
| 2640 | check again if we have enough space. */ | ||
| 2641 | break; | ||
| 2642 | } | ||
| 2643 | } | ||
| 2644 | |||
| 2645 | /* Now, calculate the new sizes. Try to shrink each window | ||
| 2646 | proportional to its size. */ | ||
| 2647 | for (i = 0; i < nchildren; ++i) | ||
| 2648 | { | ||
| 2649 | if (new_sizes[i] > min_size) | ||
| 2650 | { | ||
| 2651 | int to_shrink = total_shrink*new_sizes[i]/total; | ||
| 2652 | if (new_sizes[i] - to_shrink < min_size) | ||
| 2653 | to_shrink = new_sizes[i] - min_size; | ||
| 2654 | new_sizes[i] -= to_shrink; | ||
| 2655 | total_removed += to_shrink; | ||
| 2656 | } | ||
| 2657 | } | ||
| 2658 | |||
| 2659 | /* Any reminder due to rounding, we just subtract from windows | ||
| 2660 | that are left and still can be shrunk. */ | ||
| 2661 | while (total_shrink > total_removed) | ||
| 2662 | { | ||
| 2663 | for (i = 0; i < nchildren; ++i) | ||
| 2664 | if (new_sizes[i] > min_size) | ||
| 2665 | { | ||
| 2666 | --new_sizes[i]; | ||
| 2667 | ++total_removed; | ||
| 2668 | |||
| 2669 | /* Out of for, just shrink one window at the time and | ||
| 2670 | check again if we have enough space. */ | ||
| 2671 | break; | ||
| 2672 | } | ||
| 2673 | } | ||
| 2674 | |||
| 2675 | return new_sizes; | ||
| 2676 | } | ||
| 2541 | 2677 | ||
| 2542 | /* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set | 2678 | /* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set |
| 2543 | WINDOW's width. Resize WINDOW's children, if any, so that they | 2679 | WINDOW's width. Resize WINDOW's children, if any, so that they |
| @@ -2641,6 +2777,7 @@ size_window (window, size, width_p, nodelete_p) | |||
| 2641 | int fixed_size, each, extra, n; | 2777 | int fixed_size, each, extra, n; |
| 2642 | int resize_fixed_p, nfixed; | 2778 | int resize_fixed_p, nfixed; |
| 2643 | int last_pos, first_pos, nchildren, total; | 2779 | int last_pos, first_pos, nchildren, total; |
| 2780 | int *new_sizes = NULL; | ||
| 2644 | 2781 | ||
| 2645 | /* Determine the fixed-size portion of the this window, and the | 2782 | /* Determine the fixed-size portion of the this window, and the |
| 2646 | number of child windows. */ | 2783 | number of child windows. */ |
| @@ -2665,16 +2802,22 @@ size_window (window, size, width_p, nodelete_p) | |||
| 2665 | windows. */ | 2802 | windows. */ |
| 2666 | resize_fixed_p = nfixed == nchildren || size < fixed_size; | 2803 | resize_fixed_p = nfixed == nchildren || size < fixed_size; |
| 2667 | 2804 | ||
| 2668 | /* Compute how many lines/columns to add to each child. The | 2805 | /* Compute how many lines/columns to add/remove to each child. The |
| 2669 | value of extra takes care of rounding errors. */ | 2806 | value of extra takes care of rounding errors. */ |
| 2670 | n = resize_fixed_p ? nchildren : nchildren - nfixed; | 2807 | n = resize_fixed_p ? nchildren : nchildren - nfixed; |
| 2671 | each = (size - total) / n; | 2808 | if (size < total && n > 1) |
| 2672 | extra = (size - total) - n * each; | 2809 | new_sizes = shrink_windows (total, size, nchildren, n, min_size, |
| 2810 | resize_fixed_p, *forward, width_p); | ||
| 2811 | else | ||
| 2812 | { | ||
| 2813 | each = (size - total) / n; | ||
| 2814 | extra = (size - total) - n * each; | ||
| 2815 | } | ||
| 2673 | 2816 | ||
| 2674 | /* Compute new children heights and edge positions. */ | 2817 | /* Compute new children heights and edge positions. */ |
| 2675 | first_pos = width_p ? XINT (w->left_col) : XINT (w->top_line); | 2818 | first_pos = width_p ? XINT (w->left_col) : XINT (w->top_line); |
| 2676 | last_pos = first_pos; | 2819 | last_pos = first_pos; |
| 2677 | for (child = *forward; !NILP (child); child = c->next) | 2820 | for (n = 0, child = *forward; !NILP (child); child = c->next, ++n) |
| 2678 | { | 2821 | { |
| 2679 | int new_size, old_size; | 2822 | int new_size, old_size; |
| 2680 | 2823 | ||
| @@ -2692,7 +2835,7 @@ size_window (window, size, width_p, nodelete_p) | |||
| 2692 | /* If this child can be resized, do it. */ | 2835 | /* If this child can be resized, do it. */ |
| 2693 | if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) | 2836 | if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) |
| 2694 | { | 2837 | { |
| 2695 | new_size = old_size + each + extra; | 2838 | new_size = new_sizes ? new_sizes[n] : old_size + each + extra; |
| 2696 | extra = 0; | 2839 | extra = 0; |
| 2697 | } | 2840 | } |
| 2698 | 2841 | ||
| @@ -2703,9 +2846,11 @@ size_window (window, size, width_p, nodelete_p) | |||
| 2703 | 2846 | ||
| 2704 | /* Remember the bottom/right edge position of this child; it | 2847 | /* Remember the bottom/right edge position of this child; it |
| 2705 | will be used to set the top/left edge of the next child. */ | 2848 | will be used to set the top/left edge of the next child. */ |
| 2706 | last_pos += new_size; | 2849 | last_pos += new_size; |
| 2707 | } | 2850 | } |
| 2708 | 2851 | ||
| 2852 | if (new_sizes) xfree (new_sizes); | ||
| 2853 | |||
| 2709 | /* We should have covered the parent exactly with child windows. */ | 2854 | /* We should have covered the parent exactly with child windows. */ |
| 2710 | xassert (size == last_pos - first_pos); | 2855 | xassert (size == last_pos - first_pos); |
| 2711 | 2856 | ||
| @@ -2853,6 +2998,9 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) | |||
| 2853 | 2998 | ||
| 2854 | /* This may call adjust_window_margins three times, so | 2999 | /* This may call adjust_window_margins three times, so |
| 2855 | temporarily disable window margins. */ | 3000 | temporarily disable window margins. */ |
| 3001 | Lisp_Object save_left = w->left_margin_cols; | ||
| 3002 | Lisp_Object save_right = w->right_margin_cols; | ||
| 3003 | |||
| 2856 | w->left_margin_cols = w->right_margin_cols = Qnil; | 3004 | w->left_margin_cols = w->right_margin_cols = Qnil; |
| 2857 | 3005 | ||
| 2858 | Fset_window_fringes (window, | 3006 | Fset_window_fringes (window, |
| @@ -2863,6 +3011,9 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) | |||
| 2863 | b->scroll_bar_width, | 3011 | b->scroll_bar_width, |
| 2864 | b->vertical_scroll_bar_type, Qnil); | 3012 | b->vertical_scroll_bar_type, Qnil); |
| 2865 | 3013 | ||
| 3014 | w->left_margin_cols = save_left; | ||
| 3015 | w->right_margin_cols = save_right; | ||
| 3016 | |||
| 2866 | Fset_window_margins (window, | 3017 | Fset_window_margins (window, |
| 2867 | b->left_margin_cols, b->right_margin_cols); | 3018 | b->left_margin_cols, b->right_margin_cols); |
| 2868 | } | 3019 | } |
| @@ -3118,9 +3269,10 @@ Returns the window displaying BUFFER. | |||
| 3118 | If `display-buffer-reuse-frames' is non-nil, and another frame is currently | 3269 | If `display-buffer-reuse-frames' is non-nil, and another frame is currently |
| 3119 | displaying BUFFER, then simply raise that frame. | 3270 | displaying BUFFER, then simply raise that frame. |
| 3120 | 3271 | ||
| 3121 | The variables `special-display-buffer-names', `special-display-regexps', | 3272 | The variables `special-display-buffer-names', |
| 3122 | `same-window-buffer-names', and `same-window-regexps' customize how certain | 3273 | `special-display-regexps', `same-window-buffer-names', and |
| 3123 | buffer names are handled. | 3274 | `same-window-regexps' customize how certain buffer names are handled. |
| 3275 | The latter two take effect only if NOT-THIS-WINDOW is t. | ||
| 3124 | 3276 | ||
| 3125 | If optional argument FRAME is `visible', search all visible frames. | 3277 | If optional argument FRAME is `visible', search all visible frames. |
| 3126 | If FRAME is 0, search all visible and iconified frames. | 3278 | If FRAME is 0, search all visible and iconified frames. |
| @@ -3303,6 +3455,52 @@ displayed. */) | |||
| 3303 | return display_buffer_1 (window); | 3455 | return display_buffer_1 (window); |
| 3304 | } | 3456 | } |
| 3305 | 3457 | ||
| 3458 | |||
| 3459 | DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update, | ||
| 3460 | 0, 1, 0, | ||
| 3461 | doc: /* Force redisplay of all windows. | ||
| 3462 | If optional arg OBJECT is a window, force redisplay of that window only. | ||
| 3463 | If OBJECT is a buffer or buffer name, force redisplay of all windows | ||
| 3464 | displaying that buffer. */) | ||
| 3465 | (object) | ||
| 3466 | Lisp_Object object; | ||
| 3467 | { | ||
| 3468 | if (NILP (object)) | ||
| 3469 | { | ||
| 3470 | windows_or_buffers_changed++; | ||
| 3471 | update_mode_lines++; | ||
| 3472 | return Qt; | ||
| 3473 | } | ||
| 3474 | |||
| 3475 | if (WINDOWP (object)) | ||
| 3476 | { | ||
| 3477 | struct window *w = XWINDOW (object); | ||
| 3478 | mark_window_display_accurate (object, 0); | ||
| 3479 | w->update_mode_line = Qt; | ||
| 3480 | if (BUFFERP (w->buffer)) | ||
| 3481 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | ||
| 3482 | ++update_mode_lines; | ||
| 3483 | return Qt; | ||
| 3484 | } | ||
| 3485 | |||
| 3486 | if (STRINGP (object)) | ||
| 3487 | object = Fget_buffer (object); | ||
| 3488 | if (BUFFERP (object) && !NILP (XBUFFER (object)->name)) | ||
| 3489 | { | ||
| 3490 | /* Walk all windows looking for buffer, and force update | ||
| 3491 | of each of those windows. */ | ||
| 3492 | |||
| 3493 | object = window_loop (REDISPLAY_BUFFER_WINDOWS, object, 0, Qvisible); | ||
| 3494 | return NILP (object) ? Qnil : Qt; | ||
| 3495 | } | ||
| 3496 | |||
| 3497 | /* If nothing suitable was found, just return. | ||
| 3498 | We could signal an error, but this feature will typically be used | ||
| 3499 | asynchronously in timers or process sentinels, so we don't. */ | ||
| 3500 | return Qnil; | ||
| 3501 | } | ||
| 3502 | |||
| 3503 | |||
| 3306 | void | 3504 | void |
| 3307 | temp_output_buffer_show (buf) | 3505 | temp_output_buffer_show (buf) |
| 3308 | register Lisp_Object buf; | 3506 | register Lisp_Object buf; |
| @@ -5719,38 +5917,32 @@ usage: (save-window-excursion BODY ...) */) | |||
| 5719 | DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, | 5917 | DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, |
| 5720 | 2, 3, 0, | 5918 | 2, 3, 0, |
| 5721 | doc: /* Set width of marginal areas of window WINDOW. | 5919 | doc: /* Set width of marginal areas of window WINDOW. |
| 5722 | If window is nil, set margins of the currently selected window. | 5920 | If WINDOW is nil, set margins of the currently selected window. |
| 5723 | First parameter LEFT-WIDTH specifies the number of character | 5921 | Second arg LEFT-WIDTH specifies the number of character cells to |
| 5724 | cells to reserve for the left marginal area. Second parameter | 5922 | reserve for the left marginal area. Optional third arg RIGHT-WIDTH |
| 5725 | RIGHT-WIDTH does the same for the right marginal area. | 5923 | does the same for the right marginal area. A nil width parameter |
| 5726 | A nil width parameter means no margin. */) | 5924 | means no margin. */) |
| 5727 | (window, left, right) | 5925 | (window, left, right) |
| 5728 | Lisp_Object window, left, right; | 5926 | Lisp_Object window, left, right; |
| 5729 | { | 5927 | { |
| 5730 | struct window *w = decode_window (window); | 5928 | struct window *w = decode_window (window); |
| 5731 | 5929 | ||
| 5732 | /* TODO: It doesn't make sense to use FLOATs here, since | 5930 | /* Translate negative or zero widths to nil. |
| 5733 | the rest of the code assumes they are integers. | 5931 | Margins that are too wide have to be checked elsewhere. */ |
| 5734 | So don't allow floats! ++KFS */ | ||
| 5735 | 5932 | ||
| 5736 | if (!NILP (left)) | 5933 | if (!NILP (left)) |
| 5737 | CHECK_NUMBER_OR_FLOAT (left); | 5934 | { |
| 5738 | if (!NILP (right)) | 5935 | CHECK_NUMBER (left); |
| 5739 | CHECK_NUMBER_OR_FLOAT (right); | 5936 | if (XINT (left) <= 0) |
| 5937 | left = Qnil; | ||
| 5938 | } | ||
| 5740 | 5939 | ||
| 5741 | /* Check widths < 0 and translate a zero width to nil. | 5940 | if (!NILP (right)) |
| 5742 | Margins that are too wide have to be checked elsewhere. */ | 5941 | { |
| 5743 | if ((INTEGERP (left) && XINT (left) < 0) | 5942 | CHECK_NUMBER (right); |
| 5744 | || (FLOATP (left) && XFLOAT_DATA (left) <= 0)) | 5943 | if (XINT (right) <= 0) |
| 5745 | XSETFASTINT (left, 0); | 5944 | right = Qnil; |
| 5746 | if (INTEGERP (left) && XFASTINT (left) == 0) | 5945 | } |
| 5747 | left = Qnil; | ||
| 5748 | |||
| 5749 | if ((INTEGERP (right) && XINT (right) < 0) | ||
| 5750 | || (FLOATP (right) && XFLOAT_DATA (right) <= 0)) | ||
| 5751 | XSETFASTINT (right, 0); | ||
| 5752 | if (INTEGERP (right) && XFASTINT (right) == 0) | ||
| 5753 | right = Qnil; | ||
| 5754 | 5946 | ||
| 5755 | if (!EQ (w->left_margin_cols, left) | 5947 | if (!EQ (w->left_margin_cols, left) |
| 5756 | || !EQ (w->right_margin_cols, right)) | 5948 | || !EQ (w->right_margin_cols, right)) |
| @@ -5790,15 +5982,17 @@ as nil. */) | |||
| 5790 | 5982 | ||
| 5791 | DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes, | 5983 | DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes, |
| 5792 | 2, 4, 0, | 5984 | 2, 4, 0, |
| 5793 | doc: /* Set width of fringes of window WINDOW. | 5985 | doc: /* Set the fringe widths of window WINDOW. |
| 5794 | 5986 | If WINDOW is nil, set the fringe widths of the currently selected | |
| 5795 | If window is nil, set fringes of the currently selected window. | 5987 | window. |
| 5796 | Second parameter LEFT-WIDTH specifies the number of pixels to reserve | 5988 | Second arg LEFT-WIDTH specifies the number of pixels to reserve for |
| 5797 | for the left fringe. Third parameter RIGHT-WIDTH does the same for | 5989 | the left fringe. Optional third arg RIGHT-WIDTH specifies the right |
| 5798 | the right fringe. Fourth parameter OUTSIDE-MARGINS non-nil specifies | 5990 | fringe width. If a fringe width arg is nil, that means to use the |
| 5799 | that fringes are drawn outside of the display margins; by default, fringes | 5991 | frame's default fringe width. Default fringe widths can be set with |
| 5800 | are drawn between display marginal areas and the text area. | 5992 | the command `set-fringe-style'. |
| 5801 | A nil width parameter means to use the frame's corresponding fringe width. */) | 5993 | If optional fourth arg OUTSIDE-MARGINS is non-nil, draw the fringes |
| 5994 | outside of the display margins. By default, fringes are drawn between | ||
| 5995 | display marginal areas and the text area. */) | ||
| 5802 | (window, left, right, outside_margins) | 5996 | (window, left, right, outside_margins) |
| 5803 | Lisp_Object window, left, right, outside_margins; | 5997 | Lisp_Object window, left, right, outside_margins; |
| 5804 | { | 5998 | { |
| @@ -5834,9 +6028,7 @@ DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, | |||
| 5834 | 0, 1, 0, | 6028 | 0, 1, 0, |
| 5835 | doc: /* Get width of fringes of window WINDOW. | 6029 | doc: /* Get width of fringes of window WINDOW. |
| 5836 | If WINDOW is omitted or nil, use the currently selected window. | 6030 | If WINDOW is omitted or nil, use the currently selected window. |
| 5837 | Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). | 6031 | Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) |
| 5838 | If a window specific fringe width is not set, its width will be returned | ||
| 5839 | as nil. */) | ||
| 5840 | (window) | 6032 | (window) |
| 5841 | Lisp_Object window; | 6033 | Lisp_Object window; |
| 5842 | { | 6034 | { |
| @@ -5861,7 +6053,8 @@ Second parameter WIDTH specifies the pixel width for the scroll bar; | |||
| 5861 | this is automatically adjusted to a multiple of the frame column width. | 6053 | this is automatically adjusted to a multiple of the frame column width. |
| 5862 | Third parameter VERTICAL-TYPE specifies the type of the vertical scroll | 6054 | Third parameter VERTICAL-TYPE specifies the type of the vertical scroll |
| 5863 | bar: left, right, or nil. | 6055 | bar: left, right, or nil. |
| 5864 | A width of nil and type of t means to use the frame's corresponding value. */) | 6056 | If WIDTH is nil, use the frame's scroll-bar width. |
| 6057 | If TYPE is t, use the frame's scroll-bar type. */) | ||
| 5865 | (window, width, vertical_type, horizontal_type) | 6058 | (window, width, vertical_type, horizontal_type) |
| 5866 | Lisp_Object window, width, vertical_type, horizontal_type; | 6059 | Lisp_Object window, width, vertical_type, horizontal_type; |
| 5867 | { | 6060 | { |
| @@ -5873,6 +6066,12 @@ A width of nil and type of t means to use the frame's corresponding value. */) | |||
| 5873 | if (XINT (width) == 0) | 6066 | if (XINT (width) == 0) |
| 5874 | vertical_type = Qnil; | 6067 | vertical_type = Qnil; |
| 5875 | 6068 | ||
| 6069 | if (!(EQ (vertical_type, Qnil) | ||
| 6070 | || EQ (vertical_type, Qleft) | ||
| 6071 | || EQ (vertical_type, Qright) | ||
| 6072 | || EQ (vertical_type, Qt))) | ||
| 6073 | error ("Invalid type of vertical scroll bar"); | ||
| 6074 | |||
| 5876 | if (!EQ (w->scroll_bar_width, width) | 6075 | if (!EQ (w->scroll_bar_width, width) |
| 5877 | || !EQ (w->vertical_scroll_bar_type, vertical_type)) | 6076 | || !EQ (w->vertical_scroll_bar_type, vertical_type)) |
| 5878 | { | 6077 | { |
| @@ -5896,7 +6095,9 @@ DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, | |||
| 5896 | 0, 1, 0, | 6095 | 0, 1, 0, |
| 5897 | doc: /* Get width and type of scroll bars of window WINDOW. | 6096 | doc: /* Get width and type of scroll bars of window WINDOW. |
| 5898 | If WINDOW is omitted or nil, use the currently selected window. | 6097 | If WINDOW is omitted or nil, use the currently selected window. |
| 5899 | Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). */) | 6098 | Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). |
| 6099 | If WIDTH is nil or TYPE is t, the window is using the frame's corresponding | ||
| 6100 | value. */) | ||
| 5900 | (window) | 6101 | (window) |
| 5901 | Lisp_Object window; | 6102 | Lisp_Object window; |
| 5902 | { | 6103 | { |
| @@ -6310,6 +6511,11 @@ In the latter case, FUNCTION is called with BUFFER as the first argument, | |||
| 6310 | followed by OTHER-ARGS--it can display BUFFER in any way it likes. | 6511 | followed by OTHER-ARGS--it can display BUFFER in any way it likes. |
| 6311 | All this is done by the function found in `special-display-function'. | 6512 | All this is done by the function found in `special-display-function'. |
| 6312 | 6513 | ||
| 6514 | If the specified frame parameters include (same-buffer . t), the | ||
| 6515 | buffer is displayed in the currently selected window. Otherwise, if | ||
| 6516 | they include (same-frame . t), the buffer is displayed in a new window | ||
| 6517 | in the currently selected frame. | ||
| 6518 | |||
| 6313 | If this variable appears \"not to work\", because you add a name to it | 6519 | If this variable appears \"not to work\", because you add a name to it |
| 6314 | but that buffer still appears in the selected window, look at the | 6520 | but that buffer still appears in the selected window, look at the |
| 6315 | values of `same-window-buffer-names' and `same-window-regexps'. | 6521 | values of `same-window-buffer-names' and `same-window-regexps'. |
| @@ -6330,6 +6536,11 @@ In the latter case, FUNCTION is called with the buffer as first argument, | |||
| 6330 | followed by OTHER-ARGS--it can display the buffer in any way it likes. | 6536 | followed by OTHER-ARGS--it can display the buffer in any way it likes. |
| 6331 | All this is done by the function found in `special-display-function'. | 6537 | All this is done by the function found in `special-display-function'. |
| 6332 | 6538 | ||
| 6539 | If the specified frame parameters include (same-buffer . t), the | ||
| 6540 | buffer is displayed in the currently selected window. Otherwise, if | ||
| 6541 | they include (same-frame . t), the buffer is displayed in a new window | ||
| 6542 | in the currently selected frame. | ||
| 6543 | |||
| 6333 | If this variable appears \"not to work\", because you add a regexp to it | 6544 | If this variable appears \"not to work\", because you add a regexp to it |
| 6334 | but the matching buffers still appear in the selected window, look at the | 6545 | but the matching buffers still appear in the selected window, look at the |
| 6335 | values of `same-window-buffer-names' and `same-window-regexps'. | 6546 | values of `same-window-buffer-names' and `same-window-regexps'. |
| @@ -6462,6 +6673,7 @@ This variable automatically becomes buffer-local when set. */); | |||
| 6462 | defsubr (&Sspecial_display_p); | 6673 | defsubr (&Sspecial_display_p); |
| 6463 | defsubr (&Ssame_window_p); | 6674 | defsubr (&Ssame_window_p); |
| 6464 | defsubr (&Sdisplay_buffer); | 6675 | defsubr (&Sdisplay_buffer); |
| 6676 | defsubr (&Sforce_window_update); | ||
| 6465 | defsubr (&Ssplit_window); | 6677 | defsubr (&Ssplit_window); |
| 6466 | defsubr (&Senlarge_window); | 6678 | defsubr (&Senlarge_window); |
| 6467 | defsubr (&Sshrink_window); | 6679 | defsubr (&Sshrink_window); |
| @@ -6510,3 +6722,6 @@ keys_of_window () | |||
| 6510 | initial_define_key (global_map, Ctl('L'), "recenter"); | 6722 | initial_define_key (global_map, Ctl('L'), "recenter"); |
| 6511 | initial_define_key (meta_map, 'r', "move-to-window-line"); | 6723 | initial_define_key (meta_map, 'r', "move-to-window-line"); |
| 6512 | } | 6724 | } |
| 6725 | |||
| 6726 | /* arch-tag: 90a9c576-0590-48f1-a5f1-6c96a0452d9f | ||
| 6727 | (do not change this comment) */ | ||