1 |
@c This is part of the Emacs manual. |
@c This is part of the Emacs manual. |
2 |
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997, 2000, 2001 |
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997, 2000, 2001, 2002 |
3 |
@c Free Software Foundation, Inc. |
@c Free Software Foundation, Inc. |
4 |
@c See file emacs.texi for copying conditions. |
@c See file emacs.texi for copying conditions. |
5 |
@node Display, Search, Registers, Top |
@node Display, Search, Registers, Top |
15 |
* Font Lock:: Minor mode for syntactic highlighting using faces. |
* Font Lock:: Minor mode for syntactic highlighting using faces. |
16 |
* Highlight Changes:: Using colors to show where you changed the buffer. |
* Highlight Changes:: Using colors to show where you changed the buffer. |
17 |
* Highlight Interactively:: Tell Emacs what text to highlight. |
* Highlight Interactively:: Tell Emacs what text to highlight. |
|
* Trailing Whitespace:: Showing possibly-spurious trailing whitespace. |
|
18 |
* Scrolling:: Moving text up and down in a window. |
* Scrolling:: Moving text up and down in a window. |
19 |
* Horizontal Scrolling:: Moving text left and right in a window. |
* Horizontal Scrolling:: Moving text left and right in a window. |
20 |
|
* Fringes:: Enabling or disabling window fringes. |
21 |
|
* Useless Whitespace:: Showing possibly-spurious trailing whitespace. |
22 |
* Follow Mode:: Follow mode lets two windows scroll as one. |
* Follow Mode:: Follow mode lets two windows scroll as one. |
23 |
* Selective Display:: Hiding lines with lots of indentation. |
* Selective Display:: Hiding lines with lots of indentation. |
24 |
* Optional Mode Line:: Optional mode line display features. |
* Optional Mode Line:: Optional mode line display features. |
163 |
the font are ignored in this case. |
the font are ignored in this case. |
164 |
@item trailing-whitespace |
@item trailing-whitespace |
165 |
The face for highlighting trailing whitespace when |
The face for highlighting trailing whitespace when |
166 |
@code{show-trailing-whitespace} is non-nil; see @ref{Trailing Whitespace}. |
@code{show-trailing-whitespace} is non-@code{nil}; see @ref{Useless |
167 |
|
Whitespace}. |
168 |
@item variable-pitch |
@item variable-pitch |
169 |
The basic variable-pitch face. |
The basic variable-pitch face. |
170 |
@end table |
@end table |
195 |
@cindex mode, Font Lock |
@cindex mode, Font Lock |
196 |
@cindex syntax highlighting and coloring |
@cindex syntax highlighting and coloring |
197 |
|
|
198 |
Font Lock mode is a minor mode, always local to a particular |
Font Lock mode is a minor mode, always local to a particular buffer, |
199 |
buffer, which highlights (or ``fontifies'') using various faces |
which highlights (or ``fontifies'') using various faces according to |
200 |
according to the syntax of the text you are editing. It can |
the syntax of the text you are editing. It can recognize comments and |
201 |
recognize comments and strings in most languages; in several |
strings in most languages; in several languages, it can also recognize |
202 |
languages, it can also recognize and properly highlight various other |
and properly highlight various other important constructs---for |
203 |
important constructs---for example, names of functions being defined |
example, names of functions being defined or reserved keywords. |
204 |
or reserved keywords. |
Some special modes, such as Occur mode and Info mode, have completely |
205 |
|
specialized ways of assigning fonts for Font Lock mode. |
206 |
|
|
207 |
@findex font-lock-mode |
@findex font-lock-mode |
208 |
@findex turn-on-font-lock |
@findex turn-on-font-lock |
404 |
@code{hi-lock-exclude-modes}. |
@code{hi-lock-exclude-modes}. |
405 |
@end table |
@end table |
406 |
|
|
|
@node Trailing Whitespace |
|
|
@section Trailing Whitespace |
|
|
|
|
|
@cindex trailing whitespace |
|
|
@cindex whitespace, trailing |
|
|
@vindex show-trailing-whitespace |
|
|
It is easy to leave unnecessary spaces at the end of a line without |
|
|
realizing it. In most cases, this @dfn{trailing whitespace} has no |
|
|
effect, but there are special circumstances where it matters. |
|
|
|
|
|
You can make trailing whitespace visible on the screen by setting the |
|
|
buffer-local variable @code{show-trailing-whitespace} to @code{t}. Then |
|
|
Emacs displays trailing whitespace in the face |
|
|
@code{trailing-whitespace}. |
|
|
|
|
|
Trailing whitespace is defined as spaces or tabs at the end of a |
|
|
line. But trailing whitespace is not displayed specially if point is |
|
|
at the end of the line containing the whitespace. (Doing that looks |
|
|
ugly while you are typing in new text, and the location of point is |
|
|
enough in that case to show you that the spaces are present.) |
|
|
|
|
|
@findex delete-trailing-whitespace |
|
|
To delete all trailing whitespace within the current buffer's |
|
|
restriction (@pxref{Narrowing}), type @kbd{M-x |
|
|
delete-trailing-whitespace @key{RET}}. (This command does not remove |
|
|
the form-feed characters.) |
|
|
|
|
|
@vindex indicate-empty-lines |
|
|
@vindex default-indicate-empty-lines |
|
|
@cindex empty lines |
|
|
@cindex fringes, and empty line indication |
|
|
Emacs can indicate empty lines at the end of the buffer with a |
|
|
special bitmap on the left fringe of the window. To enable this |
|
|
feature, set the buffer-local variable @code{indicate-empty-lines} to |
|
|
a non-@code{nil} value. The default value of this variable is |
|
|
controlled by the variable @code{default-indicate-empty-lines}; |
|
|
by setting that variable, you can enable or disable this feature |
|
|
for all new buffers. (This feature currently doesn't work on |
|
|
character terminals.) |
|
|
|
|
407 |
@node Scrolling |
@node Scrolling |
408 |
@section Scrolling |
@section Scrolling |
409 |
|
|
529 |
|
|
530 |
@cindex aggressive scrolling |
@cindex aggressive scrolling |
531 |
@vindex scroll-up-aggressively |
@vindex scroll-up-aggressively |
532 |
@vindex scroll-down-aggressively |
@vindex scroll-down-aggressively |
533 |
When the window does scroll by a longer distance, you can control |
When the window does scroll by a longer distance, you can control |
534 |
how aggressively it scrolls, by setting the variables |
how aggressively it scrolls, by setting the variables |
535 |
@code{scroll-up-aggressively} and @code{scroll-down-aggressively}. |
@code{scroll-up-aggressively} and @code{scroll-down-aggressively}. |
622 |
To disable automatic horizontal scrolling, set the variable |
To disable automatic horizontal scrolling, set the variable |
623 |
@code{auto-hscroll-mode} to @code{nil}. |
@code{auto-hscroll-mode} to @code{nil}. |
624 |
|
|
625 |
|
@node Fringes |
626 |
|
@section Window Fringes |
627 |
|
@cindex fringes |
628 |
|
|
629 |
|
On a graphical display, each Emacs window normally has narrow |
630 |
|
@dfn{fringes} on the left and right edges. The fringes display |
631 |
|
indications about the text in the window. |
632 |
|
|
633 |
|
The most common use of the fringes is to indicate a continuation |
634 |
|
line, when one line of text is split into multiple lines on the |
635 |
|
screen. The left fringe shows a curving arrow for each screen line |
636 |
|
except the first, indicating that ``this is not the real beginning.'' |
637 |
|
The right fringe shows a curving arrow for each screen line except the |
638 |
|
last, indicating that ``this is not the real end.'' |
639 |
|
|
640 |
|
The fringes indicate line truncation with short horizontal arrows |
641 |
|
meaning ``there's more text on this line which is scrolled |
642 |
|
horizontally out of view;'' clicking the mouse on one of the arrows |
643 |
|
scrolls the display horizontally in the direction of the arrow. The |
644 |
|
fringes also indicate other things such as empty lines, or where a |
645 |
|
program you are debugging is executing (@pxref{Debuggers}). |
646 |
|
|
647 |
|
@findex set-fringe-style |
648 |
|
@findex fringe-mode |
649 |
|
You can enable and disable the fringes for all frames using |
650 |
|
@kbd{M-x fringe-mode}. To enable and disable the fringes |
651 |
|
for the selected frame, use @kbd{M-x set-fringe-style}. |
652 |
|
|
653 |
|
@node Useless Whitespace |
654 |
|
@section Useless Whitespace |
655 |
|
|
656 |
|
@cindex trailing whitespace |
657 |
|
@cindex whitespace, trailing |
658 |
|
@vindex show-trailing-whitespace |
659 |
|
It is easy to leave unnecessary spaces at the end of a line, or |
660 |
|
empty lines at the end of a file, without realizing it. In most |
661 |
|
cases, this @dfn{trailing whitespace} has no effect, but there are |
662 |
|
special circumstances where it matters. |
663 |
|
|
664 |
|
You can make trailing whitespace at the end of a line visible on the |
665 |
|
screen by setting the buffer-local variable |
666 |
|
@code{show-trailing-whitespace} to @code{t}. Then Emacs displays |
667 |
|
trailing whitespace in the face @code{trailing-whitespace}. |
668 |
|
|
669 |
|
This feature does not apply when point is at the end of the line |
670 |
|
containing the whitespace. Strictly speaking, that is ``trailing |
671 |
|
whitespace'' nonetheless, but displaying it specially in that case |
672 |
|
looks ugly while you are typing in new text. In this special case, |
673 |
|
the location of point is enough to show you that the spaces are |
674 |
|
present. |
675 |
|
|
676 |
|
@findex delete-trailing-whitespace |
677 |
|
To delete all trailing whitespace within the current buffer's |
678 |
|
accessible portion (@pxref{Narrowing}), type @kbd{M-x |
679 |
|
delete-trailing-whitespace @key{RET}}. (This command does not remove |
680 |
|
the form-feed characters.) |
681 |
|
|
682 |
|
@vindex indicate-unused-lines |
683 |
|
@vindex default-indicate-empty-lines |
684 |
|
@cindex unused lines |
685 |
|
@cindex fringes, and unused line indication |
686 |
|
Emacs can indicate unused lines at the end of the window with a |
687 |
|
small image in the left fringe (@pxref{Fringes}). The image appears |
688 |
|
for window lines that do not correspond to any buffer text. Blank |
689 |
|
lines at the end of the buffer then stand out because they do not have |
690 |
|
this image in the fringe. |
691 |
|
|
692 |
|
To enable this feature, set the buffer-local variable |
693 |
|
@code{indicate-unused-lines} to a non-@code{nil} value. The default |
694 |
|
value of this variable is controlled by the variable |
695 |
|
@code{default-indicate-unused-lines}; by setting that variable, you |
696 |
|
can enable or disable this feature for all new buffers. (This feature |
697 |
|
currently doesn't work on character terminals.) |
698 |
|
|
699 |
@node Follow Mode |
@node Follow Mode |
700 |
@section Follow Mode |
@section Follow Mode |
701 |
@cindex Follow mode |
@cindex Follow mode |
814 |
@cindex mail (on mode line) |
@cindex mail (on mode line) |
815 |
@vindex display-time-use-mail-icon |
@vindex display-time-use-mail-icon |
816 |
@vindex display-time-mail-face |
@vindex display-time-mail-face |
817 |
|
@vindex display-time-mail-file |
818 |
|
@vindex display-time-mail-directory |
819 |
The word @samp{Mail} appears after the load level if there is mail |
The word @samp{Mail} appears after the load level if there is mail |
820 |
for you that you have not read yet. On a graphical display you can use |
for you that you have not read yet. On a graphical display you can use |
821 |
an icon instead of @samp{Mail} by customizing |
an icon instead of @samp{Mail} by customizing |
822 |
@code{display-time-use-mail-icon}; this may save some space on the mode |
@code{display-time-use-mail-icon}; this may save some space on the mode |
823 |
line. You can customize @code{display-time-mail-face} to make the mail |
line. You can customize @code{display-time-mail-face} to make the mail |
824 |
indicator prominent. |
indicator prominent. Use @code{display-time-mail-file} to specify |
825 |
|
the mail file to check, or set @code{display-time-mail-directory} |
826 |
|
to specify the directory to check for incoming mail (any nonempty regular |
827 |
|
file in the directory is considered as ``newly arrived mail''). |
828 |
|
|
829 |
@cindex mode line, 3D appearance |
@cindex mode line, 3D appearance |
830 |
@cindex attributes of mode line, changing |
@cindex attributes of mode line, changing |
1000 |
@node Cursor Display |
@node Cursor Display |
1001 |
@section Displaying the Cursor |
@section Displaying the Cursor |
1002 |
|
|
|
@findex hl-line-mode |
|
|
@findex global-hl-line-mode |
|
|
@cindex highlight current line |
|
1003 |
@findex blink-cursor-mode |
@findex blink-cursor-mode |
1004 |
|
@vindex blink-cursor-alist |
1005 |
@cindex cursor, locating visually |
@cindex cursor, locating visually |
1006 |
@cindex cursor, blinking |
@cindex cursor, blinking |
|
There are a number of ways to customize the display of the cursor. |
|
|
@kbd{M-x hl-line-mode} enables or disables a minor mode which |
|
|
highlights the line containing point. @kbd{M-x global-hl-line-mode} |
|
|
enables the minor mode globally. On window systems, the command |
|
|
@kbd{M-x blink-cursor-mode} turns on or off the blinking of the |
|
|
cursor. (On terminals, the terminal itself blinks the cursor, and |
|
|
Emacs has no control over it.) |
|
|
|
|
1007 |
You can customize the cursor's color, and whether it blinks, using |
You can customize the cursor's color, and whether it blinks, using |
1008 |
the @code{cursor} Custom group (@pxref{Easy Customization}). |
the @code{cursor} Custom group (@pxref{Easy Customization}). On |
1009 |
|
graphical terminals, the command @kbd{M-x blink-cursor-mode} enables |
1010 |
|
or disables the blinking of the cursor. (On text terminals, the |
1011 |
|
terminal itself blinks the cursor, and Emacs has no control over it.) |
1012 |
|
You can control how the cursor appears when it blinks off by setting |
1013 |
|
the variable @code{blink-cursor-alist}. |
1014 |
|
|
1015 |
|
@cindex cursor in non-selected windows |
1016 |
|
@vindex cursor-in-non-selected-windows |
1017 |
|
Normally, the cursor appears in non-selected windows in the ``off'' |
1018 |
|
state, with the same appearance as when the blinking cursor blinks |
1019 |
|
``off''. For a box cursor, this is a hollow box; for a bar cursor, |
1020 |
|
this is a thinner bar. To turn off cursors in non-selected windows, |
1021 |
|
customize the option @code{cursor-in-non-selected-windows} and assign |
1022 |
|
it a @code{nil} value. |
1023 |
|
|
1024 |
@vindex x-stretch-cursor |
@vindex x-stretch-cursor |
1025 |
@cindex wide block cursor |
@cindex wide block cursor |
1026 |
When displaying on a window system, Emacs can optionally draw the |
On graphical terminals, Emacs can optionally draw the block cursor |
1027 |
block cursor as wide as the character under the cursor---for example, |
as wide as the character under the cursor---for example, if the cursor |
1028 |
if the cursor is on a tab character, it would cover the full width |
is on a tab character, it would cover the full width occupied by that |
1029 |
occupied by that tab character. To enable this feature, set the |
tab character. To enable this feature, set the variable |
1030 |
variable @code{x-stretch-cursor} to a non-@code{nil} value. |
@code{x-stretch-cursor} to a non-@code{nil} value. |
1031 |
|
|
1032 |
@cindex cursor in non-selected windows |
@findex hl-line-mode |
1033 |
@vindex cursor-in-non-selected-windows |
@findex global-hl-line-mode |
1034 |
Normally, the cursor in non-selected windows is shown as a hollow box. |
@cindex highlight current line |
1035 |
To turn off cursor display in non-selected windows, customize the option |
If you find it hard to see the cursor, you might like HL Line mode, |
1036 |
@code{cursor-in-non-selected-windows} to assign it a @code{nil} value. |
a minor mode that highlights the line containing point. Use @kbd{M-x |
1037 |
|
hl-line-mode} to enable or disable it in the current buffer. @kbd{M-x |
1038 |
|
global-hl-line-mode} enables or disables the same mode globally. |