comparison man/display.texi @ 68517:698cfed8969f

(Scrolling, Horizontal Scrolling, Follow Mode): Nodes moved to top.
author Richard M. Stallman <rms@gnu.org>
date Tue, 31 Jan 2006 18:39:00 +0000
parents 9141c59ac209
children fb70c9e1f026 7432ca837c8d
comparison
equal deleted inserted replaced
68516:9141c59ac209 68517:698cfed8969f
24 * Optional Mode Line:: Optional mode line display features. 24 * Optional Mode Line:: Optional mode line display features.
25 * Text Display:: How text characters are normally displayed. 25 * Text Display:: How text characters are normally displayed.
26 * Cursor Display:: Features for displaying the cursor. 26 * Cursor Display:: Features for displaying the cursor.
27 * Display Custom:: Information on variables for customizing display. 27 * Display Custom:: Information on variables for customizing display.
28 @end menu 28 @end menu
29
30 @node Scrolling
31 @section Scrolling
32
33 If a buffer contains text that is too large to fit entirely within a
34 window that is displaying the buffer, Emacs shows a contiguous portion of
35 the text. The portion shown always contains point.
36
37 @cindex scrolling
38 @dfn{Scrolling} means moving text up or down in the window so that
39 different parts of the text are visible. Scrolling ``forward'' or
40 ``up'' means that text moves up, and new text appears at the bottom.
41 Scrolling ``backward'' or ``down'' moves text down, and new text
42 appears at the top.
43
44 Scrolling happens automatically if you move point past the bottom or
45 top of the window. You can also scroll explicitly with the commands
46 in this section.
47
48 @table @kbd
49 @item C-l
50 Clear screen and redisplay, scrolling the selected window to center
51 point vertically within it (@code{recenter}).
52 @item C-v
53 Scroll forward (a windowful or a specified number of lines) (@code{scroll-up}).
54 @item @key{NEXT}
55 @itemx @key{PAGEDOWN}
56 Likewise, scroll forward.
57 @item M-v
58 Scroll backward (@code{scroll-down}).
59 @item @key{PRIOR}
60 @itemx @key{PAGEUP}
61 Likewise, scroll backward.
62 @item @var{arg} C-l
63 Scroll so point is on line @var{arg} (@code{recenter}).
64 @item C-M-l
65 Scroll heuristically to bring useful information onto the screen
66 (@code{reposition-window}).
67 @end table
68
69 @kindex C-l
70 @findex recenter
71 The most basic scrolling command is @kbd{C-l} (@code{recenter}) with
72 no argument. It scrolls the selected window so that point is halfway
73 down from the top of the window. On a text terminal, it also clears
74 the screen and redisplays all windows. That is useful in case the
75 screen is garbled (@pxref{Screen Garbled}).
76
77 @kindex C-v
78 @kindex M-v
79 @kindex NEXT
80 @kindex PRIOR
81 @kindex PAGEDOWN
82 @kindex PAGEUP
83 @findex scroll-up
84 @findex scroll-down
85 @vindex next-screen-context-lines
86 To read the buffer a windowful at a time, use @kbd{C-v}
87 (@code{scroll-up}) with no argument. This scrolls forward by nearly
88 the whole window height. The effect is to take the two lines at the
89 bottom of the window and put them at the top, followed by nearly a
90 whole windowful of lines that were not previously visible. If point
91 was in the text that scrolled off the top, it ends up at the new top
92 of the window.
93
94 @kbd{M-v} (@code{scroll-down}) with no argument scrolls backward in
95 a similar way, also with overlap. The number of lines of overlap
96 across a @kbd{C-v} or @kbd{M-v} is controlled by the variable
97 @code{next-screen-context-lines}; by default, it is 2. The function
98 keys @key{NEXT} and @key{PRIOR}, or @key{PAGEDOWN} and @key{PAGEUP},
99 are equivalent to @kbd{C-v} and @kbd{M-v}.
100
101 The commands @kbd{C-v} and @kbd{M-v} with a numeric argument scroll
102 the text in the selected window up or down a few lines. @kbd{C-v}
103 with an argument moves the text and point up, together, that many
104 lines; it brings the same number of new lines into view at the bottom
105 of the window. @kbd{M-v} with numeric argument scrolls the text
106 downward, bringing that many new lines into view at the top of the
107 window. @kbd{C-v} with a negative argument is like @kbd{M-v} and vice
108 versa.
109
110 The names of scroll commands are based on the direction that the
111 text moves in the window. Thus, the command to scroll forward is
112 called @code{scroll-up} because it moves the text upward on the
113 screen. The keys @key{PAGEDOWN} and @key{PAGEUP} derive their names
114 and customary meanings from a different convention that developed
115 elsewhere; hence the strange result that @key{PAGEDOWN} runs
116 @code{scroll-up}.
117
118 @vindex scroll-preserve-screen-position
119 Some users like the full-screen scroll commands to keep point at the
120 same screen line. To enable this behavior, set the variable
121 @code{scroll-preserve-screen-position} to a non-@code{nil} value. In
122 this mode, when scrolling shifts point off the screen, or into the
123 scrolling margins, Emacs moves point to keep the same vertical
124 position within the window. This mode is convenient for browsing
125 through a file by scrolling by screenfuls; if you come back to the
126 screen where you started, point goes back to the line where it
127 started. However, this mode is inconvenient when you move to the next
128 screen in order to move point to the text there.
129
130 Another way to do scrolling is with @kbd{C-l} with a numeric argument.
131 @kbd{C-l} does not clear the screen when given an argument; it only scrolls
132 the selected window. With a positive argument @var{n}, it repositions text
133 to put point @var{n} lines down from the top. An argument of zero puts
134 point on the very top line. Point does not move with respect to the text;
135 rather, the text and point move rigidly on the screen. @kbd{C-l} with a
136 negative argument puts point that many lines from the bottom of the window.
137 For example, @kbd{C-u - 1 C-l} puts point on the bottom line, and @kbd{C-u
138 - 5 C-l} puts it five lines from the bottom. @kbd{C-u C-l} scrolls to put
139 point at the center (vertically) of the selected window.
140
141 @kindex C-M-l
142 @findex reposition-window
143 The @kbd{C-M-l} command (@code{reposition-window}) scrolls the current
144 window heuristically in a way designed to get useful information onto
145 the screen. For example, in a Lisp file, this command tries to get the
146 entire current defun onto the screen if possible.
147
148 @vindex scroll-conservatively
149 Scrolling happens automatically when point moves out of the visible
150 portion of the text. Normally, automatic scrolling centers point
151 vertically within the window. However, if you set
152 @code{scroll-conservatively} to a small number @var{n}, then if you
153 move point just a little off the screen---less than @var{n}
154 lines---then Emacs scrolls the text just far enough to bring point
155 back on screen. By default, @code{scroll-conservatively} is 0.
156
157 @cindex aggressive scrolling
158 @vindex scroll-up-aggressively
159 @vindex scroll-down-aggressively
160 When the window does scroll by a longer distance, you can control
161 how aggressively it scrolls, by setting the variables
162 @code{scroll-up-aggressively} and @code{scroll-down-aggressively}.
163 The value of @code{scroll-up-aggressively} should be either
164 @code{nil}, or a fraction @var{f} between 0 and 1. A fraction
165 specifies where on the screen to put point when scrolling upward.
166 More precisely, when a window scrolls up because point is above the
167 window start, the new start position is chosen to put point @var{f}
168 part of the window height from the top. The larger @var{f}, the more
169 aggressive the scrolling.
170
171 @code{nil}, which is the default, scrolls to put point at the center.
172 So it is equivalent to .5.
173
174 Likewise, @code{scroll-down-aggressively} is used for scrolling
175 down. The value, @var{f}, specifies how far point should be placed
176 from the bottom of the window; thus, as with
177 @code{scroll-up-aggressively}, a larger value is more aggressive.
178
179 @vindex scroll-margin
180 The variable @code{scroll-margin} restricts how close point can come
181 to the top or bottom of a window. Its value is a number of screen
182 lines; if point comes within that many lines of the top or bottom of the
183 window, Emacs recenters the window. By default, @code{scroll-margin} is
184 0.
185
186 @node Horizontal Scrolling
187 @section Horizontal Scrolling
188 @cindex horizontal scrolling
189
190 @dfn{Horizontal scrolling} means shifting all the lines sideways
191 within a window---so that some of the text near the left margin is not
192 displayed at all. When the text in a window is scrolled horizontally,
193 text lines are truncated rather than continued (@pxref{Display
194 Custom}). Whenever a window shows truncated lines, Emacs
195 automatically updates its horizontal scrolling whenever point moves
196 off the left or right edge of the screen. You can also use these
197 commands to do explicit horizontal scrolling.
198
199 @table @kbd
200 @item C-x <
201 Scroll text in current window to the left (@code{scroll-left}).
202 @item C-x >
203 Scroll to the right (@code{scroll-right}).
204 @end table
205
206 @kindex C-x <
207 @kindex C-x >
208 @findex scroll-left
209 @findex scroll-right
210 The command @kbd{C-x <} (@code{scroll-left}) scrolls the selected
211 window to the left by @var{n} columns with argument @var{n}. This moves
212 part of the beginning of each line off the left edge of the window.
213 With no argument, it scrolls by almost the full width of the window (two
214 columns less, to be precise).
215
216 @kbd{C-x >} (@code{scroll-right}) scrolls similarly to the right. The
217 window cannot be scrolled any farther to the right once it is displayed
218 normally (with each line starting at the window's left margin);
219 attempting to do so has no effect. This means that you don't have to
220 calculate the argument precisely for @w{@kbd{C-x >}}; any sufficiently large
221 argument will restore the normal display.
222
223 If you use those commands to scroll a window horizontally, that sets
224 a lower bound for automatic horizontal scrolling. Automatic scrolling
225 will continue to scroll the window, but never farther to the right
226 than the amount you previously set by @code{scroll-left}.
227
228 @vindex hscroll-margin
229 The value of the variable @code{hscroll-margin} controls how close
230 to the window's edges point is allowed to get before the window will
231 be automatically scrolled. It is measured in columns. If the value
232 is 5, then moving point within 5 columns of the edge causes horizontal
233 scrolling away from that edge.
234
235 @vindex hscroll-step
236 The variable @code{hscroll-step} determines how many columns to
237 scroll the window when point gets too close to the edge. If it's
238 zero, horizontal scrolling centers point horizontally within the
239 window. If it's a positive integer, it specifies the number of
240 columns to scroll by. If it's a floating-point number, it specifies
241 the fraction of the window's width to scroll by. The default is zero.
242
243 @vindex auto-hscroll-mode
244 To disable automatic horizontal scrolling, set the variable
245 @code{auto-hscroll-mode} to @code{nil}.
246
247 @node Follow Mode
248 @section Follow Mode
249 @cindex Follow mode
250 @cindex mode, Follow
251 @findex follow-mode
252 @cindex windows, synchronizing
253 @cindex synchronizing windows
254
255 @dfn{Follow mode} is a minor mode that makes two windows, both
256 showing the same buffer, scroll as a single tall ``virtual window.''
257 To use Follow mode, go to a frame with just one window, split it into
258 two side-by-side windows using @kbd{C-x 3}, and then type @kbd{M-x
259 follow-mode}. From then on, you can edit the buffer in either of the
260 two windows, or scroll either one; the other window follows it.
261
262 In Follow mode, if you move point outside the portion visible in one
263 window and into the portion visible in the other window, that selects
264 the other window---again, treating the two as if they were parts of
265 one large window.
266
267 To turn off Follow mode, type @kbd{M-x follow-mode} a second time.
29 268
30 @node Faces 269 @node Faces
31 @section Using Multiple Typefaces 270 @section Using Multiple Typefaces
32 @cindex faces 271 @cindex faces
33 272
464 703
465 This command does nothing if the major mode is a member of the list 704 This command does nothing if the major mode is a member of the list
466 @code{hi-lock-exclude-modes}. 705 @code{hi-lock-exclude-modes}.
467 @end table 706 @end table
468 707
469 @node Scrolling
470 @section Scrolling
471
472 If a buffer contains text that is too large to fit entirely within a
473 window that is displaying the buffer, Emacs shows a contiguous portion of
474 the text. The portion shown always contains point.
475
476 @cindex scrolling
477 @dfn{Scrolling} means moving text up or down in the window so that
478 different parts of the text are visible. Scrolling ``forward'' or
479 ``up'' means that text moves up, and new text appears at the bottom.
480 Scrolling ``backward'' or ``down'' moves text down, and new text
481 appears at the top.
482
483 Scrolling happens automatically if you move point past the bottom or
484 top of the window. You can also scroll explicitly with the commands
485 in this section.
486
487 @table @kbd
488 @item C-l
489 Clear screen and redisplay, scrolling the selected window to center
490 point vertically within it (@code{recenter}).
491 @item C-v
492 Scroll forward (a windowful or a specified number of lines) (@code{scroll-up}).
493 @item @key{NEXT}
494 @itemx @key{PAGEDOWN}
495 Likewise, scroll forward.
496 @item M-v
497 Scroll backward (@code{scroll-down}).
498 @item @key{PRIOR}
499 @itemx @key{PAGEUP}
500 Likewise, scroll backward.
501 @item @var{arg} C-l
502 Scroll so point is on line @var{arg} (@code{recenter}).
503 @item C-M-l
504 Scroll heuristically to bring useful information onto the screen
505 (@code{reposition-window}).
506 @end table
507
508 @kindex C-l
509 @findex recenter
510 The most basic scrolling command is @kbd{C-l} (@code{recenter}) with
511 no argument. It scrolls the selected window so that point is halfway
512 down from the top of the window. On a text terminal, it also clears
513 the screen and redisplays all windows. That is useful in case the
514 screen is garbled (@pxref{Screen Garbled}).
515
516 @kindex C-v
517 @kindex M-v
518 @kindex NEXT
519 @kindex PRIOR
520 @kindex PAGEDOWN
521 @kindex PAGEUP
522 @findex scroll-up
523 @findex scroll-down
524 @vindex next-screen-context-lines
525 To read the buffer a windowful at a time, use @kbd{C-v}
526 (@code{scroll-up}) with no argument. This scrolls forward by nearly
527 the whole window height. The effect is to take the two lines at the
528 bottom of the window and put them at the top, followed by nearly a
529 whole windowful of lines that were not previously visible. If point
530 was in the text that scrolled off the top, it ends up at the new top
531 of the window.
532
533 @kbd{M-v} (@code{scroll-down}) with no argument scrolls backward in
534 a similar way, also with overlap. The number of lines of overlap
535 across a @kbd{C-v} or @kbd{M-v} is controlled by the variable
536 @code{next-screen-context-lines}; by default, it is 2. The function
537 keys @key{NEXT} and @key{PRIOR}, or @key{PAGEDOWN} and @key{PAGEUP},
538 are equivalent to @kbd{C-v} and @kbd{M-v}.
539
540 The commands @kbd{C-v} and @kbd{M-v} with a numeric argument scroll
541 the text in the selected window up or down a few lines. @kbd{C-v}
542 with an argument moves the text and point up, together, that many
543 lines; it brings the same number of new lines into view at the bottom
544 of the window. @kbd{M-v} with numeric argument scrolls the text
545 downward, bringing that many new lines into view at the top of the
546 window. @kbd{C-v} with a negative argument is like @kbd{M-v} and vice
547 versa.
548
549 The names of scroll commands are based on the direction that the
550 text moves in the window. Thus, the command to scroll forward is
551 called @code{scroll-up} because it moves the text upward on the
552 screen. The keys @key{PAGEDOWN} and @key{PAGEUP} derive their names
553 and customary meanings from a different convention that developed
554 elsewhere; hence the strange result that @key{PAGEDOWN} runs
555 @code{scroll-up}.
556
557 @vindex scroll-preserve-screen-position
558 Some users like the full-screen scroll commands to keep point at the
559 same screen line. To enable this behavior, set the variable
560 @code{scroll-preserve-screen-position} to a non-@code{nil} value. In
561 this mode, when scrolling shifts point off the screen, or into the
562 scrolling margins, Emacs moves point to keep the same vertical
563 position within the window. This mode is convenient for browsing
564 through a file by scrolling by screenfuls; if you come back to the
565 screen where you started, point goes back to the line where it
566 started. However, this mode is inconvenient when you move to the next
567 screen in order to move point to the text there.
568
569 Another way to do scrolling is with @kbd{C-l} with a numeric argument.
570 @kbd{C-l} does not clear the screen when given an argument; it only scrolls
571 the selected window. With a positive argument @var{n}, it repositions text
572 to put point @var{n} lines down from the top. An argument of zero puts
573 point on the very top line. Point does not move with respect to the text;
574 rather, the text and point move rigidly on the screen. @kbd{C-l} with a
575 negative argument puts point that many lines from the bottom of the window.
576 For example, @kbd{C-u - 1 C-l} puts point on the bottom line, and @kbd{C-u
577 - 5 C-l} puts it five lines from the bottom. @kbd{C-u C-l} scrolls to put
578 point at the center (vertically) of the selected window.
579
580 @kindex C-M-l
581 @findex reposition-window
582 The @kbd{C-M-l} command (@code{reposition-window}) scrolls the current
583 window heuristically in a way designed to get useful information onto
584 the screen. For example, in a Lisp file, this command tries to get the
585 entire current defun onto the screen if possible.
586
587 @vindex scroll-conservatively
588 Scrolling happens automatically when point moves out of the visible
589 portion of the text. Normally, automatic scrolling centers point
590 vertically within the window. However, if you set
591 @code{scroll-conservatively} to a small number @var{n}, then if you
592 move point just a little off the screen---less than @var{n}
593 lines---then Emacs scrolls the text just far enough to bring point
594 back on screen. By default, @code{scroll-conservatively} is 0.
595
596 @cindex aggressive scrolling
597 @vindex scroll-up-aggressively
598 @vindex scroll-down-aggressively
599 When the window does scroll by a longer distance, you can control
600 how aggressively it scrolls, by setting the variables
601 @code{scroll-up-aggressively} and @code{scroll-down-aggressively}.
602 The value of @code{scroll-up-aggressively} should be either
603 @code{nil}, or a fraction @var{f} between 0 and 1. A fraction
604 specifies where on the screen to put point when scrolling upward.
605 More precisely, when a window scrolls up because point is above the
606 window start, the new start position is chosen to put point @var{f}
607 part of the window height from the top. The larger @var{f}, the more
608 aggressive the scrolling.
609
610 @code{nil}, which is the default, scrolls to put point at the center.
611 So it is equivalent to .5.
612
613 Likewise, @code{scroll-down-aggressively} is used for scrolling
614 down. The value, @var{f}, specifies how far point should be placed
615 from the bottom of the window; thus, as with
616 @code{scroll-up-aggressively}, a larger value is more aggressive.
617
618 @vindex scroll-margin
619 The variable @code{scroll-margin} restricts how close point can come
620 to the top or bottom of a window. Its value is a number of screen
621 lines; if point comes within that many lines of the top or bottom of the
622 window, Emacs recenters the window. By default, @code{scroll-margin} is
623 0.
624
625 @node Horizontal Scrolling
626 @section Horizontal Scrolling
627 @cindex horizontal scrolling
628
629 @dfn{Horizontal scrolling} means shifting all the lines sideways
630 within a window---so that some of the text near the left margin is not
631 displayed at all. When the text in a window is scrolled horizontally,
632 text lines are truncated rather than continued (@pxref{Display
633 Custom}). Whenever a window shows truncated lines, Emacs
634 automatically updates its horizontal scrolling whenever point moves
635 off the left or right edge of the screen. You can also use these
636 commands to do explicit horizontal scrolling.
637
638 @table @kbd
639 @item C-x <
640 Scroll text in current window to the left (@code{scroll-left}).
641 @item C-x >
642 Scroll to the right (@code{scroll-right}).
643 @end table
644
645 @kindex C-x <
646 @kindex C-x >
647 @findex scroll-left
648 @findex scroll-right
649 The command @kbd{C-x <} (@code{scroll-left}) scrolls the selected
650 window to the left by @var{n} columns with argument @var{n}. This moves
651 part of the beginning of each line off the left edge of the window.
652 With no argument, it scrolls by almost the full width of the window (two
653 columns less, to be precise).
654
655 @kbd{C-x >} (@code{scroll-right}) scrolls similarly to the right. The
656 window cannot be scrolled any farther to the right once it is displayed
657 normally (with each line starting at the window's left margin);
658 attempting to do so has no effect. This means that you don't have to
659 calculate the argument precisely for @w{@kbd{C-x >}}; any sufficiently large
660 argument will restore the normal display.
661
662 If you use those commands to scroll a window horizontally, that sets
663 a lower bound for automatic horizontal scrolling. Automatic scrolling
664 will continue to scroll the window, but never farther to the right
665 than the amount you previously set by @code{scroll-left}.
666
667 @vindex hscroll-margin
668 The value of the variable @code{hscroll-margin} controls how close
669 to the window's edges point is allowed to get before the window will
670 be automatically scrolled. It is measured in columns. If the value
671 is 5, then moving point within 5 columns of the edge causes horizontal
672 scrolling away from that edge.
673
674 @vindex hscroll-step
675 The variable @code{hscroll-step} determines how many columns to
676 scroll the window when point gets too close to the edge. If it's
677 zero, horizontal scrolling centers point horizontally within the
678 window. If it's a positive integer, it specifies the number of
679 columns to scroll by. If it's a floating-point number, it specifies
680 the fraction of the window's width to scroll by. The default is zero.
681
682 @vindex auto-hscroll-mode
683 To disable automatic horizontal scrolling, set the variable
684 @code{auto-hscroll-mode} to @code{nil}.
685
686 @node Fringes 708 @node Fringes
687 @section Window Fringes 709 @section Window Fringes
688 @cindex fringes 710 @cindex fringes
689 711
690 On a graphical display, each Emacs window normally has narrow 712 On a graphical display, each Emacs window normally has narrow
756 @code{indicate-empty-lines} to a non-@code{nil} value. The default 778 @code{indicate-empty-lines} to a non-@code{nil} value. The default
757 value of this variable is controlled by the variable 779 value of this variable is controlled by the variable
758 @code{default-indicate-empty-lines}; by setting that variable, you 780 @code{default-indicate-empty-lines}; by setting that variable, you
759 can enable or disable this feature for all new buffers. (This feature 781 can enable or disable this feature for all new buffers. (This feature
760 currently doesn't work on text-only terminals.) 782 currently doesn't work on text-only terminals.)
761
762 @node Follow Mode
763 @section Follow Mode
764 @cindex Follow mode
765 @cindex mode, Follow
766 @findex follow-mode
767 @cindex windows, synchronizing
768 @cindex synchronizing windows
769
770 @dfn{Follow mode} is a minor mode that makes two windows, both
771 showing the same buffer, scroll as a single tall ``virtual window.''
772 To use Follow mode, go to a frame with just one window, split it into
773 two side-by-side windows using @kbd{C-x 3}, and then type @kbd{M-x
774 follow-mode}. From then on, you can edit the buffer in either of the
775 two windows, or scroll either one; the other window follows it.
776
777 In Follow mode, if you move point outside the portion visible in one
778 window and into the portion visible in the other window, that selects
779 the other window---again, treating the two as if they were parts of
780 one large window.
781
782 To turn off Follow mode, type @kbd{M-x follow-mode} a second time.
783 783
784 @node Selective Display 784 @node Selective Display
785 @section Selective Display 785 @section Selective Display
786 @cindex selective display 786 @cindex selective display
787 @findex set-selective-display 787 @findex set-selective-display