| 1 |
This is ../info/emacs, produced by makeinfo version 4.3 from emacs.texi. |
|---|
| 2 |
|
|---|
| 3 |
This is the Fourteenth edition of the `GNU Emacs Manual', updated |
|---|
| 4 |
for Emacs version 21.3. |
|---|
| 5 |
|
|---|
| 6 |
INFO-DIR-SECTION Emacs |
|---|
| 7 |
START-INFO-DIR-ENTRY |
|---|
| 8 |
* Emacs: (emacs). The extensible self-documenting text editor. |
|---|
| 9 |
END-INFO-DIR-ENTRY |
|---|
| 10 |
|
|---|
| 11 |
Published by the Free Software Foundation 59 Temple Place, Suite 330 |
|---|
| 12 |
Boston, MA 02111-1307 USA |
|---|
| 13 |
|
|---|
| 14 |
Copyright (C) |
|---|
| 15 |
1985,1986,1987,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002 |
|---|
| 16 |
Free Software Foundation, Inc. |
|---|
| 17 |
|
|---|
| 18 |
Permission is granted to copy, distribute and/or modify this document |
|---|
| 19 |
under the terms of the GNU Free Documentation License, Version 1.1 or |
|---|
| 20 |
any later version published by the Free Software Foundation; with the |
|---|
| 21 |
Invariant Sections being "The GNU Manifesto", "Distribution" and "GNU |
|---|
| 22 |
GENERAL PUBLIC LICENSE", with the Front-Cover texts being "A GNU |
|---|
| 23 |
Manual," and with the Back-Cover Texts as in (a) below. A copy of the |
|---|
| 24 |
license is included in the section entitled "GNU Free Documentation |
|---|
| 25 |
License." |
|---|
| 26 |
|
|---|
| 27 |
(a) The FSF's Back-Cover Text is: "You have freedom to copy and |
|---|
| 28 |
modify this GNU Manual, like GNU software. Copies published by the Free |
|---|
| 29 |
Software Foundation raise funds for GNU development." |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
File: emacs, Node: Registers, Next: Display, Prev: Rectangles, Up: Top |
|---|
| 33 |
|
|---|
| 34 |
Registers |
|---|
| 35 |
********* |
|---|
| 36 |
|
|---|
| 37 |
Emacs "registers" are compartments where you can save text, |
|---|
| 38 |
rectangles, positions, and other things for later use. Once you save |
|---|
| 39 |
text or a rectangle in a register, you can copy it into the buffer |
|---|
| 40 |
once, or many times; you can move point to a position saved in a |
|---|
| 41 |
register once, or many times. |
|---|
| 42 |
|
|---|
| 43 |
Each register has a name, which consists of a single character. A |
|---|
| 44 |
register can store a piece of text, a rectangle, a position, a window |
|---|
| 45 |
configuration, or a file name, but only one thing at any given time. |
|---|
| 46 |
Whatever you store in a register remains there until you store |
|---|
| 47 |
something else in that register. To see what a register R contains, |
|---|
| 48 |
use `M-x view-register'. |
|---|
| 49 |
|
|---|
| 50 |
`M-x view-register <RET> R' |
|---|
| 51 |
Display a description of what register R contains. |
|---|
| 52 |
|
|---|
| 53 |
* Menu: |
|---|
| 54 |
|
|---|
| 55 |
* Position: RegPos. Saving positions in registers. |
|---|
| 56 |
* Text: RegText. Saving text in registers. |
|---|
| 57 |
* Rectangle: RegRect. Saving rectangles in registers. |
|---|
| 58 |
* Configurations: RegConfig. Saving window configurations in registers. |
|---|
| 59 |
* Files: RegFiles. File names in registers. |
|---|
| 60 |
* Numbers: RegNumbers. Numbers in registers. |
|---|
| 61 |
* Bookmarks:: Bookmarks are like registers, but persistent. |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
File: emacs, Node: RegPos, Next: RegText, Up: Registers |
|---|
| 65 |
|
|---|
| 66 |
Saving Positions in Registers |
|---|
| 67 |
============================= |
|---|
| 68 |
|
|---|
| 69 |
Saving a position records a place in a buffer so that you can move |
|---|
| 70 |
back there later. Moving to a saved position switches to that buffer |
|---|
| 71 |
and moves point to that place in it. |
|---|
| 72 |
|
|---|
| 73 |
`C-x r <SPC> R' |
|---|
| 74 |
Save position of point in register R (`point-to-register'). |
|---|
| 75 |
|
|---|
| 76 |
`C-x r j R' |
|---|
| 77 |
Jump to the position saved in register R (`jump-to-register'). |
|---|
| 78 |
|
|---|
| 79 |
To save the current position of point in a register, choose a name R |
|---|
| 80 |
and type `C-x r <SPC> R'. The register R retains the position thus |
|---|
| 81 |
saved until you store something else in that register. |
|---|
| 82 |
|
|---|
| 83 |
The command `C-x r j R' moves point to the position recorded in |
|---|
| 84 |
register R. The register is not affected; it continues to hold the |
|---|
| 85 |
same position. You can jump to the saved position any number of times. |
|---|
| 86 |
|
|---|
| 87 |
If you use `C-x r j' to go to a saved position, but the buffer it |
|---|
| 88 |
was saved from has been killed, `C-x r j' tries to create the buffer |
|---|
| 89 |
again by visiting the same file. Of course, this works only for buffers |
|---|
| 90 |
that were visiting files. |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
File: emacs, Node: RegText, Next: RegRect, Prev: RegPos, Up: Registers |
|---|
| 94 |
|
|---|
| 95 |
Saving Text in Registers |
|---|
| 96 |
======================== |
|---|
| 97 |
|
|---|
| 98 |
When you want to insert a copy of the same piece of text several |
|---|
| 99 |
times, it may be inconvenient to yank it from the kill ring, since each |
|---|
| 100 |
subsequent kill moves that entry further down the ring. An alternative |
|---|
| 101 |
is to store the text in a register and later retrieve it. |
|---|
| 102 |
|
|---|
| 103 |
`C-x r s R' |
|---|
| 104 |
Copy region into register R (`copy-to-register'). |
|---|
| 105 |
|
|---|
| 106 |
`C-x r i R' |
|---|
| 107 |
Insert text from register R (`insert-register'). |
|---|
| 108 |
|
|---|
| 109 |
`M-x append-to-register <RET> R' |
|---|
| 110 |
Append region to text in register R. |
|---|
| 111 |
|
|---|
| 112 |
`M-x prepend-to-register <RET> R' |
|---|
| 113 |
Prepend region to text in register R. |
|---|
| 114 |
|
|---|
| 115 |
`C-x r s R' stores a copy of the text of the region into the |
|---|
| 116 |
register named R. `C-u C-x r s R', the same command with a numeric |
|---|
| 117 |
argument, deletes the text from the buffer as well; you can think of |
|---|
| 118 |
this as "moving" the region text into the register. |
|---|
| 119 |
|
|---|
| 120 |
`M-x append-to-register <RET> R' appends the copy of the text in the |
|---|
| 121 |
region to the text already stored in the register named R. If invoked |
|---|
| 122 |
with a numeric argument, it deletes the region after appending it to |
|---|
| 123 |
the register. A similar command `prepend-to-register' works the same, |
|---|
| 124 |
except that it _prepends_ the region text to the text in the register, |
|---|
| 125 |
rather than _appending_ it. |
|---|
| 126 |
|
|---|
| 127 |
`C-x r i R' inserts in the buffer the text from register R. |
|---|
| 128 |
Normally it leaves point before the text and places the mark after, but |
|---|
| 129 |
with a numeric argument (`C-u') it puts point after the text and the |
|---|
| 130 |
mark before. |
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
File: emacs, Node: RegRect, Next: RegConfig, Prev: RegText, Up: Registers |
|---|
| 134 |
|
|---|
| 135 |
Saving Rectangles in Registers |
|---|
| 136 |
============================== |
|---|
| 137 |
|
|---|
| 138 |
A register can contain a rectangle instead of linear text. The |
|---|
| 139 |
rectangle is represented as a list of strings. *Note Rectangles::, for |
|---|
| 140 |
basic information on how to specify a rectangle in the buffer. |
|---|
| 141 |
|
|---|
| 142 |
`C-x r r R' |
|---|
| 143 |
Copy the region-rectangle into register R |
|---|
| 144 |
(`copy-rectangle-to-register'). With numeric argument, delete it |
|---|
| 145 |
as well. |
|---|
| 146 |
|
|---|
| 147 |
`C-x r i R' |
|---|
| 148 |
Insert the rectangle stored in register R (if it contains a |
|---|
| 149 |
rectangle) (`insert-register'). |
|---|
| 150 |
|
|---|
| 151 |
The `C-x r i R' command inserts a text string if the register |
|---|
| 152 |
contains one, and inserts a rectangle if the register contains one. |
|---|
| 153 |
|
|---|
| 154 |
See also the command `sort-columns', which you can think of as |
|---|
| 155 |
sorting a rectangle. *Note Sorting::. |
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
File: emacs, Node: RegConfig, Next: RegFiles, Prev: RegRect, Up: Registers |
|---|
| 159 |
|
|---|
| 160 |
Saving Window Configurations in Registers |
|---|
| 161 |
========================================= |
|---|
| 162 |
|
|---|
| 163 |
You can save the window configuration of the selected frame in a |
|---|
| 164 |
register, or even the configuration of all windows in all frames, and |
|---|
| 165 |
restore the configuration later. |
|---|
| 166 |
|
|---|
| 167 |
`C-x r w R' |
|---|
| 168 |
Save the state of the selected frame's windows in register R |
|---|
| 169 |
(`window-configuration-to-register'). |
|---|
| 170 |
|
|---|
| 171 |
`C-x r f R' |
|---|
| 172 |
Save the state of all frames, including all their windows, in |
|---|
| 173 |
register R (`frame-configuration-to-register'). |
|---|
| 174 |
|
|---|
| 175 |
Use `C-x r j R' to restore a window or frame configuration. This is |
|---|
| 176 |
the same command used to restore a cursor position. When you restore a |
|---|
| 177 |
frame configuration, any existing frames not included in the |
|---|
| 178 |
configuration become invisible. If you wish to delete these frames |
|---|
| 179 |
instead, use `C-u C-x r j R'. |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
File: emacs, Node: RegNumbers, Next: Bookmarks, Prev: RegFiles, Up: Registers |
|---|
| 183 |
|
|---|
| 184 |
Keeping Numbers in Registers |
|---|
| 185 |
============================ |
|---|
| 186 |
|
|---|
| 187 |
There are commands to store a number in a register, to insert the |
|---|
| 188 |
number in the buffer in decimal, and to increment it. These commands |
|---|
| 189 |
can be useful in keyboard macros (*note Keyboard Macros::). |
|---|
| 190 |
|
|---|
| 191 |
`C-u NUMBER C-x r n R' |
|---|
| 192 |
Store NUMBER into register R (`number-to-register'). |
|---|
| 193 |
|
|---|
| 194 |
`C-u NUMBER C-x r + R' |
|---|
| 195 |
Increment the number in register R by NUMBER |
|---|
| 196 |
(`increment-register'). |
|---|
| 197 |
|
|---|
| 198 |
`C-x r g R' |
|---|
| 199 |
Insert the number from register R into the buffer. |
|---|
| 200 |
|
|---|
| 201 |
`C-x r g' is the same command used to insert any other sort of |
|---|
| 202 |
register contents into the buffer. `C-x r +' with no numeric argument |
|---|
| 203 |
increments the register value by 1; `C-x r n' with no numeric argument |
|---|
| 204 |
stores zero in the register. |
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
File: emacs, Node: RegFiles, Next: RegNumbers, Prev: RegConfig, Up: Registers |
|---|
| 208 |
|
|---|
| 209 |
Keeping File Names in Registers |
|---|
| 210 |
=============================== |
|---|
| 211 |
|
|---|
| 212 |
If you visit certain file names frequently, you can visit them more |
|---|
| 213 |
conveniently if you put their names in registers. Here's the Lisp code |
|---|
| 214 |
used to put a file name in a register: |
|---|
| 215 |
|
|---|
| 216 |
(set-register ?R '(file . NAME)) |
|---|
| 217 |
|
|---|
| 218 |
For example, |
|---|
| 219 |
|
|---|
| 220 |
(set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog")) |
|---|
| 221 |
|
|---|
| 222 |
puts the file name shown in register `z'. |
|---|
| 223 |
|
|---|
| 224 |
To visit the file whose name is in register R, type `C-x r j R'. |
|---|
| 225 |
(This is the same command used to jump to a position or restore a frame |
|---|
| 226 |
configuration.) |
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 |
File: emacs, Node: Bookmarks, Prev: RegNumbers, Up: Registers |
|---|
| 230 |
|
|---|
| 231 |
Bookmarks |
|---|
| 232 |
========= |
|---|
| 233 |
|
|---|
| 234 |
"Bookmarks" are somewhat like registers in that they record |
|---|
| 235 |
positions you can jump to. Unlike registers, they have long names, and |
|---|
| 236 |
they persist automatically from one Emacs session to the next. The |
|---|
| 237 |
prototypical use of bookmarks is to record "where you were reading" in |
|---|
| 238 |
various files. |
|---|
| 239 |
|
|---|
| 240 |
`C-x r m <RET>' |
|---|
| 241 |
Set the bookmark for the visited file, at point. |
|---|
| 242 |
|
|---|
| 243 |
`C-x r m BOOKMARK <RET>' |
|---|
| 244 |
Set the bookmark named BOOKMARK at point (`bookmark-set'). |
|---|
| 245 |
|
|---|
| 246 |
`C-x r b BOOKMARK <RET>' |
|---|
| 247 |
Jump to the bookmark named BOOKMARK (`bookmark-jump'). |
|---|
| 248 |
|
|---|
| 249 |
`C-x r l' |
|---|
| 250 |
List all bookmarks (`list-bookmarks'). |
|---|
| 251 |
|
|---|
| 252 |
`M-x bookmark-save' |
|---|
| 253 |
Save all the current bookmark values in the default bookmark file. |
|---|
| 254 |
|
|---|
| 255 |
The prototypical use for bookmarks is to record one current position |
|---|
| 256 |
in each of several files. So the command `C-x r m', which sets a |
|---|
| 257 |
bookmark, uses the visited file name as the default for the bookmark |
|---|
| 258 |
name. If you name each bookmark after the file it points to, then you |
|---|
| 259 |
can conveniently revisit any of those files with `C-x r b', and move to |
|---|
| 260 |
the position of the bookmark at the same time. |
|---|
| 261 |
|
|---|
| 262 |
To display a list of all your bookmarks in a separate buffer, type |
|---|
| 263 |
`C-x r l' (`list-bookmarks'). If you switch to that buffer, you can |
|---|
| 264 |
use it to edit your bookmark definitions or annotate the bookmarks. |
|---|
| 265 |
Type `C-h m' in the bookmark buffer for more information about its |
|---|
| 266 |
special editing commands. |
|---|
| 267 |
|
|---|
| 268 |
When you kill Emacs, Emacs offers to save your bookmark values in |
|---|
| 269 |
your default bookmark file, `~/.emacs.bmk', if you have changed any |
|---|
| 270 |
bookmark values. You can also save the bookmarks at any time with the |
|---|
| 271 |
`M-x bookmark-save' command. The bookmark commands load your default |
|---|
| 272 |
bookmark file automatically. This saving and loading is how bookmarks |
|---|
| 273 |
persist from one Emacs session to the next. |
|---|
| 274 |
|
|---|
| 275 |
If you set the variable `bookmark-save-flag' to 1, then each command |
|---|
| 276 |
that sets a bookmark will also save your bookmarks; this way, you don't |
|---|
| 277 |
lose any bookmark values even if Emacs crashes. (The value, if a |
|---|
| 278 |
number, says how many bookmark modifications should go by between |
|---|
| 279 |
saving.) |
|---|
| 280 |
|
|---|
| 281 |
Bookmark position values are saved with surrounding context, so that |
|---|
| 282 |
`bookmark-jump' can find the proper position even if the file is |
|---|
| 283 |
modified slightly. The variable `bookmark-search-size' says how many |
|---|
| 284 |
characters of context to record on each side of the bookmark's position. |
|---|
| 285 |
|
|---|
| 286 |
Here are some additional commands for working with bookmarks: |
|---|
| 287 |
|
|---|
| 288 |
`M-x bookmark-load <RET> FILENAME <RET>' |
|---|
| 289 |
Load a file named FILENAME that contains a list of bookmark |
|---|
| 290 |
values. You can use this command, as well as `bookmark-write', to |
|---|
| 291 |
work with other files of bookmark values in addition to your |
|---|
| 292 |
default bookmark file. |
|---|
| 293 |
|
|---|
| 294 |
`M-x bookmark-write <RET> FILENAME <RET>' |
|---|
| 295 |
Save all the current bookmark values in the file FILENAME. |
|---|
| 296 |
|
|---|
| 297 |
`M-x bookmark-delete <RET> BOOKMARK <RET>' |
|---|
| 298 |
Delete the bookmark named BOOKMARK. |
|---|
| 299 |
|
|---|
| 300 |
`M-x bookmark-insert-location <RET> BOOKMARK <RET>' |
|---|
| 301 |
Insert in the buffer the name of the file that bookmark BOOKMARK |
|---|
| 302 |
points to. |
|---|
| 303 |
|
|---|
| 304 |
`M-x bookmark-insert <RET> BOOKMARK <RET>' |
|---|
| 305 |
Insert in the buffer the _contents_ of the file that bookmark |
|---|
| 306 |
BOOKMARK points to. |
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 |
File: emacs, Node: Display, Next: Search, Prev: Registers, Up: Top |
|---|
| 310 |
|
|---|
| 311 |
Controlling the Display |
|---|
| 312 |
*********************** |
|---|
| 313 |
|
|---|
| 314 |
Since only part of a large buffer fits in the window, Emacs tries to |
|---|
| 315 |
show a part that is likely to be interesting. Display-control commands |
|---|
| 316 |
allow you to specify which part of the text you want to see, and how to |
|---|
| 317 |
display it. |
|---|
| 318 |
|
|---|
| 319 |
* Menu: |
|---|
| 320 |
|
|---|
| 321 |
* Faces:: How to change the display style using faces. |
|---|
| 322 |
* Font Lock:: Minor mode for syntactic highlighting using faces. |
|---|
| 323 |
* Highlight Changes:: Using colors to show where you changed the buffer. |
|---|
| 324 |
* Highlight Interactively:: Tell Emacs what text to highlight. |
|---|
| 325 |
* Trailing Whitespace:: Showing possibly-spurious trailing whitespace. |
|---|
| 326 |
* Scrolling:: Moving text up and down in a window. |
|---|
| 327 |
* Horizontal Scrolling:: Moving text left and right in a window. |
|---|
| 328 |
* Follow Mode:: Follow mode lets two windows scroll as one. |
|---|
| 329 |
* Selective Display:: Hiding lines with lots of indentation. |
|---|
| 330 |
* Optional Mode Line:: Optional mode line display features. |
|---|
| 331 |
* Text Display:: How text characters are normally displayed. |
|---|
| 332 |
* Display Custom:: Information on variables for customizing display. |
|---|
| 333 |
* Cursor Display:: Features for displaying the cursor. |
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
File: emacs, Node: Faces, Next: Font Lock, Up: Display |
|---|
| 337 |
|
|---|
| 338 |
Using Multiple Typefaces |
|---|
| 339 |
======================== |
|---|
| 340 |
|
|---|
| 341 |
When using Emacs with a window system, you can set up multiple |
|---|
| 342 |
styles of displaying characters. Each style is called a "face". Each |
|---|
| 343 |
face can specify various attributes, such as the height, weight and |
|---|
| 344 |
slant of the characters, the foreground and background color, and |
|---|
| 345 |
underlining. But it does not have to specify all of them. |
|---|
| 346 |
|
|---|
| 347 |
Emacs on a character terminal supports only part of face attributes. |
|---|
| 348 |
Which attributes are supported depends on your display type, but many |
|---|
| 349 |
displays support inverse video, bold, and underline attributes, and |
|---|
| 350 |
some support colors. |
|---|
| 351 |
|
|---|
| 352 |
Features which rely on text in multiple faces (such as Font Lock |
|---|
| 353 |
mode) will also work on non-windowed terminals that can display more |
|---|
| 354 |
than one face, whether by colors or underlining and emboldening. This |
|---|
| 355 |
includes the console on GNU/Linux, an `xterm' which supports colors, the |
|---|
| 356 |
MS-DOS display (*note MS-DOS::), and the MS-Windows version invoked with |
|---|
| 357 |
the `-nw' option. Emacs determines automatically whether the terminal |
|---|
| 358 |
has this capability. |
|---|
| 359 |
|
|---|
| 360 |
You control the appearance of a part of the text in the buffer by |
|---|
| 361 |
specifying the face or faces to use for it. The style of display used |
|---|
| 362 |
for any given character is determined by combining the attributes of |
|---|
| 363 |
all the applicable faces specified for that character. Any attribute |
|---|
| 364 |
that isn't specified by these faces is taken from the `default' face, |
|---|
| 365 |
whose attributes reflect the default settings of the frame itself. |
|---|
| 366 |
|
|---|
| 367 |
Enriched mode, the mode for editing formatted text, includes several |
|---|
| 368 |
commands and menus for specifying faces for text in the buffer. *Note |
|---|
| 369 |
Format Faces::, for how to specify the font for text in the buffer. |
|---|
| 370 |
*Note Format Colors::, for how to specify the foreground and background |
|---|
| 371 |
color. |
|---|
| 372 |
|
|---|
| 373 |
To alter the appearance of a face, use the customization buffer. |
|---|
| 374 |
*Note Face Customization::. You can also use X resources to specify |
|---|
| 375 |
attributes of particular faces (*note Resources X::). Alternatively, |
|---|
| 376 |
you can change the foreground and background colors of a specific face |
|---|
| 377 |
with `M-x set-face-foreground' and `M-x set-face-background'. These |
|---|
| 378 |
commands prompt in the minibuffer for a face name and a color name, |
|---|
| 379 |
with completion, and then set that face to use the specified color. |
|---|
| 380 |
Changing the colors of the `default' face also changes the foreground |
|---|
| 381 |
and background colors on all frames, both existing and those to be |
|---|
| 382 |
created in the future. (You can also set foreground and background |
|---|
| 383 |
colors for the current frame only; see *Note Frame Parameters::.) |
|---|
| 384 |
|
|---|
| 385 |
Emacs 21 can correctly display variable-width fonts, but Emacs |
|---|
| 386 |
commands that calculate width and indentation do not know how to |
|---|
| 387 |
calculate variable widths. This can sometimes lead to incorrect |
|---|
| 388 |
results when you use variable-width fonts. In particular, indentation |
|---|
| 389 |
commands can give inconsistent results, so we recommend you avoid |
|---|
| 390 |
variable-width fonts for editing program source code. Filling will |
|---|
| 391 |
sometimes make lines too long or too short. We plan to address these |
|---|
| 392 |
issues in future Emacs versions. |
|---|
| 393 |
|
|---|
| 394 |
To see what faces are currently defined, and what they look like, |
|---|
| 395 |
type `M-x list-faces-display'. It's possible for a given face to look |
|---|
| 396 |
different in different frames; this command shows the appearance in the |
|---|
| 397 |
frame in which you type it. Here's a list of the standard defined |
|---|
| 398 |
faces: |
|---|
| 399 |
|
|---|
| 400 |
`default' |
|---|
| 401 |
This face is used for ordinary text that doesn't specify any other |
|---|
| 402 |
face. |
|---|
| 403 |
|
|---|
| 404 |
`mode-line' |
|---|
| 405 |
This face is used for mode lines. By default, it's drawn with |
|---|
| 406 |
shadows for a "raised" effect on window systems, and drawn as the |
|---|
| 407 |
inverse of the default face on non-windowed terminals. *Note |
|---|
| 408 |
Display Custom::. |
|---|
| 409 |
|
|---|
| 410 |
`header-line' |
|---|
| 411 |
Similar to `mode-line' for a window's header line. Most modes |
|---|
| 412 |
don't use the header line, but the Info mode does. |
|---|
| 413 |
|
|---|
| 414 |
`highlight' |
|---|
| 415 |
This face is used for highlighting portions of text, in various |
|---|
| 416 |
modes. For example, mouse-sensitive text is highlighted using |
|---|
| 417 |
this face. |
|---|
| 418 |
|
|---|
| 419 |
`isearch' |
|---|
| 420 |
This face is used for highlighting Isearch matches. |
|---|
| 421 |
|
|---|
| 422 |
`isearch-lazy-highlight-face' |
|---|
| 423 |
This face is used for lazy highlighting of Isearch matches other |
|---|
| 424 |
than the current one. |
|---|
| 425 |
|
|---|
| 426 |
`region' |
|---|
| 427 |
This face is used for displaying a selected region (when Transient |
|---|
| 428 |
Mark mode is enabled--see below). |
|---|
| 429 |
|
|---|
| 430 |
`secondary-selection' |
|---|
| 431 |
This face is used for displaying a secondary X selection (*note |
|---|
| 432 |
Secondary Selection::). |
|---|
| 433 |
|
|---|
| 434 |
`bold' |
|---|
| 435 |
This face uses a bold variant of the default font, if it has one. |
|---|
| 436 |
|
|---|
| 437 |
`italic' |
|---|
| 438 |
This face uses an italic variant of the default font, if it has |
|---|
| 439 |
one. |
|---|
| 440 |
|
|---|
| 441 |
`bold-italic' |
|---|
| 442 |
This face uses a bold italic variant of the default font, if it |
|---|
| 443 |
has one. |
|---|
| 444 |
|
|---|
| 445 |
`underline' |
|---|
| 446 |
This face underlines text. |
|---|
| 447 |
|
|---|
| 448 |
`fixed-pitch' |
|---|
| 449 |
The basic fixed-pitch face. |
|---|
| 450 |
|
|---|
| 451 |
`fringe' |
|---|
| 452 |
The face for the fringes to the left and right of windows on |
|---|
| 453 |
graphic displays. (The fringes are the narrow portions of the |
|---|
| 454 |
Emacs frame between the text area and the window's right and left |
|---|
| 455 |
borders.) |
|---|
| 456 |
|
|---|
| 457 |
`scroll-bar' |
|---|
| 458 |
This face determines the visual appearance of the scroll bar. |
|---|
| 459 |
|
|---|
| 460 |
`border' |
|---|
| 461 |
This face determines the color of the frame border. |
|---|
| 462 |
|
|---|
| 463 |
`cursor' |
|---|
| 464 |
This face determines the color of the cursor. |
|---|
| 465 |
|
|---|
| 466 |
`mouse' |
|---|
| 467 |
This face determines the color of the mouse pointer. |
|---|
| 468 |
|
|---|
| 469 |
`tool-bar' |
|---|
| 470 |
This is the basic tool-bar face. No text appears in the tool bar, |
|---|
| 471 |
but the colors of this face affect the appearance of tool bar |
|---|
| 472 |
icons. |
|---|
| 473 |
|
|---|
| 474 |
`tooltip' |
|---|
| 475 |
This face is used for tooltips. |
|---|
| 476 |
|
|---|
| 477 |
`menu' |
|---|
| 478 |
This face determines the colors and font of Emacs's menus. |
|---|
| 479 |
Setting the font of LessTif/Motif menus is currently not |
|---|
| 480 |
supported; attempts to set the font are ignored in this case. |
|---|
| 481 |
|
|---|
| 482 |
`trailing-whitespace' |
|---|
| 483 |
The face for highlighting trailing whitespace when |
|---|
| 484 |
`show-trailing-whitespace' is non-nil; see *Note Trailing |
|---|
| 485 |
Whitespace::. |
|---|
| 486 |
|
|---|
| 487 |
`variable-pitch' |
|---|
| 488 |
The basic variable-pitch face. |
|---|
| 489 |
|
|---|
| 490 |
When Transient Mark mode is enabled, the text of the region is |
|---|
| 491 |
highlighted when the mark is active. This uses the face named |
|---|
| 492 |
`region'; you can control the style of highlighting by changing the |
|---|
| 493 |
style of this face (*note Face Customization::). *Note Transient |
|---|
| 494 |
Mark::, for more information about Transient Mark mode and activation |
|---|
| 495 |
and deactivation of the mark. |
|---|
| 496 |
|
|---|
| 497 |
One easy way to use faces is to turn on Font Lock mode. This minor |
|---|
| 498 |
mode, which is always local to a particular buffer, arranges to choose |
|---|
| 499 |
faces according to the syntax of the text you are editing. It can |
|---|
| 500 |
recognize comments and strings in most languages; in several languages, |
|---|
| 501 |
it can also recognize and properly highlight various other important |
|---|
| 502 |
constructs. *Note Font Lock::, for more information about Font Lock |
|---|
| 503 |
mode and syntactic highlighting. |
|---|
| 504 |
|
|---|
| 505 |
You can print out the buffer with the highlighting that appears on |
|---|
| 506 |
your screen using the command `ps-print-buffer-with-faces'. *Note |
|---|
| 507 |
PostScript::. |
|---|
| 508 |
|
|---|
| 509 |
|
|---|
| 510 |
File: emacs, Node: Font Lock, Next: Highlight Changes, Prev: Faces, Up: Display |
|---|
| 511 |
|
|---|
| 512 |
Font Lock mode |
|---|
| 513 |
============== |
|---|
| 514 |
|
|---|
| 515 |
Font Lock mode is a minor mode, always local to a particular buffer, |
|---|
| 516 |
which highlights (or "fontifies") using various faces according to the |
|---|
| 517 |
syntax of the text you are editing. It can recognize comments and |
|---|
| 518 |
strings in most languages; in several languages, it can also recognize |
|---|
| 519 |
and properly highlight various other important constructs--for example, |
|---|
| 520 |
names of functions being defined or reserved keywords. |
|---|
| 521 |
|
|---|
| 522 |
The command `M-x font-lock-mode' turns Font Lock mode on or off |
|---|
| 523 |
according to the argument, and toggles the mode when it has no argument. |
|---|
| 524 |
The function `turn-on-font-lock' unconditionally enables Font Lock |
|---|
| 525 |
mode. This is useful in mode-hook functions. For example, to enable |
|---|
| 526 |
Font Lock mode whenever you edit a C file, you can do this: |
|---|
| 527 |
|
|---|
| 528 |
(add-hook 'c-mode-hook 'turn-on-font-lock) |
|---|
| 529 |
|
|---|
| 530 |
To turn on Font Lock mode automatically in all modes which support |
|---|
| 531 |
it, customize the user option `global-font-lock-mode' or use the |
|---|
| 532 |
function `global-font-lock-mode' in your `.emacs' file, like this: |
|---|
| 533 |
|
|---|
| 534 |
(global-font-lock-mode 1) |
|---|
| 535 |
|
|---|
| 536 |
Font Lock mode uses several specifically named faces to do its job, |
|---|
| 537 |
including `font-lock-string-face', `font-lock-comment-face', and |
|---|
| 538 |
others. The easiest way to find them all is to use completion on the |
|---|
| 539 |
face name in `set-face-foreground'. |
|---|
| 540 |
|
|---|
| 541 |
To change the colors or the fonts used by Font Lock mode to fontify |
|---|
| 542 |
different parts of text, just change these faces. There are two ways |
|---|
| 543 |
to do it: |
|---|
| 544 |
|
|---|
| 545 |
* Invoke `M-x set-face-foreground' or `M-x set-face-background' to |
|---|
| 546 |
change the colors of a particular face used by Font Lock. *Note |
|---|
| 547 |
Faces::. The command `M-x list-faces-display' displays all the |
|---|
| 548 |
faces currently known to Emacs, including those used by Font Lock. |
|---|
| 549 |
|
|---|
| 550 |
* Customize the faces interactively with `M-x customize-face', as |
|---|
| 551 |
described in *Note Face Customization::. |
|---|
| 552 |
|
|---|
| 553 |
To get the full benefit of Font Lock mode, you need to choose a |
|---|
| 554 |
default font which has bold, italic, and bold-italic variants; or else |
|---|
| 555 |
you need to have a color or gray-scale screen. |
|---|
| 556 |
|
|---|
| 557 |
The variable `font-lock-maximum-decoration' specifies the preferred |
|---|
| 558 |
level of fontification, for modes that provide multiple levels. Level |
|---|
| 559 |
1 is the least amount of fontification; some modes support levels as |
|---|
| 560 |
high as 3. The normal default is "as high as possible." You can |
|---|
| 561 |
specify an integer, which applies to all modes, or you can specify |
|---|
| 562 |
different numbers for particular major modes; for example, to use level |
|---|
| 563 |
1 for C/C++ modes, and the default level otherwise, use this: |
|---|
| 564 |
|
|---|
| 565 |
(setq font-lock-maximum-decoration |
|---|
| 566 |
'((c-mode . 1) (c++-mode . 1))) |
|---|
| 567 |
|
|---|
| 568 |
Fontification can be too slow for large buffers, so you can suppress |
|---|
| 569 |
it. The variable `font-lock-maximum-size' specifies a buffer size, |
|---|
| 570 |
beyond which buffer fontification is suppressed. |
|---|
| 571 |
|
|---|
| 572 |
Comment and string fontification (or "syntactic" fontification) |
|---|
| 573 |
relies on analysis of the syntactic structure of the buffer text. For |
|---|
| 574 |
the sake of speed, some modes, including C mode and Lisp mode, rely on |
|---|
| 575 |
a special convention: an open-parenthesis or open-brace in the leftmost |
|---|
| 576 |
column always defines the beginning of a defun, and is thus always |
|---|
| 577 |
outside any string or comment. (*Note Left Margin Paren::.) If you |
|---|
| 578 |
don't follow this convention, Font Lock mode can misfontify the text |
|---|
| 579 |
that follows an open-parenthesis or open-brace in the leftmost column |
|---|
| 580 |
that is inside a string or comment. |
|---|
| 581 |
|
|---|
| 582 |
The variable `font-lock-beginning-of-syntax-function' (always |
|---|
| 583 |
buffer-local) specifies how Font Lock mode can find a position |
|---|
| 584 |
guaranteed to be outside any comment or string. In modes which use the |
|---|
| 585 |
leftmost column parenthesis convention, the default value of the |
|---|
| 586 |
variable is `beginning-of-defun'--that tells Font Lock mode to use the |
|---|
| 587 |
convention. If you set this variable to `nil', Font Lock no longer |
|---|
| 588 |
relies on the convention. This avoids incorrect results, but the price |
|---|
| 589 |
is that, in some cases, fontification for a changed text must rescan |
|---|
| 590 |
buffer text from the beginning of the buffer. This can considerably |
|---|
| 591 |
slow down redisplay while scrolling, particularly if you are close to |
|---|
| 592 |
the end of a large buffer. |
|---|
| 593 |
|
|---|
| 594 |
Font Lock highlighting patterns already exist for many modes, but you |
|---|
| 595 |
may want to fontify additional patterns. You can use the function |
|---|
| 596 |
`font-lock-add-keywords', to add your own highlighting patterns for a |
|---|
| 597 |
particular mode. For example, to highlight `FIXME:' words in C |
|---|
| 598 |
comments, use this: |
|---|
| 599 |
|
|---|
| 600 |
(font-lock-add-keywords |
|---|
| 601 |
'c-mode |
|---|
| 602 |
'(("\\<\\(FIXME\\):" 1 font-lock-warning-face t))) |
|---|
| 603 |
|
|---|
| 604 |
To remove keywords from the font-lock highlighting patterns, use the |
|---|
| 605 |
function `font-lock-remove-keywords'. |
|---|
| 606 |
|
|---|
| 607 |
|
|---|
| 608 |
File: emacs, Node: Highlight Changes, Next: Highlight Interactively, Prev: Font Lock, Up: Display |
|---|
| 609 |
|
|---|
| 610 |
Highlight Changes Mode |
|---|
| 611 |
====================== |
|---|
| 612 |
|
|---|
| 613 |
Use `M-x highlight-changes-mode' to enable a minor mode that uses |
|---|
| 614 |
faces (colors, typically) to indicate which parts of the buffer were |
|---|
| 615 |
changed most recently. |
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
File: emacs, Node: Highlight Interactively, Next: Trailing Whitespace, Prev: Highlight Changes, Up: Display |
|---|
| 619 |
|
|---|
| 620 |
Interactive Highlighting by Matching |
|---|
| 621 |
==================================== |
|---|
| 622 |
|
|---|
| 623 |
It is sometimes useful to highlight the strings that match a certain |
|---|
| 624 |
regular expression. For example, you might wish to see all the |
|---|
| 625 |
references to a certain variable in a program source file, or highlight |
|---|
| 626 |
certain parts in a voluminous output of some program, or make certain |
|---|
| 627 |
cliches stand out in an article. |
|---|
| 628 |
|
|---|
| 629 |
Use the `M-x hi-lock-mode' command to turn on a minor mode that |
|---|
| 630 |
allows you to specify regular expressions of the text to be |
|---|
| 631 |
highlighted. Hi-lock mode works like Font Lock (*note Font Lock::), |
|---|
| 632 |
except that it lets you specify explicitly what parts of text to |
|---|
| 633 |
highlight. You control Hi-lock mode with these commands: |
|---|
| 634 |
|
|---|
| 635 |
`C-x w h REGEXP <RET> FACE <RET>' |
|---|
| 636 |
Highlight text that matches REGEXP using face FACE |
|---|
| 637 |
(`highlight-regexp'). By using this command more than once, you |
|---|
| 638 |
can highlight various parts of the text in different ways. |
|---|
| 639 |
|
|---|
| 640 |
`C-x w r REGEXP <RET>' |
|---|
| 641 |
Unhighlight REGEXP (`unhighlight-regexp'). You must enter one of |
|---|
| 642 |
the regular expressions currently specified for highlighting. |
|---|
| 643 |
(You can use completion, or choose from a menu, to enter one of |
|---|
| 644 |
them conveniently.) |
|---|
| 645 |
|
|---|
| 646 |
`C-x w l REGEXP <RET> FACE <RET>' |
|---|
| 647 |
Highlight entire lines containing a match for REGEXP, using face |
|---|
| 648 |
FACE (`highlight-lines-matching-regexp'). |
|---|
| 649 |
|
|---|
| 650 |
`C-x w b' |
|---|
| 651 |
Insert all the current highlighting regexp/face pairs into the |
|---|
| 652 |
buffer at point, with comment delimiters to prevent them from |
|---|
| 653 |
changing your program. This key binding runs the |
|---|
| 654 |
`hi-lock-write-interactive-patterns' command. |
|---|
| 655 |
|
|---|
| 656 |
These patterns will be read the next time you visit the file while |
|---|
| 657 |
Hi-lock mode is enabled, or whenever you use the `M-x |
|---|
| 658 |
hi-lock-find-patterns' command. |
|---|
| 659 |
|
|---|
| 660 |
`C-x w i' |
|---|
| 661 |
Re-read regexp/face pairs in the current buffer |
|---|
| 662 |
(`hi-lock-write-interactive-patterns'). The list of pairs is |
|---|
| 663 |
found no matter where in the buffer it may be. |
|---|
| 664 |
|
|---|
| 665 |
This command does nothing if the major mode is a member of the list |
|---|
| 666 |
`hi-lock-exclude-modes'. |
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
File: emacs, Node: Trailing Whitespace, Next: Scrolling, Prev: Highlight Interactively, Up: Display |
|---|
| 670 |
|
|---|
| 671 |
Trailing Whitespace |
|---|
| 672 |
=================== |
|---|
| 673 |
|
|---|
| 674 |
It is easy to leave unnecessary spaces at the end of a line without |
|---|
| 675 |
realizing it. In most cases, this "trailing whitespace" has no effect, |
|---|
| 676 |
but there are special circumstances where it matters. |
|---|
| 677 |
|
|---|
| 678 |
You can make trailing whitespace visible on the screen by setting the |
|---|
| 679 |
buffer-local variable `show-trailing-whitespace' to `t'. Then Emacs |
|---|
| 680 |
displays trailing whitespace in the face `trailing-whitespace'. |
|---|
| 681 |
|
|---|
| 682 |
Trailing whitespace is defined as spaces or tabs at the end of a |
|---|
| 683 |
line. But trailing whitespace is not displayed specially if point is |
|---|
| 684 |
at the end of the line containing the whitespace. (Doing that looks |
|---|
| 685 |
ugly while you are typing in new text, and the location of point is |
|---|
| 686 |
enough in that case to show you that the spaces are present.) |
|---|
| 687 |
|
|---|
| 688 |
To delete all trailing whitespace within the current buffer's |
|---|
| 689 |
restriction (*note Narrowing::), type `M-x delete-trailing-whitespace |
|---|
| 690 |
<RET>'. (This command does not remove the form-feed characters.) |
|---|
| 691 |
|
|---|
| 692 |
Emacs can indicate empty lines at the end of the buffer with a |
|---|
| 693 |
special bitmap on the left fringe of the window. To enable this |
|---|
| 694 |
feature, set the buffer-local variable `indicate-empty-lines' to a |
|---|
| 695 |
non-`nil' value. The default value of this variable is controlled by |
|---|
| 696 |
the variable `default-indicate-empty-lines'; by setting that variable, |
|---|
| 697 |
you can enable or disable this feature for all new buffers. |
|---|
| 698 |
|
|---|
| 699 |
|
|---|
| 700 |
File: emacs, Node: Scrolling, Next: Horizontal Scrolling, Prev: Trailing Whitespace, Up: Display |
|---|
| 701 |
|
|---|
| 702 |
Scrolling |
|---|
| 703 |
========= |
|---|
| 704 |
|
|---|
| 705 |
If a buffer contains text that is too large to fit entirely within a |
|---|
| 706 |
window that is displaying the buffer, Emacs shows a contiguous portion |
|---|
| 707 |
of the text. The portion shown always contains point. |
|---|
| 708 |
|
|---|
| 709 |
"Scrolling" means moving text up or down in the window so that |
|---|
| 710 |
different parts of the text are visible. Scrolling forward means that |
|---|
| 711 |
text moves up, and new text appears at the bottom. Scrolling backward |
|---|
| 712 |
moves text down and new text appears at the top. |
|---|
| 713 |
|
|---|
| 714 |
Scrolling happens automatically if you move point past the bottom or |
|---|
| 715 |
top of the window. You can also explicitly request scrolling with the |
|---|
| 716 |
commands in this section. |
|---|
| 717 |
|
|---|
| 718 |
`C-l' |
|---|
| 719 |
Clear screen and redisplay, scrolling the selected window to center |
|---|
| 720 |
point vertically within it (`recenter'). |
|---|
| 721 |
|
|---|
| 722 |
`C-v' |
|---|
| 723 |
Scroll forward (a windowful or a specified number of lines) |
|---|
| 724 |
(`scroll-up'). |
|---|
| 725 |
|
|---|
| 726 |
`<NEXT>' |
|---|
| 727 |
`<PAGEDOWN>' |
|---|
| 728 |
Likewise, scroll forward. |
|---|
| 729 |
|
|---|
| 730 |
`M-v' |
|---|
| 731 |
Scroll backward (`scroll-down'). |
|---|
| 732 |
|
|---|
| 733 |
`<PRIOR>' |
|---|
| 734 |
`<PAGEUP>' |
|---|
| 735 |
Likewise, scroll backward. |
|---|
| 736 |
|
|---|
| 737 |
`ARG C-l' |
|---|
| 738 |
Scroll so point is on line ARG (`recenter'). |
|---|
| 739 |
|
|---|
| 740 |
`C-M-l' |
|---|
| 741 |
Scroll heuristically to bring useful information onto the screen |
|---|
| 742 |
(`reposition-window'). |
|---|
| 743 |
|
|---|
| 744 |
The most basic scrolling command is `C-l' (`recenter') with no |
|---|
| 745 |
argument. It clears the entire screen and redisplays all windows. In |
|---|
| 746 |
addition, it scrolls the selected window so that point is halfway down |
|---|
| 747 |
from the top of the window. |
|---|
| 748 |
|
|---|
| 749 |
To read the buffer a windowful at a time, use `C-v' (`scroll-up') |
|---|
| 750 |
with no argument. This scrolls forward by nearly the whole window |
|---|
| 751 |
height. The effect is to take the two lines at the bottom of the |
|---|
| 752 |
window and put them at the top, followed by nearly a whole windowful of |
|---|
| 753 |
lines that were not previously visible. If point was in the text that |
|---|
| 754 |
scrolled off the top, it ends up at the new top of the window. |
|---|
| 755 |
|
|---|
| 756 |
`M-v' (`scroll-down') with no argument scrolls backward in a similar |
|---|
| 757 |
way, also with overlap. The number of lines of overlap across a `C-v' |
|---|
| 758 |
or `M-v' is controlled by the variable `next-screen-context-lines'; by |
|---|
| 759 |
default, it is 2. The function keys <NEXT> and <PRIOR>, or <PAGEDOWN> |
|---|
| 760 |
and <PAGEUP>, are equivalent to `C-v' and `M-v'. |
|---|
| 761 |
|
|---|
| 762 |
The commands `C-v' and `M-v' with a numeric argument scroll the text |
|---|
| 763 |
in the selected window up or down a few lines. `C-v' with an argument |
|---|
| 764 |
moves the text and point up, together, that many lines; it brings the |
|---|
| 765 |
same number of new lines into view at the bottom of the window. `M-v' |
|---|
| 766 |
with numeric argument scrolls the text downward, bringing that many new |
|---|
| 767 |
lines into view at the top of the window. `C-v' with a negative |
|---|
| 768 |
argument is like `M-v' and vice versa. |
|---|
| 769 |
|
|---|
| 770 |
The names of scroll commands are based on the direction that the |
|---|
| 771 |
text moves in the window. Thus, the command to scroll forward is |
|---|
| 772 |
called `scroll-up' because it moves the text upward on the screen. The |
|---|
| 773 |
keys <PAGEDOWN> and <PAGEUP> derive their names and customary meanings |
|---|
| 774 |
from a different convention that developed elsewhere; hence the strange |
|---|
| 775 |
result that <PAGEDOWN> runs `scroll-up'. |
|---|
| 776 |
|
|---|
| 777 |
Some users like the full-screen scroll commands to keep point at the |
|---|
| 778 |
same screen line. To enable this behavior, set the variable |
|---|
| 779 |
`scroll-preserve-screen-position' to a non-`nil' value. This mode is |
|---|
| 780 |
convenient for browsing through a file by scrolling by screenfuls; if |
|---|
| 781 |
you come back to the screen where you started, point goes back to the |
|---|
| 782 |
line where it started. However, this mode is inconvenient when you |
|---|
| 783 |
move to the next screen in order to move point to the text there. |
|---|
| 784 |
|
|---|
| 785 |
Another way to do scrolling is with `C-l' with a numeric argument. |
|---|
| 786 |
`C-l' does not clear the screen when given an argument; it only scrolls |
|---|
| 787 |
the selected window. With a positive argument N, it repositions text |
|---|
| 788 |
to put point N lines down from the top. An argument of zero puts point |
|---|
| 789 |
on the very top line. Point does not move with respect to the text; |
|---|
| 790 |
rather, the text and point move rigidly on the screen. `C-l' with a |
|---|
| 791 |
negative argument puts point that many lines from the bottom of the |
|---|
| 792 |
window. For example, `C-u - 1 C-l' puts point on the bottom line, and |
|---|
| 793 |
`C-u - 5 C-l' puts it five lines from the bottom. `C-u C-l' scrolls to |
|---|
| 794 |
put point at the center (vertically) of the selected window. |
|---|
| 795 |
|
|---|
| 796 |
The `C-M-l' command (`reposition-window') scrolls the current window |
|---|
| 797 |
heuristically in a way designed to get useful information onto the |
|---|
| 798 |
screen. For example, in a Lisp file, this command tries to get the |
|---|
| 799 |
entire current defun onto the screen if possible. |
|---|
| 800 |
|
|---|
| 801 |
Scrolling happens automatically when point moves out of the visible |
|---|
| 802 |
portion of the text. Normally, automatic scrolling centers point |
|---|
| 803 |
vertically within the window. However, if you set |
|---|
| 804 |
`scroll-conservatively' to a small number N, then if you move point |
|---|
| 805 |
just a little off the screen--less than N lines--then Emacs scrolls the |
|---|
| 806 |
text just far enough to bring point back on screen. By default, |
|---|
| 807 |
`scroll-conservatively' is 0. |
|---|
| 808 |
|
|---|
| 809 |
When the window does scroll by a longer distance, you can control |
|---|
| 810 |
how aggressively it scrolls, by setting the variables |
|---|
| 811 |
`scroll-up-aggressively' and `scroll-down-aggressively'. The value of |
|---|
| 812 |
`scroll-up-aggressively' should be either `nil', or a fraction F |
|---|
| 813 |
between 0 and 1. A fraction specifies where on the screen to put point |
|---|
| 814 |
when scrolling upward. More precisely, when a window scrolls up |
|---|
| 815 |
because point is above the window start, the new start position is |
|---|
| 816 |
chosen to put point F part of the window height from the top. The |
|---|
| 817 |
larger F, the more aggressive the scrolling. |
|---|
| 818 |
|
|---|
| 819 |
`nil', which is the default, scrolls to put point at the center. So |
|---|
| 820 |
it is equivalent to .5. |
|---|
| 821 |
|
|---|
| 822 |
Likewise, `scroll-down-aggressively' is used for scrolling down. |
|---|
| 823 |
The value, F, specifies how far point should be placed from the bottom |
|---|
| 824 |
of the window; thus, as with `scroll-up-aggressively', a larger value |
|---|
| 825 |
is more aggressive. |
|---|
| 826 |
|
|---|
| 827 |
The variable `scroll-margin' restricts how close point can come to |
|---|
| 828 |
the top or bottom of a window. Its value is a number of screen lines; |
|---|
| 829 |
if point comes within that many lines of the top or bottom of the |
|---|
| 830 |
window, Emacs recenters the window. By default, `scroll-margin' is 0. |
|---|
| 831 |
|
|---|
| 832 |
|
|---|
| 833 |
File: emacs, Node: Horizontal Scrolling, Next: Follow Mode, Prev: Scrolling, Up: Display |
|---|
| 834 |
|
|---|
| 835 |
Horizontal Scrolling |
|---|
| 836 |
==================== |
|---|
| 837 |
|
|---|
| 838 |
"Horizontal scrolling" means shifting all the lines sideways within |
|---|
| 839 |
a window--so that some of the text near the left margin is not |
|---|
| 840 |
displayed at all. Emacs does this automatically in any window that |
|---|
| 841 |
uses line truncation rather than continuation: whenever point moves off |
|---|
| 842 |
the left or right edge of the screen, Emacs scrolls the buffer |
|---|
| 843 |
horizontally to make point visible. |
|---|
| 844 |
|
|---|
| 845 |
When a window has been scrolled horizontally, text lines are |
|---|
| 846 |
truncated rather than continued (*note Continuation Lines::), with a `$' |
|---|
| 847 |
appearing in the first column when there is text truncated to the left, |
|---|
| 848 |
and in the last column when there is text truncated to the right. |
|---|
| 849 |
|
|---|
| 850 |
You can use these commands to do explicit horizontal scrolling. |
|---|
| 851 |
|
|---|
| 852 |
`C-x <' |
|---|
| 853 |
Scroll text in current window to the left (`scroll-left'). |
|---|
| 854 |
|
|---|
| 855 |
`C-x >' |
|---|
| 856 |
Scroll to the right (`scroll-right'). |
|---|
| 857 |
|
|---|
| 858 |
The command `C-x <' (`scroll-left') scrolls the selected window to |
|---|
| 859 |
the left by N columns with argument N. This moves part of the |
|---|
| 860 |
beginning of each line off the left edge of the window. With no |
|---|
| 861 |
argument, it scrolls by almost the full width of the window (two |
|---|
| 862 |
columns less, to be precise). |
|---|
| 863 |
|
|---|
| 864 |
`C-x >' (`scroll-right') scrolls similarly to the right. The window |
|---|
| 865 |
cannot be scrolled any farther to the right once it is displayed |
|---|
| 866 |
normally (with each line starting at the window's left margin); |
|---|
| 867 |
attempting to do so has no effect. This means that you don't have to |
|---|
| 868 |
calculate the argument precisely for `C-x >'; any sufficiently large |
|---|
| 869 |
argument will restore the normal display. |
|---|
| 870 |
|
|---|
| 871 |
If you scroll a window horizontally by hand, that sets a lower bound |
|---|
| 872 |
for automatic horizontal scrolling. Automatic scrolling will continue |
|---|
| 873 |
to scroll the window, but never farther to the right than the amount |
|---|
| 874 |
you previously set by `scroll-left'. |
|---|
| 875 |
|
|---|
| 876 |
To disable automatic horizontal scrolling, set the variable |
|---|
| 877 |
`automatic-hscrolling' to `nil'. |
|---|
| 878 |
|
|---|
| 879 |
|
|---|
| 880 |
File: emacs, Node: Follow Mode, Next: Selective Display, Prev: Horizontal Scrolling, Up: Display |
|---|
| 881 |
|
|---|
| 882 |
Follow Mode |
|---|
| 883 |
=========== |
|---|
| 884 |
|
|---|
| 885 |
"Follow mode" is a minor mode that makes two windows showing the |
|---|
| 886 |
same buffer scroll as one tall "virtual window." To use Follow mode, |
|---|
| 887 |
go to a frame with just one window, split it into two side-by-side |
|---|
| 888 |
windows using `C-x 3', and then type `M-x follow-mode'. From then on, |
|---|
| 889 |
you can edit the buffer in either of the two windows, or scroll either |
|---|
| 890 |
one; the other window follows it. |
|---|
| 891 |
|
|---|
| 892 |
In Follow mode, if you move point outside the portion visible in one |
|---|
| 893 |
window and into the portion visible in the other window, that selects |
|---|
| 894 |
the other window--again, treating the two as if they were parts of one |
|---|
| 895 |
large window. |
|---|
| 896 |
|
|---|
| 897 |
To turn off Follow mode, type `M-x follow-mode' a second time. |
|---|
| 898 |
|
|---|
| 899 |
|
|---|
| 900 |
File: emacs, Node: Selective Display, Next: Optional Mode Line, Prev: Follow Mode, Up: Display |
|---|
| 901 |
|
|---|
| 902 |
Selective Display |
|---|
| 903 |
================= |
|---|
| 904 |
|
|---|
| 905 |
Emacs has the ability to hide lines indented more than a certain |
|---|
| 906 |
number of columns (you specify how many columns). You can use this to |
|---|
| 907 |
get an overview of a part of a program. |
|---|
| 908 |
|
|---|
| 909 |
To hide lines, type `C-x $' (`set-selective-display') with a numeric |
|---|
| 910 |
argument N. Then lines with at least N columns of indentation |
|---|
| 911 |
disappear from the screen. The only indication of their presence is |
|---|
| 912 |
that three dots (`...') appear at the end of each visible line that is |
|---|
| 913 |
followed by one or more hidden ones. |
|---|
| 914 |
|
|---|
| 915 |
The commands `C-n' and `C-p' move across the hidden lines as if they |
|---|
| 916 |
were not there. |
|---|
| 917 |
|
|---|
| 918 |
The hidden lines are still present in the buffer, and most editing |
|---|
| 919 |
commands see them as usual, so you may find point in the middle of the |
|---|
| 920 |
hidden text. When this happens, the cursor appears at the end of the |
|---|
| 921 |
previous line, after the three dots. If point is at the end of the |
|---|
| 922 |
visible line, before the newline that ends it, the cursor appears before |
|---|
| 923 |
the three dots. |
|---|
| 924 |
|
|---|
| 925 |
To make all lines visible again, type `C-x $' with no argument. |
|---|
| 926 |
|
|---|
| 927 |
If you set the variable `selective-display-ellipses' to `nil', the |
|---|
| 928 |
three dots do not appear at the end of a line that precedes hidden |
|---|
| 929 |
lines. Then there is no visible indication of the hidden lines. This |
|---|
| 930 |
variable becomes local automatically when set. |
|---|
| 931 |
|
|---|
| 932 |
|
|---|
| 933 |
File: emacs, Node: Optional Mode Line, Next: Text Display, Prev: Selective Display, Up: Display |
|---|
| 934 |
|
|---|
| 935 |
Optional Mode Line Features |
|---|
| 936 |
=========================== |
|---|
| 937 |
|
|---|
| 938 |
The current line number of point appears in the mode line when Line |
|---|
| 939 |
Number mode is enabled. Use the command `M-x line-number-mode' to turn |
|---|
| 940 |
this mode on and off; normally it is on. The line number appears |
|---|
| 941 |
before the buffer percentage POS, with the letter `L' to indicate what |
|---|
| 942 |
it is. *Note Minor Modes::, for more information about minor modes and |
|---|
| 943 |
about how to use this command. |
|---|
| 944 |
|
|---|
| 945 |
If you have narrowed the buffer (*note Narrowing::), the displayed |
|---|
| 946 |
line number is relative to the accessible portion of the buffer. |
|---|
| 947 |
|
|---|
| 948 |
If the buffer is very large (larger than the value of |
|---|
| 949 |
`line-number-display-limit'), then the line number doesn't appear. |
|---|
| 950 |
Emacs doesn't compute the line number when the buffer is large, because |
|---|
| 951 |
that would be too slow. Set it to `nil' to remove the limit. |
|---|
| 952 |
|
|---|
| 953 |
Line-number computation can also be slow if the lines in the buffer |
|---|
| 954 |
are too long. For this reason, Emacs normally doesn't display line |
|---|
| 955 |
numbers if the average width, in characters, of lines near point is |
|---|
| 956 |
larger than the value of the variable |
|---|
| 957 |
`line-number-display-limit-width'. The default value is 200 characters. |
|---|
| 958 |
|
|---|
| 959 |
You can also display the current column number by turning on Column |
|---|
| 960 |
Number mode. It displays the current column number preceded by the |
|---|
| 961 |
letter `C'. Type `M-x column-number-mode' to toggle this mode. |
|---|
| 962 |
|
|---|
| 963 |
Emacs can optionally display the time and system load in all mode |
|---|
| 964 |
lines. To enable this feature, type `M-x display-time' or customize |
|---|
| 965 |
the option `display-time-mode'. The information added to the mode line |
|---|
| 966 |
usually appears after the buffer name, before the mode names and their |
|---|
| 967 |
parentheses. It looks like this: |
|---|
| 968 |
|
|---|
| 969 |
HH:MMpm L.LL |
|---|
| 970 |
|
|---|
| 971 |
Here HH and MM are the hour and minute, followed always by `am' or |
|---|
| 972 |
`pm'. L.LL is the average number of running processes in the whole |
|---|
| 973 |
system recently. (Some fields may be missing if your operating system |
|---|
| 974 |
cannot support them.) If you prefer time display in 24-hour format, |
|---|
| 975 |
set the variable `display-time-24hr-format' to `t'. |
|---|
| 976 |
|
|---|
| 977 |
The word `Mail' appears after the load level if there is mail for |
|---|
| 978 |
you that you have not read yet. On a graphical display you can use an |
|---|
| 979 |
icon instead of `Mail' by customizing `display-time-use-mail-icon'; |
|---|
| 980 |
this may save some space on the mode line. You can customize |
|---|
| 981 |
`display-time-mail-face' to make the mail indicator prominent. |
|---|
| 982 |
|
|---|
| 983 |
By default, the mode line is drawn on graphics displays with |
|---|
| 984 |
3D-style highlighting, like that of a button when it is not being |
|---|
| 985 |
pressed. If you don't like this effect, you can disable the 3D |
|---|
| 986 |
highlighting of the mode line, by customizing the attributes of the |
|---|
| 987 |
`mode-line' face in your `.emacs' init file, like this: |
|---|
| 988 |
|
|---|
| 989 |
(set-face-attribute 'mode-line nil :box nil) |
|---|
| 990 |
|
|---|
| 991 |
Alternatively, you can turn off the box attribute in your `.Xdefaults' |
|---|
| 992 |
file: |
|---|
| 993 |
|
|---|
| 994 |
Emacs.mode-line.AttributeBox: off |
|---|
| 995 |
|
|---|
| 996 |
|
|---|
| 997 |
File: emacs, Node: Text Display, Next: Display Custom, Prev: Optional Mode Line, Up: Display |
|---|
| 998 |
|
|---|
| 999 |
How Text Is Displayed |
|---|
| 1000 |
===================== |
|---|
| 1001 |
|
|---|
| 1002 |
ASCII printing characters (octal codes 040 through 0176) in Emacs |
|---|
| 1003 |
buffers are displayed with their graphics, as are non-ASCII multibyte |
|---|
| 1004 |
printing characters (octal codes above 0400). |
|---|
| 1005 |
|
|---|
| 1006 |
Some ASCII control characters are displayed in special ways. The |
|---|
| 1007 |
newline character (octal code 012) is displayed by starting a new line. |
|---|
| 1008 |
The tab character (octal code 011) is displayed by moving to the next |
|---|
| 1009 |
tab stop column (normally every 8 columns). |
|---|
| 1010 |
|
|---|
| 1011 |
Other ASCII control characters are normally displayed as a caret |
|---|
| 1012 |
(`^') followed by the non-control version of the character; thus, |
|---|
| 1013 |
control-A is displayed as `^A'. |
|---|
| 1014 |
|
|---|
| 1015 |
Non-ASCII characters 0200 through 0237 (octal) are displayed with |
|---|
| 1016 |
octal escape sequences; thus, character code 0230 (octal) is displayed |
|---|
| 1017 |
as `\230'. The display of character codes 0240 through 0377 (octal) |
|---|
| 1018 |
may be either as escape sequences or as graphics. They do not normally |
|---|
| 1019 |
occur in multibyte buffers, but if they do, they are displayed as |
|---|
| 1020 |
Latin-1 graphics. In unibyte mode, if you enable European display they |
|---|
| 1021 |
are displayed using their graphics (assuming your terminal supports |
|---|
| 1022 |
them), otherwise as escape sequences. *Note Single-Byte Character |
|---|
| 1023 |
Support::. |
|---|
| 1024 |
|
|---|
| 1025 |
|
|---|
| 1026 |
File: emacs, Node: Display Custom, Next: Cursor Display, Prev: Text Display, Up: Display |
|---|
| 1027 |
|
|---|
| 1028 |
Customization of Display |
|---|
| 1029 |
======================== |
|---|
| 1030 |
|
|---|
| 1031 |
This section contains information for customization only. Beginning |
|---|
| 1032 |
users should skip it. |
|---|
| 1033 |
|
|---|
| 1034 |
The variable `mode-line-inverse-video' is an obsolete way of |
|---|
| 1035 |
controlling whether the mode line is displayed in inverse video; the |
|---|
| 1036 |
preferred way of doing this is to change the `mode-line' face. *Note |
|---|
| 1037 |
Mode Line::. However, if `mode-line-inverse-video' has a value of |
|---|
| 1038 |
`nil', then the `mode-line' face will be ignored, and mode-lines will |
|---|
| 1039 |
be drawn using the default text face. *Note Faces::. |
|---|
| 1040 |
|
|---|
| 1041 |
If the variable `inverse-video' is non-`nil', Emacs attempts to |
|---|
| 1042 |
invert all the lines of the display from what they normally are. |
|---|
| 1043 |
|
|---|
| 1044 |
If the variable `visible-bell' is non-`nil', Emacs attempts to make |
|---|
| 1045 |
the whole screen blink when it would normally make an audible bell |
|---|
| 1046 |
sound. This variable has no effect if your terminal does not have a way |
|---|
| 1047 |
to make the screen blink. |
|---|
| 1048 |
|
|---|
| 1049 |
When you reenter Emacs after suspending, Emacs normally clears the |
|---|
| 1050 |
screen and redraws the entire display. On some terminals with more than |
|---|
| 1051 |
one page of memory, it is possible to arrange the termcap entry so that |
|---|
| 1052 |
the `ti' and `te' strings (output to the terminal when Emacs is entered |
|---|
| 1053 |
and exited, respectively) switch between pages of memory so as to use |
|---|
| 1054 |
one page for Emacs and another page for other output. Then you might |
|---|
| 1055 |
want to set the variable `no-redraw-on-reenter' non-`nil'; this tells |
|---|
| 1056 |
Emacs to assume, when resumed, that the screen page it is using still |
|---|
| 1057 |
contains what Emacs last wrote there. |
|---|
| 1058 |
|
|---|
| 1059 |
The variable `echo-keystrokes' controls the echoing of |
|---|
| 1060 |
multi-character keys; its value is the number of seconds of pause |
|---|
| 1061 |
required to cause echoing to start, or zero meaning don't echo at all. |
|---|
| 1062 |
*Note Echo Area::. |
|---|
| 1063 |
|
|---|
| 1064 |
If the variable `ctl-arrow' is `nil', all control characters in the |
|---|
| 1065 |
buffer are displayed with octal escape sequences, except for newline |
|---|
| 1066 |
and tab. Altering the value of `ctl-arrow' makes it local to the |
|---|
| 1067 |
current buffer; until that time, the default value is in effect. The |
|---|
| 1068 |
default is initially `t'. *Note Display Tables: (elisp)Display Tables. |
|---|
| 1069 |
|
|---|
| 1070 |
Normally, a tab character in the buffer is displayed as whitespace |
|---|
| 1071 |
which extends to the next display tab stop position, and display tab |
|---|
| 1072 |
stops come at intervals equal to eight spaces. The number of spaces |
|---|
| 1073 |
per tab is controlled by the variable `tab-width', which is made local |
|---|
| 1074 |
by changing it, just like `ctl-arrow'. Note that how the tab character |
|---|
| 1075 |
in the buffer is displayed has nothing to do with the definition of |
|---|
| 1076 |
<TAB> as a command. The variable `tab-width' must have an integer |
|---|
| 1077 |
value between 1 and 1000, inclusive. |
|---|
| 1078 |
|
|---|
| 1079 |
If the variable `truncate-lines' is non-`nil', then each line of |
|---|
| 1080 |
text gets just one screen line for display; if the text line is too |
|---|
| 1081 |
long, display shows only the part that fits. If `truncate-lines' is |
|---|
| 1082 |
`nil', then long text lines display as more than one screen line, |
|---|
| 1083 |
enough to show the whole text of the line. *Note Continuation Lines::. |
|---|
| 1084 |
Altering the value of `truncate-lines' makes it local to the current |
|---|
| 1085 |
buffer; until that time, the default value is in effect. The default |
|---|
| 1086 |
is initially `nil'. |
|---|
| 1087 |
|
|---|
| 1088 |
If the variable `truncate-partial-width-windows' is non-`nil', it |
|---|
| 1089 |
forces truncation rather than continuation in any window less than the |
|---|
| 1090 |
full width of the screen or frame, regardless of the value of |
|---|
| 1091 |
`truncate-lines'. For information about side-by-side windows, see |
|---|
| 1092 |
*Note Split Window::. See also *Note Display: (elisp)Display. |
|---|
| 1093 |
|
|---|
| 1094 |
The variable `baud-rate' holds the output speed of the terminal, as |
|---|
| 1095 |
far as Emacs knows. Setting this variable does not change the speed of |
|---|
| 1096 |
actual data transmission, but the value is used for calculations. On |
|---|
| 1097 |
terminals, it affects padding, and decisions about whether to scroll |
|---|
| 1098 |
part of the screen or redraw it instead. It also affects the behavior |
|---|
| 1099 |
of incremental search. |
|---|
| 1100 |
|
|---|
| 1101 |
On window-systems, `baud-rate' is only used to determine how |
|---|
| 1102 |
frequently to look for pending input during display updating. A higher |
|---|
| 1103 |
value of `baud-rate' means that check for pending input will be done |
|---|
| 1104 |
less frequently. |
|---|
| 1105 |
|
|---|
| 1106 |
You can customize the way any particular character code is displayed |
|---|
| 1107 |
by means of a display table. *Note Display Tables: (elisp)Display |
|---|
| 1108 |
Tables. |
|---|
| 1109 |
|
|---|
| 1110 |
On a window system, Emacs can optionally display the mouse pointer |
|---|
| 1111 |
in a special shape to say that Emacs is busy. To turn this feature on |
|---|
| 1112 |
or off, customize the group `cursor'. You can also control the amount |
|---|
| 1113 |
of time Emacs must remain busy before the busy indicator is displayed, |
|---|
| 1114 |
by setting the variable `hourglass-delay'. |
|---|
| 1115 |
|
|---|
| 1116 |
On some text-only terminals, bold face and inverse video together |
|---|
| 1117 |
result in text that is hard to read. Call the function |
|---|
| 1118 |
`tty-suppress-bold-inverse-default-colors' with a non-`nil' argument to |
|---|
| 1119 |
suppress the effect of bold-face in this case. |
|---|
| 1120 |
|
|---|
| 1121 |
|
|---|
| 1122 |
File: emacs, Node: Cursor Display, Prev: Display Custom, Up: Display |
|---|
| 1123 |
|
|---|
| 1124 |
Displaying the Cursor |
|---|
| 1125 |
===================== |
|---|
| 1126 |
|
|---|
| 1127 |
There are a number of ways to customize the display of the cursor. |
|---|
| 1128 |
`M-x hl-line-mode' enables or disables a minor mode which highlights |
|---|
| 1129 |
the line containing point. On window systems, the command `M-x |
|---|
| 1130 |
blink-cursor-mode' turns on or off the blinking of the cursor. (On |
|---|
| 1131 |
terminals, the terminal itself blinks the cursor, and Emacs has no |
|---|
| 1132 |
control over it.) |
|---|
| 1133 |
|
|---|
| 1134 |
You can customize the cursor's color, and whether it blinks, using |
|---|
| 1135 |
the `cursor' Custom group (*note Easy Customization::). |
|---|
| 1136 |
|
|---|
| 1137 |
When displaying on a window system, Emacs can optionally draw the |
|---|
| 1138 |
block cursor as wide as the character under the cursor--for example, if |
|---|
| 1139 |
the cursor is on a tab character, it would cover the full width |
|---|
| 1140 |
occupied by that tab character. To enable this feature, set the |
|---|
| 1141 |
variable `x-stretch-cursor' to a non-`nil' value. |
|---|
| 1142 |
|
|---|
| 1143 |
Normally, the cursor in non-selected windows is shown as a hollow |
|---|
| 1144 |
box. To turn off cursor display in non-selected windows, customize the |
|---|
|
|---|