diff options
| author | Richard M. Stallman | 1994-03-30 18:36:47 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-30 18:36:47 +0000 |
| commit | 42b8555467c9831a0a3bab50e4b7980f482bc0ec (patch) | |
| tree | 43aa07cd20f3260e646b7936bf312eb323db0f45 | |
| parent | 855909db5427f8bf0586c6665b6c32c6b6431316 (diff) | |
| download | emacs-42b8555467c9831a0a3bab50e4b7980f482bc0ec.tar.gz emacs-42b8555467c9831a0a3bab50e4b7980f482bc0ec.zip | |
Initial revision
| -rw-r--r-- | lispref/display.texi | 1249 |
1 files changed, 1249 insertions, 0 deletions
diff --git a/lispref/display.texi b/lispref/display.texi new file mode 100644 index 00000000000..ac8875a5901 --- /dev/null +++ b/lispref/display.texi | |||
| @@ -0,0 +1,1249 @@ | |||
| 1 | @c -*-texinfo-*- | ||
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | ||
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. | ||
| 4 | @c See the file elisp.texi for copying conditions. | ||
| 5 | @setfilename ../info/display | ||
| 6 | @node Display, Calendar, System Interface, Top | ||
| 7 | @chapter Emacs Display | ||
| 8 | |||
| 9 | This chapter describes a number of features related to the display | ||
| 10 | that Emacs presents to the user. | ||
| 11 | |||
| 12 | @menu | ||
| 13 | * Refresh Screen:: Clearing the screen and redrawing everything on it. | ||
| 14 | * Screen Size:: How big is the Emacs screen. | ||
| 15 | * Truncation:: Folding or wrapping long text lines. | ||
| 16 | * The Echo Area:: Where messages are displayed. | ||
| 17 | * Selective Display:: Hiding part of the buffer text. | ||
| 18 | * Overlay Arrow:: Display of an arrow to indicate position. | ||
| 19 | * Temporary Displays:: Displays that go away automatically. | ||
| 20 | * Overlays:: Use overlays to highlight parts of the buffer. | ||
| 21 | * Faces:: A face defines a graphics appearance: font, color, etc. | ||
| 22 | * Blinking:: How Emacs shows the matching open parenthesis. | ||
| 23 | * Inverse Video:: Specifying how the screen looks. | ||
| 24 | * Usual Display:: The usual conventions for displaying nonprinting chars. | ||
| 25 | * Display Tables:: How to specify other conventions. | ||
| 26 | * Beeping:: Audible signal to the user. | ||
| 27 | * Window Systems:: Which window system is being used. | ||
| 28 | @end menu | ||
| 29 | |||
| 30 | @node Refresh Screen | ||
| 31 | @section Refreshing the Screen | ||
| 32 | |||
| 33 | The function @code{redraw-frame} redisplays the entire contents of a | ||
| 34 | given frame. @xref{Frames}. | ||
| 35 | |||
| 36 | @c Emacs 19 feature | ||
| 37 | @defun redraw-frame frame | ||
| 38 | This function clears and redisplays frame @var{frame}. | ||
| 39 | @end defun | ||
| 40 | |||
| 41 | Even more powerful is @code{redraw-display}: | ||
| 42 | |||
| 43 | @deffn Command redraw-display | ||
| 44 | This function clears and redisplays all visible frames. | ||
| 45 | @end deffn | ||
| 46 | |||
| 47 | Normally, suspending and resuming Emacs also refreshes the screen. | ||
| 48 | Some terminal emulators record separate contents for display-oriented | ||
| 49 | programs such as Emacs and for ordinary sequential display. If you are | ||
| 50 | using such a terminal, you might want to inhibit the redisplay on | ||
| 51 | resumption. @xref{Suspending Emacs}. | ||
| 52 | |||
| 53 | @defvar no-redraw-on-reenter | ||
| 54 | @cindex suspend (cf. @code{no-redraw-on-reenter}) | ||
| 55 | @cindex resume (cf. @code{no-redraw-on-reenter}) | ||
| 56 | This variable controls whether Emacs redraws the entire screen after it | ||
| 57 | has been suspended and resumed. Non-@code{nil} means yes, @code{nil} | ||
| 58 | means no. | ||
| 59 | @end defvar | ||
| 60 | |||
| 61 | Processing user input takes absolute priority over redisplay. If you | ||
| 62 | call these functions when input is available, they do nothing | ||
| 63 | immediately, but a full redisplay does happen eventually---after all the | ||
| 64 | input has been processed. | ||
| 65 | |||
| 66 | @node Screen Size | ||
| 67 | @section Screen Size | ||
| 68 | @cindex size of screen | ||
| 69 | @cindex screen size | ||
| 70 | @cindex display lines | ||
| 71 | @cindex display columns | ||
| 72 | @cindex resize redisplay | ||
| 73 | |||
| 74 | The screen size functions report or tell Emacs the height or width of | ||
| 75 | the terminal. When you are using multiple frames, they apply to the | ||
| 76 | selected frame (@pxref{Frames}). | ||
| 77 | |||
| 78 | @defun screen-height | ||
| 79 | This function returns the number of lines on the screen that are | ||
| 80 | available for display. | ||
| 81 | |||
| 82 | @example | ||
| 83 | @group | ||
| 84 | (screen-height) | ||
| 85 | @result{} 50 | ||
| 86 | @end group | ||
| 87 | @end example | ||
| 88 | @end defun | ||
| 89 | |||
| 90 | @defun screen-width | ||
| 91 | This function returns the number of columns on the screen that are | ||
| 92 | available for display. | ||
| 93 | |||
| 94 | @example | ||
| 95 | @group | ||
| 96 | (screen-width) | ||
| 97 | @result{} 80 | ||
| 98 | @end group | ||
| 99 | @end example | ||
| 100 | @end defun | ||
| 101 | |||
| 102 | @defun set-screen-height lines &optional not-actual-size | ||
| 103 | This function declares that the terminal can display @var{lines} lines. | ||
| 104 | The sizes of existing windows are altered proportionally to fit. | ||
| 105 | |||
| 106 | If @var{not-actual-size} is non-@code{nil}, then Emacs displays | ||
| 107 | @var{lines} lines of output, but does not change its value for the | ||
| 108 | actual height of the screen. (Knowing the correct actual size may be | ||
| 109 | necessary for correct cursor positioning.) Using a smaller height than | ||
| 110 | the terminal actually implements may be useful to reproduce behavior | ||
| 111 | observed on a smaller screen, or if the terminal malfunctions when using | ||
| 112 | its whole screen. | ||
| 113 | |||
| 114 | If @var{lines} is different from what it was previously, then the | ||
| 115 | entire screen is cleared and redisplayed using the new size. | ||
| 116 | |||
| 117 | This function returns @code{nil}. | ||
| 118 | @end defun | ||
| 119 | |||
| 120 | @defun set-screen-width columns &optional not-actual-size | ||
| 121 | This function declares that the terminal can display @var{columns} | ||
| 122 | columns. The details are as in @code{set-screen-height}. | ||
| 123 | @end defun | ||
| 124 | |||
| 125 | @node Truncation | ||
| 126 | @section Truncation | ||
| 127 | @cindex line wrapping | ||
| 128 | @cindex continuation lines | ||
| 129 | @cindex @samp{$} in display | ||
| 130 | @cindex @samp{\} in display | ||
| 131 | |||
| 132 | When a line of text extends beyond the right edge of a window, the | ||
| 133 | line can either be continued on the next screen line, or truncated to | ||
| 134 | one screen line. The additional screen lines used to display a long | ||
| 135 | text line are called @dfn{continuation} lines. Normally, a @samp{$} in | ||
| 136 | the rightmost column of the window indicates truncation; a @samp{\} on | ||
| 137 | the rightmost column indicates a line that ``wraps'' or is continued | ||
| 138 | onto the next line. (The display table can specify alternative | ||
| 139 | indicators; see @ref{Display Table}.) | ||
| 140 | |||
| 141 | Note that continuation is different from filling; continuation happens | ||
| 142 | on the screen only, not in the buffer contents, and it breaks a line | ||
| 143 | precisely at the right margin, not at a word boundary. @xref{Filling}. | ||
| 144 | |||
| 145 | @defopt truncate-lines | ||
| 146 | This buffer-local variable controls how Emacs displays lines that extend | ||
| 147 | beyond the right edge of the window. The default is @code{nil}, which | ||
| 148 | specifies continuation. If the value is non-@code{nil}, then these | ||
| 149 | lines are truncated. | ||
| 150 | |||
| 151 | If the variable @code{truncate-partial-width-windows} is non-@code{nil}, | ||
| 152 | then truncation is always used for side-by-side windows (within one | ||
| 153 | frame) regardless of the value of @code{truncate-lines}. | ||
| 154 | @end defopt | ||
| 155 | |||
| 156 | @defvar default-truncate-lines | ||
| 157 | This variable is the default value for @code{truncate-lines}, for | ||
| 158 | buffers that do not have local values for it. | ||
| 159 | @end defvar | ||
| 160 | |||
| 161 | @defopt truncate-partial-width-windows | ||
| 162 | This variable controls display of lines that extend beyond the right | ||
| 163 | edge of the window, in side-by-side windows (@pxref{Splitting Windows}). | ||
| 164 | If it is non-@code{nil}, these lines are truncated; otherwise, | ||
| 165 | @code{truncate-lines} says what to do with them. | ||
| 166 | @end defopt | ||
| 167 | |||
| 168 | You can override the images that indicate continuation or truncation | ||
| 169 | with the display table; see @ref{Display Tables}. | ||
| 170 | |||
| 171 | @node The Echo Area | ||
| 172 | @section The Echo Area | ||
| 173 | @cindex error display | ||
| 174 | @cindex echo area | ||
| 175 | |||
| 176 | The @dfn{echo area} is used for displaying messages made with the | ||
| 177 | @code{message} primitive, and for echoing keystrokes. It is not the | ||
| 178 | same as the minibuffer, despite the fact that the minibuffer appears | ||
| 179 | (when active) in the same place on the screen as the echo area. The | ||
| 180 | @cite{GNU Emacs Manual} specifies the rules for resolving conflicts | ||
| 181 | between the echo area and the minibuffer for use of that screen space | ||
| 182 | (@pxref{Minibuffer,, The Minibuffer, emacs, The GNU Emacs Manual}). | ||
| 183 | Error messages appear in the echo area; see @ref{Errors}. | ||
| 184 | |||
| 185 | You can write output in the echo area by using the Lisp printing | ||
| 186 | functions with @code{t} as the stream (@pxref{Output Functions}), or as | ||
| 187 | follows: | ||
| 188 | |||
| 189 | @defun message string &rest arguments | ||
| 190 | This function prints a one-line message in the echo area. The | ||
| 191 | argument @var{string} is similar to a C language @code{printf} control | ||
| 192 | string. See @code{format} in @ref{String Conversion}, for the details | ||
| 193 | on the conversion specifications. @code{message} returns the | ||
| 194 | constructed string. | ||
| 195 | |||
| 196 | @c Emacs 19 feature | ||
| 197 | If @var{string} is @code{nil}, @code{message} clears the echo area. If | ||
| 198 | the minibuffer is active, this brings the minibuffer contents back onto | ||
| 199 | the screen immediately. | ||
| 200 | @example | ||
| 201 | @group | ||
| 202 | (message "Minibuffer depth is %d." | ||
| 203 | (minibuffer-depth)) | ||
| 204 | @print{} Minibuffer depth is 0. | ||
| 205 | @result{} "Minibuffer depth is 0." | ||
| 206 | @end group | ||
| 207 | |||
| 208 | @group | ||
| 209 | ---------- Echo Area ---------- | ||
| 210 | Minibuffer depth is 0. | ||
| 211 | ---------- Echo Area ---------- | ||
| 212 | @end group | ||
| 213 | @end example | ||
| 214 | @end defun | ||
| 215 | |||
| 216 | @defvar cursor-in-echo-area | ||
| 217 | This variable controls where the cursor appears when a message is | ||
| 218 | displayed in the echo area. If it is non-@code{nil}, then the cursor | ||
| 219 | appears at the end of the message. Otherwise, the cursor appears at | ||
| 220 | point---not in the echo area at all. | ||
| 221 | |||
| 222 | The value is normally @code{nil}; Lisp programs bind it to @code{t} | ||
| 223 | for brief periods of time. | ||
| 224 | @end defvar | ||
| 225 | |||
| 226 | @node Selective Display | ||
| 227 | @section Selective Display | ||
| 228 | @cindex selective display | ||
| 229 | |||
| 230 | @dfn{Selective display} is a class of minor modes in which specially | ||
| 231 | marked lines do not appear on the screen, or in which highly indented | ||
| 232 | lines do not appear. | ||
| 233 | |||
| 234 | The first variant, explicit selective display, is designed for use in | ||
| 235 | a Lisp program. The program controls which lines are hidden by altering | ||
| 236 | the text. Outline mode uses this variant. In the second variant, the | ||
| 237 | choice of lines to hide is made automatically based on indentation. | ||
| 238 | This variant is designed as a user-level feature. | ||
| 239 | |||
| 240 | The way you control explicit selective display is by replacing a | ||
| 241 | newline (control-j) with a carriage return (control-m). The text which | ||
| 242 | was formerly a line following that newline is now invisible. Strictly | ||
| 243 | speaking, it is temporarily no longer a line at all, since only newlines | ||
| 244 | can separate lines; it is now part of the previous line. | ||
| 245 | |||
| 246 | Selective display does not directly affect editing commands. For | ||
| 247 | example, @kbd{C-f} (@code{forward-char}) moves point unhesitatingly into | ||
| 248 | invisible text. However, the replacement of newline characters with | ||
| 249 | carriage return characters affects some editing commands. For example, | ||
| 250 | @code{next-line} skips invisible lines, since it searches only for | ||
| 251 | newlines. Modes that use selective display can also define commands | ||
| 252 | that take account of the newlines, or that make parts of the text | ||
| 253 | visible or invisible. | ||
| 254 | |||
| 255 | When you write a selectively displayed buffer into a file, all the | ||
| 256 | control-m's are output as newlines. This means that when you next read | ||
| 257 | in the file, it looks OK, with nothing invisible. The selective display | ||
| 258 | effect is seen only within Emacs. | ||
| 259 | |||
| 260 | @defvar selective-display | ||
| 261 | This buffer-local variable enables selective display. This means that | ||
| 262 | lines, or portions of lines, may be made invisible. | ||
| 263 | |||
| 264 | @itemize @bullet | ||
| 265 | @item | ||
| 266 | If the value of @code{selective-display} is @code{t}, then any portion | ||
| 267 | of a line that follows a control-m is not displayed. | ||
| 268 | |||
| 269 | @item | ||
| 270 | If the value of @code{selective-display} is a positive integer, then | ||
| 271 | lines that start with more than that many columns of indentation are not | ||
| 272 | displayed. | ||
| 273 | @end itemize | ||
| 274 | |||
| 275 | When some portion of a buffer is invisible, the vertical movement | ||
| 276 | commands operate as if that portion did not exist, allowing a single | ||
| 277 | @code{next-line} command to skip any number of invisible lines. | ||
| 278 | However, character movement commands (such as @code{forward-char}) do | ||
| 279 | not skip the invisible portion, and it is possible (if tricky) to insert | ||
| 280 | or delete text in an invisible portion. | ||
| 281 | |||
| 282 | In the examples below, we show the @emph{display appearance} of the | ||
| 283 | buffer @code{foo}, which changes with the value of | ||
| 284 | @code{selective-display}. The @emph{contents} of the buffer do not | ||
| 285 | change. | ||
| 286 | |||
| 287 | @example | ||
| 288 | @group | ||
| 289 | (setq selective-display nil) | ||
| 290 | @result{} nil | ||
| 291 | |||
| 292 | ---------- Buffer: foo ---------- | ||
| 293 | 1 on this column | ||
| 294 | 2on this column | ||
| 295 | 3n this column | ||
| 296 | 3n this column | ||
| 297 | 2on this column | ||
| 298 | 1 on this column | ||
| 299 | ---------- Buffer: foo ---------- | ||
| 300 | @end group | ||
| 301 | |||
| 302 | @group | ||
| 303 | (setq selective-display 2) | ||
| 304 | @result{} 2 | ||
| 305 | |||
| 306 | ---------- Buffer: foo ---------- | ||
| 307 | 1 on this column | ||
| 308 | 2on this column | ||
| 309 | 2on this column | ||
| 310 | 1 on this column | ||
| 311 | ---------- Buffer: foo ---------- | ||
| 312 | @end group | ||
| 313 | @end example | ||
| 314 | @end defvar | ||
| 315 | |||
| 316 | @defvar selective-display-ellipses | ||
| 317 | If this buffer-local variable is non-@code{nil}, then Emacs displays | ||
| 318 | @samp{@dots{}} at the end of a line that is followed by invisible text. | ||
| 319 | This example is a continuation of the previous one. | ||
| 320 | |||
| 321 | @example | ||
| 322 | @group | ||
| 323 | (setq selective-display-ellipses t) | ||
| 324 | @result{} t | ||
| 325 | |||
| 326 | ---------- Buffer: foo ---------- | ||
| 327 | 1 on this column | ||
| 328 | 2on this column ... | ||
| 329 | 2on this column | ||
| 330 | 1 on this column | ||
| 331 | ---------- Buffer: foo ---------- | ||
| 332 | @end group | ||
| 333 | @end example | ||
| 334 | |||
| 335 | You can use a display table to substitute other text for the ellipsis | ||
| 336 | (@samp{@dots{}}). @xref{Display Tables}. | ||
| 337 | @end defvar | ||
| 338 | |||
| 339 | @node Overlay Arrow | ||
| 340 | @section The Overlay Arrow | ||
| 341 | @cindex overlay arrow | ||
| 342 | |||
| 343 | The @dfn{overlay arrow} is useful for directing the user's attention | ||
| 344 | to a particular line in a buffer. For example, in the modes used for | ||
| 345 | interface to debuggers, the overlay arrow indicates the line of code | ||
| 346 | about to be executed. | ||
| 347 | |||
| 348 | @defvar overlay-arrow-string | ||
| 349 | This variable holds the string to display as an arrow, or @code{nil} if | ||
| 350 | the arrow feature is not in use. | ||
| 351 | @end defvar | ||
| 352 | |||
| 353 | @defvar overlay-arrow-position | ||
| 354 | This variable holds a marker which indicates where to display the arrow. | ||
| 355 | It should point at the beginning of a line. The arrow text appears at | ||
| 356 | the beginning of that line, overlaying any text that would otherwise | ||
| 357 | appear. Since the arrow is usually short, and the line usually begins | ||
| 358 | with indentation, normally nothing significant is overwritten. | ||
| 359 | |||
| 360 | The overlay string is displayed only in the buffer which this marker | ||
| 361 | points into. Thus, only one buffer can have an overlay arrow at any | ||
| 362 | given time. | ||
| 363 | @c !!! overlay-arrow-position: but the overlay string may remain in the display | ||
| 364 | @c of some other buffer until an update is required. This should be fixed | ||
| 365 | @c now. Is it? | ||
| 366 | @end defvar | ||
| 367 | |||
| 368 | @node Temporary Displays | ||
| 369 | @section Temporary Displays | ||
| 370 | |||
| 371 | Temporary displays are used by commands to put output into a buffer | ||
| 372 | and then present it to the user for perusal rather than for editing. | ||
| 373 | Many of the help commands use this feature. | ||
| 374 | |||
| 375 | @defspec with-output-to-temp-buffer buffer-name forms@dots{} | ||
| 376 | This function executes @var{forms} while arranging to insert any | ||
| 377 | output they print into the buffer named @var{buffer-name}. The buffer | ||
| 378 | is then shown in some window for viewing, displayed but not selected. | ||
| 379 | |||
| 380 | The string @var{buffer-name} specifies the temporary buffer, which | ||
| 381 | need not already exist. The argument must be a string, not a buffer. | ||
| 382 | The buffer is erased initially (with no questions asked), and it is | ||
| 383 | marked as unmodified after @code{with-output-to-temp-buffer} exits. | ||
| 384 | |||
| 385 | @code{with-output-to-temp-buffer} binds @code{standard-output} to the | ||
| 386 | temporary buffer, then it evaluates the forms in @var{forms}. Output | ||
| 387 | using the Lisp output functions within @var{forms} goes by default to | ||
| 388 | that buffer (but screen display and messages in the echo area, although | ||
| 389 | they are ``output'' in the general sense of the word, are not affected). | ||
| 390 | @xref{Output Functions}. | ||
| 391 | |||
| 392 | The value of the last form in @var{forms} is returned. | ||
| 393 | |||
| 394 | @example | ||
| 395 | @group | ||
| 396 | ---------- Buffer: foo ---------- | ||
| 397 | This is the contents of foo. | ||
| 398 | ---------- Buffer: foo ---------- | ||
| 399 | @end group | ||
| 400 | |||
| 401 | @group | ||
| 402 | (with-output-to-temp-buffer "foo" | ||
| 403 | (print 20) | ||
| 404 | (print standard-output)) | ||
| 405 | @result{} #<buffer foo> | ||
| 406 | |||
| 407 | ---------- Buffer: foo ---------- | ||
| 408 | 20 | ||
| 409 | |||
| 410 | #<buffer foo> | ||
| 411 | |||
| 412 | ---------- Buffer: foo ---------- | ||
| 413 | @end group | ||
| 414 | @end example | ||
| 415 | @end defspec | ||
| 416 | |||
| 417 | @defvar temp-buffer-show-function | ||
| 418 | If this variable, if non-@code{nil}, @code{with-output-to-temp-buffer} | ||
| 419 | calls it as a function to do the job of displaying a help buffer. The | ||
| 420 | function gets one argument, which is the buffer it should display. | ||
| 421 | |||
| 422 | In Emacs versions 18 and earlier, this variable was called | ||
| 423 | @code{temp-buffer-show-hook}. | ||
| 424 | @end defvar | ||
| 425 | |||
| 426 | @defun momentary-string-display string position &optional char message | ||
| 427 | This function momentarily displays @var{string} in the current buffer at | ||
| 428 | @var{position}. It has no effect on the undo list or on the buffer's | ||
| 429 | modification status. | ||
| 430 | |||
| 431 | The momentary display remains until the next input event. If the next | ||
| 432 | input event is @var{char}, @code{momentary-string-display} ignores it | ||
| 433 | and returns. Otherwise, that event remains buffered for subsequent use | ||
| 434 | as input. Thus, typing @var{char} will simply remove the string from | ||
| 435 | the display, while typing (say) @kbd{C-f} will remove the string from | ||
| 436 | the display and later (presumably) move point forward. The argument | ||
| 437 | @var{char} is a space by default. | ||
| 438 | |||
| 439 | The return value of @code{momentary-string-display} is not meaningful. | ||
| 440 | |||
| 441 | If @var{message} is non-@code{nil}, it is displayed in the echo area | ||
| 442 | while @var{string} is displayed in the buffer. If it is @code{nil}, a | ||
| 443 | default message says to type @var{char} to continue. | ||
| 444 | |||
| 445 | In this example, point is initially located at the beginning of the | ||
| 446 | second line: | ||
| 447 | |||
| 448 | @example | ||
| 449 | @group | ||
| 450 | ---------- Buffer: foo ---------- | ||
| 451 | This is the contents of foo. | ||
| 452 | @point{}Second line. | ||
| 453 | ---------- Buffer: foo ---------- | ||
| 454 | @end group | ||
| 455 | |||
| 456 | @group | ||
| 457 | (momentary-string-display | ||
| 458 | "**** Important Message! ****" | ||
| 459 | (point) ?\r | ||
| 460 | "Type RET when done reading") | ||
| 461 | @result{} t | ||
| 462 | @end group | ||
| 463 | |||
| 464 | @group | ||
| 465 | ---------- Buffer: foo ---------- | ||
| 466 | This is the contents of foo. | ||
| 467 | **** Important Message! ****Second line. | ||
| 468 | ---------- Buffer: foo ---------- | ||
| 469 | |||
| 470 | ---------- Echo Area ---------- | ||
| 471 | Type RET when done reading | ||
| 472 | ---------- Echo Area ---------- | ||
| 473 | @end group | ||
| 474 | @end example | ||
| 475 | @end defun | ||
| 476 | |||
| 477 | @node Overlays | ||
| 478 | @section Overlays | ||
| 479 | @cindex overlays | ||
| 480 | |||
| 481 | You can use @dfn{overlays} to alter the appearance of a buffer's text on | ||
| 482 | the screen. An overlay is an object which belongs to a particular | ||
| 483 | buffer, and has a specified beginning and end. It also has properties | ||
| 484 | that you can examine and set; these affect the display of the text | ||
| 485 | within the overlay. | ||
| 486 | |||
| 487 | @menu | ||
| 488 | * Overlay Properties:: How to read and set properties. | ||
| 489 | What properties do to the screen display. | ||
| 490 | * Managing Overlays:: Creating, moving, finding overlays. | ||
| 491 | @end menu | ||
| 492 | |||
| 493 | @node Overlay Properties | ||
| 494 | @subsection Overlay Properties | ||
| 495 | |||
| 496 | Overlay properties are like text properties in some respects, but the | ||
| 497 | differences are more important than the similarities. Text properties | ||
| 498 | are considered a part of the text; overlays are specifically considered | ||
| 499 | not to be part of the text. Thus, copying text between various buffers | ||
| 500 | and strings preserves text properties, but does not try to preserve | ||
| 501 | overlays. Changing a buffer's text properties marks the buffer as | ||
| 502 | modified, while moving an overlay or changing its properties does not. | ||
| 503 | Unlike text propery changes, overlay changes are not recorded in the | ||
| 504 | buffer's undo list. | ||
| 505 | |||
| 506 | @table @code | ||
| 507 | @item priority | ||
| 508 | @kindex priority @r{(overlay property)} | ||
| 509 | This property's value (which should be a nonnegative number) determines | ||
| 510 | the priority of the overlay. The priority matters when two or more | ||
| 511 | overlays cover the same character and both specify a face for display; | ||
| 512 | the one whose @code{priority} value is larger takes priority over the | ||
| 513 | other, and its face attributes override the face attributes of the lower | ||
| 514 | priority overlay. | ||
| 515 | |||
| 516 | Currently, all overlays take priority over text properties. Please | ||
| 517 | avoid using negative priority values, as we have not yet decided just | ||
| 518 | what they should mean. | ||
| 519 | |||
| 520 | @item window | ||
| 521 | @kindex window @r{(overlay property)} | ||
| 522 | If the @code{window} property is non-@code{nil}, then the overlay | ||
| 523 | applies only on that window. | ||
| 524 | |||
| 525 | @item face | ||
| 526 | @kindex face @r{(overlay property)} | ||
| 527 | This property controls the font and color of text. @xref{Faces}, for | ||
| 528 | more information. This feature is temporary; in the future, we may | ||
| 529 | replace it with other ways of specifying how to display text. | ||
| 530 | |||
| 531 | @item mouse-face | ||
| 532 | @kindex mouse-face @r{(overlay property)} | ||
| 533 | This property is used instead of @code{face} when the mouse is within | ||
| 534 | the range of the overlay. This feature may be temporary, like | ||
| 535 | @code{face}. | ||
| 536 | |||
| 537 | @item modification-hooks | ||
| 538 | @kindex modification-hooks @r{(overlay property)} | ||
| 539 | This property's value is a list of functions to be called if any | ||
| 540 | character within the overlay is changed or if text is inserted strictly | ||
| 541 | within the overlay. Each function receives two arguments: the beginning | ||
| 542 | and end of the part of the buffer being modified. | ||
| 543 | |||
| 544 | @item insert-in-front-hooks | ||
| 545 | @kindex insert-in-front-hooks @r{(overlay property)} | ||
| 546 | This property's value is a list of functions to be called | ||
| 547 | if text is inserted right at the beginning of the overlay. | ||
| 548 | |||
| 549 | @item insert-behind-hooks | ||
| 550 | @kindex insert-behind-hooks @r{(overlay property)} | ||
| 551 | This property's value is a list of functions to be called if text is | ||
| 552 | inserted right at the end of the overlay. | ||
| 553 | |||
| 554 | @item invisible | ||
| 555 | @kindex invisible @r{(overlay property)} | ||
| 556 | A non-@code{nil} @code{invisible} property means that the text in the | ||
| 557 | overlay does not appear on the screen. This works much like selective | ||
| 558 | display. Details of this feature are likely to change in future | ||
| 559 | versions, so check the @file{etc/NEWS} file in the version you are | ||
| 560 | using. | ||
| 561 | |||
| 562 | @item before-string | ||
| 563 | @kindex before-string @r{(overlay property)} | ||
| 564 | This property's value is a string to add to the display at the beginning | ||
| 565 | of the overlay. The string does not appear in the buffer in any | ||
| 566 | sense---only on the screen. This is not yet implemented, but will be. | ||
| 567 | |||
| 568 | @item after-string | ||
| 569 | @kindex after-string @r{(overlay property)} | ||
| 570 | This property's value is a string to add to the display at the end of | ||
| 571 | the overlay. The string does not appear in the buffer in any | ||
| 572 | sense---only on the screen. This is not yet implemented, but will be. | ||
| 573 | @end table | ||
| 574 | |||
| 575 | These are the functions for reading and writing the properties of an | ||
| 576 | overlay. | ||
| 577 | |||
| 578 | @defun overlay-get overlay prop | ||
| 579 | This function returns the value of property @var{prop} recorded in | ||
| 580 | @var{overlay}. If @var{overlay} does not record any value for that | ||
| 581 | property, then the value is @code{nil}. | ||
| 582 | @end defun | ||
| 583 | |||
| 584 | @defun overlay-put overlay prop value | ||
| 585 | This function sets the value of property @var{prop} recorded in | ||
| 586 | @var{overlay} to @var{value}. It returns @var{value}. | ||
| 587 | @end defun | ||
| 588 | |||
| 589 | See also the function @code{get-char-property} which checks both | ||
| 590 | overlay properties and text properties for a given character. | ||
| 591 | @xref{Examining Properties}. | ||
| 592 | |||
| 593 | @node Managing Overlays | ||
| 594 | @subsection Managing Overlays | ||
| 595 | |||
| 596 | This section describes the functions to create, delete and move | ||
| 597 | overlays, and to examine their contents. | ||
| 598 | |||
| 599 | @defun make-overlay start end &optional buffer | ||
| 600 | This function creates and returns an overlay which belongs to | ||
| 601 | @var{buffer} and ranges from @var{start} to @var{end}. Both @var{start} | ||
| 602 | and @var{end} must specify buffer positions; they may be integers or | ||
| 603 | markers. If @var{buffer} is omitted, the overlay is created in the | ||
| 604 | current buffer. | ||
| 605 | @end defun | ||
| 606 | |||
| 607 | @defun overlay-start overlay | ||
| 608 | This function returns the position at which @var{overlay} starts. | ||
| 609 | @end defun | ||
| 610 | |||
| 611 | @defun overlay-end overlay | ||
| 612 | This function returns the position at which @var{overlay} ends. | ||
| 613 | @end defun | ||
| 614 | |||
| 615 | @defun overlay-buffer overlay | ||
| 616 | This function returns the buffer that @var{overlay} belongs to. | ||
| 617 | @end defun | ||
| 618 | |||
| 619 | @defun delete-overlay overlay | ||
| 620 | This function deletes @var{overlay}. The overlay continues to exist as | ||
| 621 | a Lisp object, but ceases to be part of the buffer it belonged to, and | ||
| 622 | ceases to have any effect on display. | ||
| 623 | @end defun | ||
| 624 | |||
| 625 | @defun move-overlay overlay start end &optional buffer | ||
| 626 | This function moves @var{overlay} to @var{buffer}, and places its bounds | ||
| 627 | at @var{start} and @var{end}. Both arguments @var{start} and @var{end} | ||
| 628 | must specify buffer positions; they may be integers or markers. If | ||
| 629 | @var{buffer} is omitted, the overlay stays in the same buffer. | ||
| 630 | |||
| 631 | The return value is @var{overlay}. | ||
| 632 | |||
| 633 | This is the only valid way to change the endpoints of an overlay. Do | ||
| 634 | not try modifying the markers in the overlay by hand, as that fails to | ||
| 635 | update other vital data structures and can cause some overlays to be | ||
| 636 | ``lost''. | ||
| 637 | @end defun | ||
| 638 | |||
| 639 | @defun overlays-at pos | ||
| 640 | This function returns a list of all the overlays that contain position | ||
| 641 | @var{pos} in the current buffer. The list is in no particular order. | ||
| 642 | An overlay contains position @var{pos} if it begins at or before | ||
| 643 | @var{pos}, and ends after @var{pos}. | ||
| 644 | @end defun | ||
| 645 | |||
| 646 | @defun next-overlay-change pos | ||
| 647 | This function returns the buffer position of the next beginning or end | ||
| 648 | of an overlay, after @var{pos}. | ||
| 649 | @end defun | ||
| 650 | |||
| 651 | @node Faces | ||
| 652 | @section Faces | ||
| 653 | @cindex face | ||
| 654 | |||
| 655 | A @dfn{face} is a named collection of graphical attributes: font, | ||
| 656 | foreground color, background color and optional underlining. Faces | ||
| 657 | control the display of text on the screen. | ||
| 658 | |||
| 659 | @cindex face id | ||
| 660 | Each face has its own @dfn{face id number} which distinguishes faces at | ||
| 661 | low levels within Emacs. However, for most purposes, you can refer to | ||
| 662 | faces in Lisp programs by their names. | ||
| 663 | |||
| 664 | Each face name is meaningful for all frames, and by default it has the | ||
| 665 | same meaning in all frames. But you can arrange to give a particular | ||
| 666 | face name a special meaning in one frame if you wish. | ||
| 667 | |||
| 668 | @menu | ||
| 669 | * Standard Faces:: The faces Emacs normally comes with. | ||
| 670 | * Merging Faces:: How Emacs decides which face to use for a character. | ||
| 671 | * Face Functions:: How to define and examine faces. | ||
| 672 | @end menu | ||
| 673 | |||
| 674 | @node Standard Faces | ||
| 675 | @subsection Standard Faces | ||
| 676 | |||
| 677 | This table lists all the standard faces and their uses. | ||
| 678 | |||
| 679 | @table @code | ||
| 680 | @item default | ||
| 681 | @kindex default @r{(face name)} | ||
| 682 | This face is used for ordinary text. | ||
| 683 | |||
| 684 | @item modeline | ||
| 685 | @kindex modeline @r{(face name)} | ||
| 686 | This face is used for mode lines and menu bars. | ||
| 687 | |||
| 688 | @item region | ||
| 689 | @kindex region @r{(face name)} | ||
| 690 | This face is used for highlighting the region in Transient Mark mode. | ||
| 691 | |||
| 692 | @item secondary-selection | ||
| 693 | @kindex secondary-selection @r{(face name)} | ||
| 694 | This face is used to show any secondary selection you have made. | ||
| 695 | |||
| 696 | @item highlight | ||
| 697 | @kindex highlight @r{(face name)} | ||
| 698 | This face is meant to be used for highlighting for various purposes. | ||
| 699 | |||
| 700 | @item underline | ||
| 701 | @kindex underline @r{(face name)} | ||
| 702 | This face underlines text. | ||
| 703 | |||
| 704 | @item bold | ||
| 705 | @kindex bold @r{(face name)} | ||
| 706 | This face uses a bold font, if possible. It uses the bold variant of | ||
| 707 | the frame's font, if it has one. It's up to you to choose a default | ||
| 708 | font that has a bold variant, if you want to use one. | ||
| 709 | |||
| 710 | @item italic | ||
| 711 | @kindex italic @r{(face name)} | ||
| 712 | This face uses the italic variant of the frame's font, if it has one. | ||
| 713 | |||
| 714 | @item bold-italic | ||
| 715 | @kindex bold-italic @r{(face name)} | ||
| 716 | This face uses the bold italic variant of the frame's font, if it has | ||
| 717 | one. | ||
| 718 | @end table | ||
| 719 | |||
| 720 | @node Merging Faces | ||
| 721 | @subsection Merging Faces for Display | ||
| 722 | |||
| 723 | Here are all the ways to specify which face to use for display of text: | ||
| 724 | |||
| 725 | @itemize @bullet | ||
| 726 | @item | ||
| 727 | With defaults. Each frame has a @dfn{default face}, whose id number is | ||
| 728 | zero, which is used for all text that doesn't somehow specify another | ||
| 729 | face. | ||
| 730 | |||
| 731 | @item | ||
| 732 | With text properties. A character may have a @code{face} property; if so, | ||
| 733 | it's displayed with that face. @xref{Special Properties}. | ||
| 734 | |||
| 735 | If the character has a @code{mouse-face} property, that is used instead | ||
| 736 | of the @code{face} property when the mouse is ``near enough'' to the | ||
| 737 | character. | ||
| 738 | |||
| 739 | @item | ||
| 740 | With overlays. An overlay may have @code{face} and @code{mouse-face} | ||
| 741 | properties too; they apply to all the text covered by the overlay. | ||
| 742 | |||
| 743 | @item | ||
| 744 | With special glyphs. Each glyph can specify a particular face id | ||
| 745 | number. @xref{Glyphs}. | ||
| 746 | @end itemize | ||
| 747 | |||
| 748 | If these various sources together specify more than one face for a | ||
| 749 | particular character, Emacs merges the attributes of the various faces | ||
| 750 | specified. The attributes of the faces of special glyphs come first; | ||
| 751 | then come attributes of faces from overlays, followed by those from text | ||
| 752 | properties, and last the default face. | ||
| 753 | |||
| 754 | When multiple overlays cover one character, an overlay with higher | ||
| 755 | priority overrides those with lower priority. @xref{Overlays}. | ||
| 756 | |||
| 757 | If an attribute such as the font or a color is not specified in any of | ||
| 758 | the above ways, the frame's own font or color is used. | ||
| 759 | |||
| 760 | @node Face Functions | ||
| 761 | @subsection Functions for Working with Faces | ||
| 762 | |||
| 763 | The attributes a face can specify include the font, the foreground | ||
| 764 | color, the background color, and underlining. The face can also leave | ||
| 765 | these unspecified by giving the value @code{nil} for them. | ||
| 766 | |||
| 767 | Here are the primitives for creating and changing faces. | ||
| 768 | |||
| 769 | @defun make-face name | ||
| 770 | This function defines a new face named @var{name}, initially with all | ||
| 771 | attributes @code{nil}. It does nothing if there is already a face named | ||
| 772 | @var{name}. | ||
| 773 | @end defun | ||
| 774 | |||
| 775 | @defun face-list | ||
| 776 | This function returns a list of all defined face names. | ||
| 777 | @end defun | ||
| 778 | |||
| 779 | @defun copy-face old-face new-name &optional frame new-frame | ||
| 780 | This function defines the face @var{new-name} as a copy of the existing | ||
| 781 | face named @var{old-face}. It creates the face @var{new-name} if that | ||
| 782 | doesn't already exist. | ||
| 783 | |||
| 784 | If the optional argument @var{frame} is given, this function applies | ||
| 785 | only to that frame. Otherwise it applies to each frame individually, | ||
| 786 | copying attributes from @var{old-face} in each frame to @var{new-face} | ||
| 787 | in the same frame. | ||
| 788 | |||
| 789 | If the optional argument @var{new-frame} is given, then @code{copy-face} | ||
| 790 | copies the attributes of @var{old-face} in @var{frame} to @var{new-name} | ||
| 791 | in @var{new-frame}. | ||
| 792 | @end defun | ||
| 793 | |||
| 794 | You can modify the attributes of an existing face with the following | ||
| 795 | functions. If you specify @var{frame}, they affect just that frame; | ||
| 796 | otherwise, they affect all frames as well as the defaults that apply to | ||
| 797 | new frames. | ||
| 798 | |||
| 799 | @defun set-face-foreground face color &optional frame | ||
| 800 | @defunx set-face-background face color &optional frame | ||
| 801 | These functions set the foreground (respectively, background) color of | ||
| 802 | face @var{face} to @var{color}. The argument @var{color} should be a | ||
| 803 | string, the name of a color. | ||
| 804 | @end defun | ||
| 805 | |||
| 806 | @defun set-face-font face font &optional frame | ||
| 807 | This function sets the font of face @var{face}. The argument @var{font} | ||
| 808 | should be a string. | ||
| 809 | @end defun | ||
| 810 | |||
| 811 | @defun set-face-underline-p face underline-p &optional frame | ||
| 812 | This function sets the underline attribute of face @var{face}. | ||
| 813 | Non-@code{nil} means do underline; @code{nil} means don't. | ||
| 814 | @end defun | ||
| 815 | |||
| 816 | @defun invert-face face &optional frame | ||
| 817 | Swap the foreground and background colors of face @var{face}. If the | ||
| 818 | face doesn't specify both foreground and background, then its foreground | ||
| 819 | and background are set to the default background and foreground. | ||
| 820 | @end defun | ||
| 821 | |||
| 822 | These functions examine the attributes of a face. If you don't | ||
| 823 | specify @var{frame}, they refer to the default data for new frames. | ||
| 824 | |||
| 825 | @defun face-foreground face &optional frame | ||
| 826 | @defunx face-background face &optional frame | ||
| 827 | These functions return the foreground (respectively, background) color | ||
| 828 | of face @var{face}, as a string. | ||
| 829 | @end defun | ||
| 830 | |||
| 831 | @defun face-font face &optional frame | ||
| 832 | This function returns the name of the font of face @var{face}. | ||
| 833 | @end defun | ||
| 834 | |||
| 835 | @defun face-underline-p face &optional frame | ||
| 836 | This function returns the underline attribute of face @var{face}. | ||
| 837 | @end defun | ||
| 838 | |||
| 839 | @defun face-id-number face | ||
| 840 | This function returns the face id number of face @var{face}. | ||
| 841 | @end defun | ||
| 842 | |||
| 843 | @defun face-equal face1 face2 &optional frame | ||
| 844 | This returns @code{t} if the faces @var{face1} and @var{face2} have the | ||
| 845 | same attributes for display. | ||
| 846 | @end defun | ||
| 847 | |||
| 848 | @defun face-differs-from-default-p face &optional frame | ||
| 849 | This returns @code{t} if the face @var{face} displays differently from | ||
| 850 | the default face. A face is considered to be ``the same'' as the normal | ||
| 851 | face if each attribute is either the same as that of the default face or | ||
| 852 | @code{nil} (meaning to inherit from the default). | ||
| 853 | @end defun | ||
| 854 | |||
| 855 | @defvar region-face | ||
| 856 | This variable's value specifies the face id to use to display characters | ||
| 857 | in the region when it is active (in Transient Mark mode only). The face | ||
| 858 | thus specified takes precedence over all faces that come from text | ||
| 859 | properties and overlays, for characters in the region. @xref{The Mark}, | ||
| 860 | for more information about Transient Mark mode. | ||
| 861 | |||
| 862 | Normally, the value is the id number of the face named @code{region}. | ||
| 863 | @end defvar | ||
| 864 | |||
| 865 | @node Blinking | ||
| 866 | @section Blinking Parentheses | ||
| 867 | @cindex parenthesis matching | ||
| 868 | @cindex blinking | ||
| 869 | @cindex balancing parentheses | ||
| 870 | @cindex close parenthesis | ||
| 871 | |||
| 872 | This section describes the mechanism by which Emacs shows a matching | ||
| 873 | open parenthesis when the user inserts a close parenthesis. | ||
| 874 | |||
| 875 | @vindex blink-paren-hook | ||
| 876 | @defvar blink-paren-function | ||
| 877 | The value of this variable should be a function (of no arguments) to | ||
| 878 | be called whenever a character with close parenthesis syntax is inserted. | ||
| 879 | The value of @code{blink-paren-function} may be @code{nil}, in which | ||
| 880 | case nothing is done. | ||
| 881 | |||
| 882 | @quotation | ||
| 883 | @strong{Please note:} this variable was named @code{blink-paren-hook} in | ||
| 884 | older Emacs versions, but since it is not called with the standard | ||
| 885 | convention for hooks, it was renamed to @code{blink-paren-function} in | ||
| 886 | version 19. | ||
| 887 | @end quotation | ||
| 888 | @end defvar | ||
| 889 | |||
| 890 | @defvar blink-matching-paren | ||
| 891 | If this variable is @code{nil}, then @code{blink-matching-open} does | ||
| 892 | nothing. | ||
| 893 | @end defvar | ||
| 894 | |||
| 895 | @defvar blink-matching-paren-distance | ||
| 896 | This variable specifies the maximum distance to scan for a matching | ||
| 897 | parenthesis before giving up. | ||
| 898 | @end defvar | ||
| 899 | |||
| 900 | @defun blink-matching-open | ||
| 901 | This function is the default value of @code{blink-paren-function}. It | ||
| 902 | assumes that point follows a character with close parenthesis syntax and | ||
| 903 | moves the cursor momentarily to the matching opening character. If that | ||
| 904 | character is not already on the screen, it displays the character's | ||
| 905 | context in the echo area. To avoid long delays, this function does not | ||
| 906 | search farther than @code{blink-matching-paren-distance} characters. | ||
| 907 | |||
| 908 | Here is an example of calling this function explicitly. | ||
| 909 | |||
| 910 | @smallexample | ||
| 911 | @group | ||
| 912 | (defun interactive-blink-matching-open () | ||
| 913 | @c Do not break this line! -- rms. | ||
| 914 | @c The first line of a doc string | ||
| 915 | @c must stand alone. | ||
| 916 | "Indicate momentarily the start of sexp before point." | ||
| 917 | (interactive) | ||
| 918 | @end group | ||
| 919 | @group | ||
| 920 | (let ((blink-matching-paren-distance | ||
| 921 | (buffer-size)) | ||
| 922 | (blink-matching-paren t)) | ||
| 923 | (blink-matching-open))) | ||
| 924 | @end group | ||
| 925 | @end smallexample | ||
| 926 | @end defun | ||
| 927 | |||
| 928 | @node Inverse Video | ||
| 929 | @section Inverse Video | ||
| 930 | @cindex Inverse Video | ||
| 931 | |||
| 932 | @defopt inverse-video | ||
| 933 | @cindex highlighting | ||
| 934 | This variable controls whether Emacs uses inverse video for all text | ||
| 935 | on the screen. Non-@code{nil} means yes, @code{nil} means no. The | ||
| 936 | default is @code{nil}. | ||
| 937 | @end defopt | ||
| 938 | |||
| 939 | @defopt mode-line-inverse-video | ||
| 940 | This variable controls the use of inverse video for mode lines. If it | ||
| 941 | is non-@code{nil}, then mode lines are displayed in inverse video (under | ||
| 942 | X, this uses the face named @code{modeline}, which you can set as you | ||
| 943 | wish). Otherwise, mode lines are displayed normally, just like text. | ||
| 944 | The default is @code{t}. | ||
| 945 | @end defopt | ||
| 946 | |||
| 947 | @node Usual Display | ||
| 948 | @section Usual Display Conventions | ||
| 949 | |||
| 950 | The usual display conventions define how to display each character | ||
| 951 | code. You can override these conventions by setting up a display table | ||
| 952 | (@pxref{Display Tables}). Here are the usual display conventions: | ||
| 953 | |||
| 954 | @itemize @bullet | ||
| 955 | @item | ||
| 956 | Character codes 32 through 126 map to glyph codes 32 through 126. | ||
| 957 | Normally this means they display as themselves. | ||
| 958 | |||
| 959 | @item | ||
| 960 | Character code 9 is a horizontal tab. It displays as whitespace | ||
| 961 | up to a position determined by @code{tab-width}. | ||
| 962 | |||
| 963 | @item | ||
| 964 | Character code 10 is a newline. | ||
| 965 | |||
| 966 | @item | ||
| 967 | All other codes in the range 0 through 31, and code 127, display in one | ||
| 968 | of two ways according to the value of @code{ctl-arrow}. If it is is | ||
| 969 | non-@code{nil}, these codes map to sequences of two glyphs, where the | ||
| 970 | first glyph is the @sc{ASCII} code for @samp{^}. (A display table can | ||
| 971 | specify a glyph to use instead of @samp{^}.) Otherwise, these codes map | ||
| 972 | just like the codes in the range 128 to 255. | ||
| 973 | |||
| 974 | @item | ||
| 975 | Character codes 128 through 255 map to sequences of four glyphs, where | ||
| 976 | the first glyph is the @sc{ASCII} code for @samp{\}, and the others are | ||
| 977 | digit characters representing the code in octal. (A display table can | ||
| 978 | specify a glyph to use instead of @samp{\}.) | ||
| 979 | @end itemize | ||
| 980 | |||
| 981 | The usual display conventions apply even when there is a display | ||
| 982 | table, for any character whose entry in the active display table is | ||
| 983 | @code{nil}. Thus, when you set up a display table, you need only | ||
| 984 | specify the the characters for which you want unusual behavior. | ||
| 985 | |||
| 986 | These variables affect the way certain characters are displayed on the | ||
| 987 | screen. Since they change the number of columns the characters occupy, | ||
| 988 | they also affect the indentation functions. | ||
| 989 | |||
| 990 | @defopt ctl-arrow | ||
| 991 | @cindex control characters in display | ||
| 992 | This buffer-local variable controls how control characters are | ||
| 993 | displayed. If it is non-@code{nil}, they are displayed as a caret | ||
| 994 | followed by the character: @samp{^A}. If it is @code{nil}, they are | ||
| 995 | displayed as a backslash followed by three octal digits: @samp{\001}. | ||
| 996 | @end defopt | ||
| 997 | |||
| 998 | @c Following may have overfull hbox. | ||
| 999 | @defvar default-ctl-arrow | ||
| 1000 | The value of this variable is the default value for @code{ctl-arrow} in | ||
| 1001 | buffers that do not override it. @xref{Default Value}. | ||
| 1002 | @end defvar | ||
| 1003 | |||
| 1004 | @defopt tab-width | ||
| 1005 | The value of this variable is the spacing between tab stops used for | ||
| 1006 | displaying tab characters in Emacs buffers. The default is 8. Note | ||
| 1007 | that this feature is completely independent from the user-settable tab | ||
| 1008 | stops used by the command @code{tab-to-tab-stop}. @xref{Indent Tabs}. | ||
| 1009 | @end defopt | ||
| 1010 | |||
| 1011 | @node Display Tables | ||
| 1012 | @section Display Tables | ||
| 1013 | |||
| 1014 | @cindex display table | ||
| 1015 | You can use the @dfn{display table} feature to control how all 256 | ||
| 1016 | possible character codes display on the screen. This is useful for | ||
| 1017 | displaying European languages that have letters not in the @sc{ASCII} | ||
| 1018 | character set. | ||
| 1019 | |||
| 1020 | The display table maps each character code into a sequence of | ||
| 1021 | @dfn{glyphs}, each glyph being an image that takes up one character | ||
| 1022 | position on the screen. You can also define how to display each glyph | ||
| 1023 | on your terminal, using the @dfn{glyph table}. | ||
| 1024 | |||
| 1025 | @menu | ||
| 1026 | * Display Table Format:: What a display table consists of. | ||
| 1027 | * Active Display Table:: How Emacs selects a display table to use. | ||
| 1028 | * Glyphs:: How to define a glyph, and what glyphs mean. | ||
| 1029 | * ISO Latin 1:: How to use display tables | ||
| 1030 | to support the ISO Latin 1 character set. | ||
| 1031 | @end menu | ||
| 1032 | |||
| 1033 | @node Display Table Format | ||
| 1034 | @subsection Display Table Format | ||
| 1035 | |||
| 1036 | A display table is actually an array of 261 elements. | ||
| 1037 | |||
| 1038 | @defun make-display-table | ||
| 1039 | This creates and returns a display table. The table initially has | ||
| 1040 | @code{nil} in all elements. | ||
| 1041 | @end defun | ||
| 1042 | |||
| 1043 | The first 256 elements correspond to character codes; the @var{n}th | ||
| 1044 | element says how to display the character code @var{n}. The value | ||
| 1045 | should be @code{nil} or a vector of glyph values (@pxref{Glyphs}). If | ||
| 1046 | an element is @code{nil}, it says to display that character according to | ||
| 1047 | the usual display conventions (@pxref{Usual Display}). | ||
| 1048 | |||
| 1049 | The remaining five elements of a display table serve special purposes, | ||
| 1050 | and @code{nil} means use the default stated below. | ||
| 1051 | |||
| 1052 | @table @asis | ||
| 1053 | @item 256 | ||
| 1054 | The glyph for the end of a truncated screen line (the default for this | ||
| 1055 | is @samp{$}). @xref{Glyphs}. | ||
| 1056 | @item 257 | ||
| 1057 | The glyph for the end of a continued line (the default is @samp{\}). | ||
| 1058 | @item 258 | ||
| 1059 | The glyph for indicating a character displayed as an octal character | ||
| 1060 | code (the default is @samp{\}). | ||
| 1061 | @item 259 | ||
| 1062 | The glyph for indicating a control character (the default is @samp{^}). | ||
| 1063 | @item 260 | ||
| 1064 | A vector of glyphs for indicating the presence of invisible lines (the | ||
| 1065 | default is @samp{...}). @xref{Selective Display}. | ||
| 1066 | @end table | ||
| 1067 | |||
| 1068 | For example, here is how to construct a display table that mimics the | ||
| 1069 | effect of setting @code{ctl-arrow} to a non-@code{nil} value: | ||
| 1070 | |||
| 1071 | @example | ||
| 1072 | (setq disptab (make-display-table)) | ||
| 1073 | (let ((i 0)) | ||
| 1074 | (while (< i 32) | ||
| 1075 | (or (= i ?\t) (= i ?\n) | ||
| 1076 | (aset disptab i (vector ?^ (+ i 64)))) | ||
| 1077 | (setq i (1+ i))) | ||
| 1078 | (aset disptab 127 (vector ?^ ??))) | ||
| 1079 | @end example | ||
| 1080 | |||
| 1081 | @node Active Display Table | ||
| 1082 | @subsection Active Display Table | ||
| 1083 | @cindex active display table | ||
| 1084 | |||
| 1085 | Each window can specify a display table, and so can each buffer. When | ||
| 1086 | a buffer @var{b} is displayed in window @var{w}, display uses the | ||
| 1087 | display table for window @var{w} if it has one; otherwise, the display | ||
| 1088 | table for buffer @var{b} if it has one; otherwise, the standard display | ||
| 1089 | table if any. The display table chosen is called the @dfn{active} | ||
| 1090 | display table. | ||
| 1091 | |||
| 1092 | @defun window-display-table window | ||
| 1093 | This function returns @var{window}'s display table, or @code{nil} | ||
| 1094 | if @var{window} does not have an assigned display table. | ||
| 1095 | @end defun | ||
| 1096 | |||
| 1097 | @defun set-window-display-table window table | ||
| 1098 | This function sets the display table of @var{window} to @var{table}. | ||
| 1099 | The argument @var{table} should be either a display table or | ||
| 1100 | @code{nil}. | ||
| 1101 | @end defun | ||
| 1102 | |||
| 1103 | @defvar buffer-display-table | ||
| 1104 | This variable is automatically local in all buffers; its value in a | ||
| 1105 | particular buffer is the display table for that buffer, or @code{nil} if | ||
| 1106 | the buffer does not have an assigned display table. | ||
| 1107 | @end defvar | ||
| 1108 | |||
| 1109 | @defvar standard-display-table | ||
| 1110 | This variable's value is the default display table, used whenever a | ||
| 1111 | window has no display table and neither does the buffer displayed in | ||
| 1112 | that window. This variable is @code{nil} by default. | ||
| 1113 | @end defvar | ||
| 1114 | |||
| 1115 | If there is no display table to use for a particular window---that is, | ||
| 1116 | if the window has none, its buffer has none, and | ||
| 1117 | @code{standard-display-table} has none---then Emacs uses the usual | ||
| 1118 | display conventions for all character codes in that window. @xref{Usual | ||
| 1119 | Display}. | ||
| 1120 | |||
| 1121 | @node Glyphs | ||
| 1122 | @subsection Glyphs | ||
| 1123 | |||
| 1124 | @cindex glyph | ||
| 1125 | A @dfn{glyph} is a generalization of a character; it stands for an | ||
| 1126 | image that takes up a single character position on the screen. Glyphs | ||
| 1127 | are represented in Lisp as integers, just as characters are. | ||
| 1128 | |||
| 1129 | @cindex glyph table | ||
| 1130 | The meaning of each integer, as a glyph, is defined by the glyph | ||
| 1131 | table, which is the value of the variable @code{glyph-table}. | ||
| 1132 | |||
| 1133 | @defvar glyph-table | ||
| 1134 | The value of this variable is the current glyph table. It should be a | ||
| 1135 | vector; the @var{g}th element defines glyph code @var{g}. If the value | ||
| 1136 | is @code{nil} instead of a vector, then all glyphs are simple (see | ||
| 1137 | below). | ||
| 1138 | @end defvar | ||
| 1139 | |||
| 1140 | Here are the possible types of elements in the glyph table: | ||
| 1141 | |||
| 1142 | @table @var | ||
| 1143 | @item string | ||
| 1144 | Send the characters in @var{string} to the terminal to output | ||
| 1145 | this glyph. This alternative is available on character terminals, | ||
| 1146 | but not under X. | ||
| 1147 | |||
| 1148 | @item integer | ||
| 1149 | Define this glyph code as an alias for code @var{integer}. You can use | ||
| 1150 | an alias to specify a face code for the glyph; see below. | ||
| 1151 | |||
| 1152 | @item @code{nil} | ||
| 1153 | This glyph is simple. On an ordinary terminal, the glyph code mod 256 | ||
| 1154 | is the character to output. With X, the glyph code mod 256 is the | ||
| 1155 | character to output, and the glyph code divided by 256 specifies the | ||
| 1156 | @dfn{face id number} to use while outputting it. @xref{Faces}. | ||
| 1157 | @end table | ||
| 1158 | |||
| 1159 | If a glyph code is greater than or equal to the length of the glyph | ||
| 1160 | table, that code is automatically simple. | ||
| 1161 | |||
| 1162 | @node ISO Latin 1 | ||
| 1163 | @subsection ISO Latin 1 | ||
| 1164 | |||
| 1165 | If you have a terminal that can handle the entire ISO Latin 1 character | ||
| 1166 | set, you can arrange to use that character set as follows: | ||
| 1167 | |||
| 1168 | @example | ||
| 1169 | (require 'disp-table) | ||
| 1170 | ;; @r{Set char codes 160--255 to display as themselves.} | ||
| 1171 | ;; @r{(Codes 128--159 are the additional control characters.)} | ||
| 1172 | (standard-display-8bit 160 255) | ||
| 1173 | @end example | ||
| 1174 | |||
| 1175 | If you are editing buffers written in the ISO Latin 1 character set and | ||
| 1176 | your terminal doesn't handle anything but @sc{ASCII}, you can load the file | ||
| 1177 | @file{iso-ascii} to set up a display table which makes the other ISO | ||
| 1178 | characters display as sequences of @sc{ASCII} characters. For example, the | ||
| 1179 | character ``o with umlaut'' displays as @samp{@{"o@}}. | ||
| 1180 | |||
| 1181 | Some European countries have terminals that don't support ISO Latin 1 | ||
| 1182 | but do support the special characters for that country's language. You | ||
| 1183 | can define a display table to work one language using such terminals. | ||
| 1184 | For an example, see @file{lisp/iso-swed.el}, which handles certain | ||
| 1185 | Swedish terminals. | ||
| 1186 | |||
| 1187 | You can load the appropriate display table for your terminal | ||
| 1188 | automatically by writing a terminal-specific Lisp file for the terminal | ||
| 1189 | type. | ||
| 1190 | |||
| 1191 | @node Beeping | ||
| 1192 | @section Beeping | ||
| 1193 | @cindex beeping | ||
| 1194 | @cindex bell | ||
| 1195 | |||
| 1196 | You can make Emacs ring a bell (or blink the screen) to attract the | ||
| 1197 | user's attention. Be conservative about how often you do this; frequent | ||
| 1198 | bells can become irritating. Also be careful not to use beeping alone | ||
| 1199 | when signaling an error is appropriate. (@xref{Errors}.) | ||
| 1200 | |||
| 1201 | @defun ding &optional dont-terminate | ||
| 1202 | @cindex keyboard macro termination | ||
| 1203 | This function beeps, or flashes the screen (see @code{visible-bell} below). | ||
| 1204 | It also terminates any keyboard macro currently executing unless | ||
| 1205 | @var{dont-terminate} is non-@code{nil}. | ||
| 1206 | @end defun | ||
| 1207 | |||
| 1208 | @defun beep &optional dont-terminate | ||
| 1209 | This is a synonym for @code{ding}. | ||
| 1210 | @end defun | ||
| 1211 | |||
| 1212 | @defvar visible-bell | ||
| 1213 | This variable determines whether Emacs should flash the screen to | ||
| 1214 | represent a bell. Non-@code{nil} means yes, @code{nil} means no. This | ||
| 1215 | is effective only if the Termcap entry for the terminal in use has the | ||
| 1216 | visible bell flag (@samp{vb}) set. | ||
| 1217 | @end defvar | ||
| 1218 | |||
| 1219 | @node Window Systems | ||
| 1220 | @section Window Systems | ||
| 1221 | |||
| 1222 | Emacs works with several window systems, most notably the X Window | ||
| 1223 | System. Both Emacs and X use the term ``window'', but use it | ||
| 1224 | differently. An Emacs frame is a single window as far as X is | ||
| 1225 | concerned; the individual Emacs windows are not known to X at all. | ||
| 1226 | |||
| 1227 | @defvar window-system | ||
| 1228 | @cindex X Window System | ||
| 1229 | This variable tells Lisp programs what window system Emacs is running | ||
| 1230 | under. Its value should be a symbol such as @code{x} (if Emacs is | ||
| 1231 | running under X) or @code{nil} (if Emacs is running on an ordinary | ||
| 1232 | terminal). | ||
| 1233 | @end defvar | ||
| 1234 | |||
| 1235 | @defvar window-system-version | ||
| 1236 | This variable distinguishes between different versions of the X Window | ||
| 1237 | System. Its value is 10 or 11 when using X; @code{nil} otherwise. | ||
| 1238 | @end defvar | ||
| 1239 | |||
| 1240 | @defvar window-setup-hook | ||
| 1241 | This variable is a normal hook which Emacs runs after loading your | ||
| 1242 | @file{.emacs} file and the default initialization file (if any), after | ||
| 1243 | loading terminal-specific Lisp code, and after running the hook | ||
| 1244 | @code{term-setup-hook}. | ||
| 1245 | |||
| 1246 | This hook is used for internal purposes: setting up communication with | ||
| 1247 | the window system, and creating the initial window. Users should not | ||
| 1248 | interfere with it. | ||
| 1249 | @end defvar | ||