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