diff options
| author | Joakim Verona | 2011-11-09 14:05:54 +0100 |
|---|---|---|
| committer | Joakim Verona | 2011-11-09 14:05:54 +0100 |
| commit | c8d4b74cfa26762d34fd1703a07463008b32be16 (patch) | |
| tree | 6610ac356d47e328bb1094d9f5a0dcc15ed5fb6a /src/window.c | |
| parent | 32db4845d5c433fd15c6665cbed169e5d8b94f05 (diff) | |
| parent | 2cffd68198c4d574f073ab238dc12b1221005eab (diff) | |
| download | emacs-c8d4b74cfa26762d34fd1703a07463008b32be16.tar.gz emacs-c8d4b74cfa26762d34fd1703a07463008b32be16.zip | |
upstream
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 113 |
1 files changed, 65 insertions, 48 deletions
diff --git a/src/window.c b/src/window.c index 078b39cc2f1..b21671b4153 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -541,27 +541,34 @@ selected one. */) | |||
| 541 | return decode_window (window)->use_time; | 541 | return decode_window (window)->use_time; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0, | 544 | DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, |
| 545 | doc: /* Return the total number of lines of window WINDOW. | 545 | doc: /* Return the total height, in lines, of window WINDOW. |
| 546 | If WINDOW is omitted or nil, it defaults to the selected window. | 546 | If WINDOW is omitted or nil, it defaults to the selected window. |
| 547 | 547 | ||
| 548 | The return value includes WINDOW's mode line and header line, if any. | 548 | The return value includes the mode line and header line, if any. |
| 549 | If WINDOW is internal, the return value is the sum of the total number | 549 | If WINDOW is an internal window, the total height is the height |
| 550 | of lines of WINDOW's child windows if these are vertically combined | 550 | of the screen areas spanned by its children. |
| 551 | and the height of WINDOW's first child otherwise. | 551 | |
| 552 | 552 | On a graphical display, this total height is reported as an | |
| 553 | Optional argument HORIZONTAL non-nil means return the total number of | 553 | integer multiple of the default character height. */) |
| 554 | columns of WINDOW. In this case the return value includes any vertical | 554 | (Lisp_Object window) |
| 555 | dividers or scrollbars of WINDOW. If WINDOW is internal, the return | ||
| 556 | value is the sum of the total number of columns of WINDOW's child | ||
| 557 | windows if they are horizontally combined and the width of WINDOW's | ||
| 558 | first child otherwise. */) | ||
| 559 | (Lisp_Object window, Lisp_Object horizontal) | ||
| 560 | { | 555 | { |
| 561 | if (NILP (horizontal)) | 556 | return decode_any_window (window)->total_lines; |
| 562 | return decode_any_window (window)->total_lines; | 557 | } |
| 563 | else | 558 | |
| 564 | return decode_any_window (window)->total_cols; | 559 | DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, |
| 560 | doc: /* Return the total width, in columns, of window WINDOW. | ||
| 561 | If WINDOW is omitted or nil, it defaults to the selected window. | ||
| 562 | |||
| 563 | The return value includes any vertical dividers or scroll bars | ||
| 564 | belonging to WINDOW. If WINDOW is an internal window, the total width | ||
| 565 | is the width of the screen areas spanned by its children. | ||
| 566 | |||
| 567 | On a graphical display, this total width is reported as an | ||
| 568 | integer multiple of the default character width. */) | ||
| 569 | (Lisp_Object window) | ||
| 570 | { | ||
| 571 | return decode_any_window (window)->total_cols; | ||
| 565 | } | 572 | } |
| 566 | 573 | ||
| 567 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, | 574 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, |
| @@ -594,6 +601,10 @@ If WINDOW is omitted or nil, it defaults to the selected window. */) | |||
| 594 | 601 | ||
| 595 | DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, | 602 | DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, |
| 596 | doc: /* Return left column of window WINDOW. | 603 | doc: /* Return left column of window WINDOW. |
| 604 | This is the distance, in columns, between the left edge of WINDOW and | ||
| 605 | the left edge of the frame's window area. For instance, the return | ||
| 606 | value is 0 if there is no window to the left of WINDOW. | ||
| 607 | |||
| 597 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 608 | If WINDOW is omitted or nil, it defaults to the selected window. */) |
| 598 | (Lisp_Object window) | 609 | (Lisp_Object window) |
| 599 | { | 610 | { |
| @@ -602,6 +613,10 @@ If WINDOW is omitted or nil, it defaults to the selected window. */) | |||
| 602 | 613 | ||
| 603 | DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, | 614 | DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, |
| 604 | doc: /* Return top line of window WINDOW. | 615 | doc: /* Return top line of window WINDOW. |
| 616 | This is the distance, in lines, between the top of WINDOW and the top | ||
| 617 | of the frame's window area. For instance, the return value is 0 if | ||
| 618 | there is no window above WINDOW. | ||
| 619 | |||
| 605 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 620 | If WINDOW is omitted or nil, it defaults to the selected window. */) |
| 606 | (Lisp_Object window) | 621 | (Lisp_Object window) |
| 607 | { | 622 | { |
| @@ -657,34 +672,34 @@ window_body_cols (struct window *w) | |||
| 657 | return width; | 672 | return width; |
| 658 | } | 673 | } |
| 659 | 674 | ||
| 660 | DEFUN ("window-body-size", Fwindow_body_size, Swindow_body_size, 0, 2, 0, | 675 | DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0, |
| 661 | doc: /* Return the number of lines or columns of WINDOW's body. | 676 | doc: /* Return the height, in lines, of WINDOW's text area. |
| 662 | WINDOW must be a live window and defaults to the selected one. | 677 | If WINDOW is omitted or nil, it defaults to the selected window. |
| 678 | Signal an error if the window is not live. | ||
| 663 | 679 | ||
| 664 | If the optional argument HORIZONTAL is omitted or nil, the function | 680 | The returned height does not include the mode line or header line. |
| 665 | returns the number of WINDOW's lines, excluding the mode line and | 681 | On a graphical display, the height is expressed as an integer multiple |
| 666 | header line, if any. | 682 | of the default character height. If a line at the bottom of the text |
| 667 | 683 | area is only partially visible, that counts as a whole line; to | |
| 668 | If HORIZONTAL is non-nil, the function returns the number of columns | 684 | exclude partially-visible lines, use `window-text-height'. */) |
| 669 | excluding any vertical dividers or scroll bars owned by WINDOW. On a | 685 | (Lisp_Object window) |
| 670 | window-system the return value also excludes the number of columns | ||
| 671 | used for WINDOW's fringes or display margins. | ||
| 672 | |||
| 673 | Note that the return value is measured in canonical units, i.e. for | ||
| 674 | the default frame's face. If the window shows some characters with | ||
| 675 | non-default face, e.g., if the font of some characters is larger or | ||
| 676 | smaller than the default font, the value returned by this function | ||
| 677 | will not match the actual number of lines or characters per line | ||
| 678 | shown in the window. To get the actual number of columns and lines, | ||
| 679 | use `posn-at-point'. */) | ||
| 680 | (Lisp_Object window, Lisp_Object horizontal) | ||
| 681 | { | 686 | { |
| 682 | struct window *w = decode_any_window (window); | 687 | struct window *w = decode_window (window); |
| 688 | return make_number (window_body_lines (w)); | ||
| 689 | } | ||
| 683 | 690 | ||
| 684 | if (NILP (horizontal)) | 691 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, |
| 685 | return make_number (window_body_lines (w)); | 692 | doc: /* Return the width, in columns, of WINDOW's text area. |
| 686 | else | 693 | If WINDOW is omitted or nil, it defaults to the selected window. |
| 687 | return make_number (window_body_cols (w)); | 694 | Signal an error if the window is not live. |
| 695 | |||
| 696 | The return value does not include any vertical dividers, fringe or | ||
| 697 | marginal areas, or scroll bars. On a graphical display, the width is | ||
| 698 | expressed as an integer multiple of the default character width. */) | ||
| 699 | (Lisp_Object window) | ||
| 700 | { | ||
| 701 | struct window *w = decode_window (window); | ||
| 702 | return make_number (window_body_cols (w)); | ||
| 688 | } | 703 | } |
| 689 | 704 | ||
| 690 | DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | 705 | DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, |
| @@ -5223,10 +5238,10 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5223 | DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, | 5238 | DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, |
| 5224 | 0, 1, 0, | 5239 | 0, 1, 0, |
| 5225 | doc: /* Return the height in lines of the text display area of WINDOW. | 5240 | doc: /* Return the height in lines of the text display area of WINDOW. |
| 5226 | WINDOW defaults to the selected window. | 5241 | If WINDOW is omitted or nil, it defaults to the selected window. |
| 5227 | 5242 | ||
| 5228 | The return value does not include the mode line, any header line, nor | 5243 | The returned height does not include the mode line, any header line, |
| 5229 | any partial-height lines in the text display area. */) | 5244 | nor any partial-height lines at the bottom of the text area. */) |
| 5230 | (Lisp_Object window) | 5245 | (Lisp_Object window) |
| 5231 | { | 5246 | { |
| 5232 | struct window *w = decode_window (window); | 5247 | struct window *w = decode_window (window); |
| @@ -6588,14 +6603,16 @@ function `window-nest' and altered by the function `set-window-nest'. */); | |||
| 6588 | defsubr (&Swindow_use_time); | 6603 | defsubr (&Swindow_use_time); |
| 6589 | defsubr (&Swindow_top_line); | 6604 | defsubr (&Swindow_top_line); |
| 6590 | defsubr (&Swindow_left_column); | 6605 | defsubr (&Swindow_left_column); |
| 6591 | defsubr (&Swindow_total_size); | 6606 | defsubr (&Swindow_total_height); |
| 6607 | defsubr (&Swindow_total_width); | ||
| 6592 | defsubr (&Swindow_normal_size); | 6608 | defsubr (&Swindow_normal_size); |
| 6593 | defsubr (&Swindow_new_total); | 6609 | defsubr (&Swindow_new_total); |
| 6594 | defsubr (&Swindow_new_normal); | 6610 | defsubr (&Swindow_new_normal); |
| 6595 | defsubr (&Sset_window_new_total); | 6611 | defsubr (&Sset_window_new_total); |
| 6596 | defsubr (&Sset_window_new_normal); | 6612 | defsubr (&Sset_window_new_normal); |
| 6597 | defsubr (&Swindow_resize_apply); | 6613 | defsubr (&Swindow_resize_apply); |
| 6598 | defsubr (&Swindow_body_size); | 6614 | defsubr (&Swindow_body_height); |
| 6615 | defsubr (&Swindow_body_width); | ||
| 6599 | defsubr (&Swindow_hscroll); | 6616 | defsubr (&Swindow_hscroll); |
| 6600 | defsubr (&Sset_window_hscroll); | 6617 | defsubr (&Sset_window_hscroll); |
| 6601 | defsubr (&Swindow_redisplay_end_trigger); | 6618 | defsubr (&Swindow_redisplay_end_trigger); |