aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-11-09 22:37:25 +0800
committerChong Yidong2011-11-09 22:37:25 +0800
commitd2ad7ee1adefbfcb7b437ca3551de6d9cb405063 (patch)
treea279d9438813a795e96a31944f29d3846f19d0ae
parent2fbdc249e6c99b886f2beb38eefabf53b5c3848c (diff)
downloademacs-d2ad7ee1adefbfcb7b437ca3551de6d9cb405063.tar.gz
emacs-d2ad7ee1adefbfcb7b437ca3551de6d9cb405063.zip
Document window-pixel-edges etc in Lisp manual.
* doc/lispref/windows.texi (Window Sizes): Document window-pixel-edges, window-inside-pixel-edges. window-absolute-pixel-edges, and window-inside-absolute-pixel-edges. (Resizing Windows): shrink-window-if-larger-than-buffer works on non-full-width windows.
-rw-r--r--doc/lispref/ChangeLog8
-rw-r--r--doc/lispref/windows.texi187
2 files changed, 111 insertions, 84 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index cbe016ac96d..ca3a01d2808 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,11 @@
12011-11-09 Chong Yidong <cyd@gnu.org>
2
3 * windows.texi (Window Sizes): Document window-pixel-edges,
4 window-inside-pixel-edges. window-absolute-pixel-edges, and
5 window-inside-absolute-pixel-edges.
6 (Resizing Windows): shrink-window-if-larger-than-buffer works on
7 non-full-width windows.
8
12011-11-09 Martin Rudalics <rudalics@gmx.at> 92011-11-09 Martin Rudalics <rudalics@gmx.at>
2 10
3 * windows.texi (Resizing Windows): Rewrite documentation of 11 * windows.texi (Resizing Windows): Rewrite documentation of
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 52ac5a53900..cf5cfedf5af 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -375,13 +375,13 @@ Bars}). At the top of the window is an optional header line
375line (@pxref{Mode Line Format}). 375line (@pxref{Mode Line Format}).
376 376
377 Emacs provides several functions for finding the height and width of 377 Emacs provides several functions for finding the height and width of
378a window. Most of these functions report the values as integer 378a window. Except where noted, these heights and widths are reported
379multiples of the default character height and width. On a graphical 379as integer numbers of lines and columns respectively. On a graphical
380display, the actual screen size of this default height and width are 380display, each ``line'' and ``column'' actually corresponds to the
381those specified by the frame's default font. Hence, if the buffer 381height and width of a ``default'' character specified by the frame's
382contains text that is displayed in a different size, the reported 382default font. Thus, if a window is displaying text with a different
383height and width of the window may differ from the actual number of 383font or size, the reported height and width for that window may differ
384text lines or columns displayed in it. 384from the actual number of text lines or columns displayed within it.
385 385
386@cindex window height 386@cindex window height
387@cindex height of a window 387@cindex height of a window
@@ -534,6 +534,45 @@ can be resized in the desired direction. To determine that, use the
534function @code{window-resizable}. @xref{Resizing Windows}. 534function @code{window-resizable}. @xref{Resizing Windows}.
535@end defun 535@end defun
536 536
537 The following functions can be used to find a window's size and
538position in pixels. Though mostly useful on graphical displays, they
539can also be called on text-only terminals, where the screen area of
540each text character is taken to be ``one pixel''.
541
542@defun window-pixel-edges &optional window
543This function return a list of pixel coordinates for the edges of
544@var{window}. If @var{window} is omitted or @code{nil}, it defaults
545to the selected window.
546
547The return value has the form @code{(@var{left} @var{top} @var{right}
548@var{bottom})}. The list elements are, respectively, the X coordinate
549of the left window edge, the Y coordinate of the top edge, one more
550than the X coordinate of the right edge, and one more than the Y
551coordinate of the bottom edge. The origin coordinate @samp{(0,0)} is
552taken to be the top left corner of the frame's window area.
553
554These edge values include the space used by the window's scroll bar,
555margins, fringes, header line, and mode line, if any.
556@end defun
557
558@defun window-inside-pixel-edges &optional window
559This function is like @code{window-pixel-edges}, except that it
560returns the edge coordinates for the window's text area, rather than
561the edge coordinates for the window itself. @var{window} must specify
562a live window.
563@end defun
564
565@defun window-absolute-pixel-edges &optional window
566This function is like @code{window-pixel-edges}, except that it
567returns the edge coordinates relative to the top left corner of the
568display screen.
569@end defun
570
571@defun window-inside-absolute-pixel-edges &optional window
572This function is like @code{window-inside-pixel-edges}, except that it
573returns the edge coordinates relative to the top left corner of the
574display screen. @var{window} must specify a live window.
575@end defun
537 576
538@node Resizing Windows 577@node Resizing Windows
539@section Resizing Windows 578@section Resizing Windows
@@ -604,104 +643,85 @@ moving only the bottom or right edge of a window, use the function
604@c shrink-window, and shrink-window-horizontally are documented in the 643@c shrink-window, and shrink-window-horizontally are documented in the
605@c Emacs manual. They are not preferred for calling from Lisp. 644@c Emacs manual. They are not preferred for calling from Lisp.
606 645
607 The following function is useful for moving the line dividing two
608windows.
609
610@defun adjust-window-trailing-edge window delta &optional horizontal 646@defun adjust-window-trailing-edge window delta &optional horizontal
611This function moves @var{window}'s bottom edge by @var{delta} lines. 647This function moves @var{window}'s bottom edge by @var{delta} lines.
612Optional argument @var{horizontal} non-@code{nil} means to move 648If optional argument @var{horizontal} is non-@code{nil}, it instead
613@var{window}'s right edge by @var{delta} columns. The argument 649moves the right edge by @var{delta} columns. If @var{window} is
614@var{window} defaults to the selected window. 650@code{nil}, it defaults to the selected window.
615 651
616If @var{delta} is greater zero, this moves the edge downwards or to the 652A positive @var{delta} moves the edge downwards or to the right; a
617right. If @var{delta} is less than zero, this moves the edge upwards or 653negative @var{delta} moves it upwards or to the left. If the edge
618to the left. If the edge can't be moved by @var{delta} lines or columns, 654cannot be moved as far as specified by @var{delta}, this function
619it is moved as far as possible in the desired direction but no error is 655moves it as far as possible but does not signal a error.
620signaled.
621 656
622This function tries to resize windows adjacent to the edge that is 657This function tries to resize windows adjacent to the edge that is
623moved. Only if this is insufficient, it will also resize windows not 658moved. If this is not possible for some reason (e.g. if that adjacent
624adjacent to that edge. As a consequence, if you move an edge in one 659window is fixed-size), it may resize other windows.
625direction and back in the other direction by the same amount, the
626resulting window configuration will not be necessarily identical to the
627one before the first move. So if your intend to just resize
628@var{window}, you should not use this function but call
629@code{window-resize} (see above) instead.
630@end defun 660@end defun
631 661
662 The following commands resize windows in more specific ways. When
663called interactively, they act on the selected window.
664
632@deffn Command fit-window-to-buffer &optional window max-height min-height override 665@deffn Command fit-window-to-buffer &optional window max-height min-height override
633This command makes @var{window} the right height to display its 666This command adjusts the height of @var{window} to fit the text in it.
634contents exactly. The default for @var{window} is the selected window. 667It returns non-@code{nil} if it was able to resize @var{window}, and
635 668@code{nil} otherwise. If @var{window} is omitted or @code{nil}, it
636The optional argument @var{max-height} specifies the maximum total 669defaults to the selected window. Otherwise, it should be a live
637height the window is allowed to be; @code{nil} means use the maximum 670window.
638permissible height of a window on @var{window}'s frame. The optional 671
639argument @var{min-height} specifies the minimum total height for the 672The optional argument @var{max-height}, if non-@code{nil}, specifies
640window; @code{nil} means use @code{window-min-height}. All these height 673the maximum total height that this function can give @var{window}.
641values include the mode line and/or header line. 674The optional argument @var{min-height}, if no-@code{nil}, specifies
642 675the minimum total height that it can give, which overrides the
643If the optional argument @var{override} is non-@code{nil}, this means to 676variable @code{window-min-height}.
644ignore any restrictions imposed by @code{window-min-height} and 677
645@code{window-min-width} on the size of @var{window}. 678If the optional argument @var{override} is non-@code{nil}, this
646 679function ignores any size restrictions imposed by
647This function returns non-@code{nil} if it orderly resized @var{window}, 680@code{window-min-height} and @code{window-min-width}.
648and @code{nil} otherwise.
649@end deffn 681@end deffn
650 682
651@deffn Command shrink-window-if-larger-than-buffer &optional window 683@deffn Command shrink-window-if-larger-than-buffer &optional window
652This command shrinks @var{window} vertically to be as small as possible 684This command attempts to reduce @var{window}'s height as much as
653while still showing the full contents of its buffer---but not less than 685possible while still showing its full buffer, but no less than
654@code{window-min-height} lines. The argument @var{window} must denote 686@code{window-min-height} lines. The return value is non-@code{nil} if
655a live window and defaults to the selected one. 687the window was resized, and @code{nil} otherwise. If @var{window} is
656 688omitted or @code{nil}, it defaults to the selected window. Otherwise,
657However, this command does nothing if the window is already too small to 689it should be a live window.
658display the whole text of the buffer, or if part of the contents are 690
659currently scrolled off screen, or if the window is not the full width of 691This command does nothing if the window is already too short to
660its frame, or if the window is the only window in its frame. 692display all of its buffer, or if any of the buffer is scrolled
661 693off-screen, or if the window is the only live window in its frame.
662This command returns non-@code{nil} if it actually shrank the window
663and @code{nil} otherwise.
664@end deffn 694@end deffn
665 695
666@cindex balancing window sizes 696@cindex balancing window sizes
667Emacs provides two functions to balance windows, that is, to even out
668the sizes of all windows on the same frame. The minibuffer window and
669fixed-size windows are not resized by these functions.
670
671@deffn Command balance-windows &optional window-or-frame 697@deffn Command balance-windows &optional window-or-frame
672This function balances windows in a way that gives more space to 698This function balances windows in a way that gives more space to
673full-width and/or full-height windows. If @var{window-or-frame} 699full-width and/or full-height windows. If @var{window-or-frame}
674specifies a frame, it balances all windows on that frame. If 700specifies a frame, it balances all windows on that frame. If
675@var{window-or-frame} specifies a window, it balances that window and 701@var{window-or-frame} specifies a window, it balances only that window
676its siblings (@pxref{Windows and Frames}) only. 702and its siblings (@pxref{Windows and Frames}).
677@end deffn 703@end deffn
678 704
679@deffn Command balance-windows-area 705@deffn Command balance-windows-area
680This function attempts to give all windows on the selected frame 706This function attempts to give all windows on the selected frame
681approximately the same share of the screen area. This means that 707approximately the same share of the screen area. Full-width or
682full-width or full-height windows are not given more space than other 708full-height windows are not given more space than other windows.
683windows.
684@end deffn 709@end deffn
685 710
686@cindex maximizing windows 711@cindex maximizing windows
687The following function can be used to give a window the maximum possible
688size without deleting other ones.
689
690@deffn Command maximize-window &optional window 712@deffn Command maximize-window &optional window
691This function maximizes @var{window}. More precisely, this makes 713This function attempts to make @var{window} as large as possible, in
692@var{window} as large as possible without resizing its frame or deleting 714both dimensions, without resizing its frame or deleting other windows.
693other windows. @var{window} can be any window and defaults to the 715If @var{window} is omitted or @code{nil}, it defaults to the selected
694selected one. 716window.
695@end deffn 717@end deffn
696 718
697@cindex minimizing windows 719@cindex minimizing windows
698To make a window as small as possible without deleting it the
699following function can be used.
700
701@deffn Command minimize-window &optional window 720@deffn Command minimize-window &optional window
702This function minimizes @var{window}. More precisely, this makes 721This function attempts to make @var{window} as small as possible, in
703@var{window} as small as possible without deleting it or resizing its 722both dimensions, without deleting it or resizing its frame. If
704frame. @var{window} can be any window and defaults to the selected one. 723@var{window} is omitted or @code{nil}, it defaults to the selected
724window.
705@end deffn 725@end deffn
706 726
707 727
@@ -719,7 +739,7 @@ This function creates a new live window next to the window
719to the selected window. That window is ``split'', and reduced in 739to the selected window. That window is ``split'', and reduced in
720size. The space is taken up by the new window, which is returned. 740size. The space is taken up by the new window, which is returned.
721 741
722The optional second argument @var{size} determines the sizes of the 742The optional second argument @var{size} determines the sizes of
723@var{window} and/or the new window. If it is omitted or @code{nil}, 743@var{window} and/or the new window. If it is omitted or @code{nil},
724both windows are given equal sizes; if there is an odd line, it is 744both windows are given equal sizes; if there is an odd line, it is
725allocated to the new window. If @var{size} is a positive number, 745allocated to the new window. If @var{size} is a positive number,
@@ -765,10 +785,10 @@ lieu of the usual action of @code{split-window}.
765 785
766 As an example, we show a combination of @code{split-window} calls 786 As an example, we show a combination of @code{split-window} calls
767that yields the window configuration discussed in @ref{Windows and 787that yields the window configuration discussed in @ref{Windows and
768Frames}. This example demonstrates splitting live windows as well as 788Frames}. This example demonstrates splitting a live window as well as
769splitting internal windows. We begin with a frame containing a single 789splitting an internal window. We begin with a frame containing a
770window (a live root window), which we denote by @var{W4}. Calling 790single window (a live root window), which we denote by @var{W4}.
771@code{(split-window W3)} yields this window configuration: 791Calling @code{(split-window W3)} yields this window configuration:
772 792
773@smallexample 793@smallexample
774@group 794@group
@@ -816,10 +836,9 @@ internal window @var{W3} as the argument. The result:
816@end smallexample 836@end smallexample
817 837
818@noindent 838@noindent
819A new live window, @var{W2}, is created to the left of @var{W3} (which 839A new live window @var{W2} is created, to the left of the internal
820encompasses the vertical window combination of @var{W4} and @var{W5}). 840window @var{W3}. A new internal window @var{W1} is created, becoming
821A new internal window @var{W1} is also created, and becomes the new 841the new root window.
822root window.
823 842
824 The following two options can be used to modify the operation of 843 The following two options can be used to modify the operation of
825@code{split-window}. 844@code{split-window}.