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