0
|
1 @c -*-texinfo-*-
|
|
2 @c This is part of the XEmacs Lisp Reference Manual.
|
|
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
4 @c See the file lispref.texi for copying conditions.
|
|
5 @setfilename ../../info/display.info
|
|
6 @node Display, Hash Tables, Annotations, Top
|
|
7 @chapter Emacs Display
|
|
8
|
|
9 This chapter describes a number of other features related to the display
|
|
10 that XEmacs presents to the user.
|
|
11
|
|
12 @menu
|
|
13 * Refresh Screen:: Clearing the screen and redrawing everything on it.
|
|
14 * Truncation:: Folding or wrapping long text lines.
|
|
15 * The Echo Area:: Where messages are displayed.
|
|
16 * Invisible Text:: Hiding part of the buffer text.
|
|
17 * Selective Display:: Hiding part of the buffer text (the old way).
|
|
18 * Overlay Arrow:: Display of an arrow to indicate position.
|
|
19 * Temporary Displays:: Displays that go away automatically.
|
|
20 * Blinking:: How XEmacs shows the matching open parenthesis.
|
|
21 * Usual Display:: The usual conventions for displaying nonprinting chars.
|
|
22 * Display Tables:: How to specify other conventions.
|
|
23 * Beeping:: Audible signal to the user.
|
|
24 @end menu
|
|
25
|
|
26 @node Refresh Screen
|
|
27 @section Refreshing the Screen
|
|
28
|
|
29 The function @code{redraw-frame} redisplays the entire contents of a
|
|
30 given frame. @xref{Frames}.
|
|
31
|
|
32 @c Emacs 19 feature
|
|
33 @defun redraw-frame frame
|
|
34 This function clears and redisplays frame @var{frame}.
|
|
35 @end defun
|
|
36
|
|
37 Even more powerful is @code{redraw-display}:
|
|
38
|
|
39 @deffn Command redraw-display &optional device
|
|
40 This function redraws all frames on @var{device} marked as having their
|
|
41 image garbled. @var{device} defaults to the selected device. If
|
|
42 @var{device} is @code{t}, all devices will have their frames checked.
|
|
43 @end deffn
|
|
44
|
|
45 Processing user input takes absolute priority over redisplay. If you
|
|
46 call these functions when input is available, they do nothing
|
|
47 immediately, but a full redisplay does happen eventually---after all the
|
|
48 input has been processed.
|
|
49
|
|
50 Normally, suspending and resuming XEmacs also refreshes the screen.
|
|
51 Some terminal emulators record separate contents for display-oriented
|
|
52 programs such as XEmacs and for ordinary sequential display. If you are
|
|
53 using such a terminal, you might want to inhibit the redisplay on
|
|
54 resumption. @xref{Suspending XEmacs}.
|
|
55
|
|
56 @defvar no-redraw-on-reenter
|
|
57 @cindex suspend (cf. @code{no-redraw-on-reenter})
|
|
58 @cindex resume (cf. @code{no-redraw-on-reenter})
|
|
59 This variable controls whether XEmacs redraws the entire screen after it
|
|
60 has been suspended and resumed. Non-@code{nil} means yes, @code{nil}
|
|
61 means no.
|
|
62 @end defvar
|
|
63
|
|
64 @cindex display update
|
|
65 @cindex update display
|
|
66 @cindex refresh display
|
|
67 The above functions do not actually cause the display to be updated;
|
|
68 rather, they clear out the internal display records that XEmacs
|
|
69 maintains, so that the next time the display is updated it will be
|
|
70 redrawn from scratch. Normally this occurs the next time that
|
|
71 @code{next-event} or @code{sit-for} is called; however, a display update
|
|
72 will not occur if there is input pending. @xref{Command Loop}.
|
|
73
|
|
74 @deffn Command force-redisplay
|
|
75 @cindex force redisplay
|
|
76 This function causes an immediate update of the display in all
|
|
77 circumstances, whether or not input is pending. (This function does
|
|
78 not exist in FSF Emacs.)
|
|
79 @end deffn
|
|
80
|
|
81 @defun force-cursor-redisplay
|
|
82 This function causes an immediate update of the cursor on the selected
|
|
83 frame. (This function does not exist in FSF Emacs.)
|
|
84 @end defun
|
|
85
|
|
86 @node Truncation
|
|
87 @section Truncation
|
|
88 @cindex line wrapping
|
|
89 @cindex continuation lines
|
|
90 @cindex @samp{$} in display
|
|
91 @cindex @samp{\} in display
|
|
92
|
|
93 When a line of text extends beyond the right edge of a window, the
|
|
94 line can either be truncated or continued on the next line. When a line
|
|
95 is truncated, this is normally shown with a @samp{\} in the rightmost
|
|
96 column of the window on X displays, and with a @samp{$} on TTY devices.
|
|
97 When a line is continued or ``wrapped'' onto the next line, this is
|
|
98 shown with a curved arrow in the rightmost column of the window (or with
|
|
99 a @samp{\} on TTY devices). The additional screen lines used to display
|
|
100 a long text line are called @dfn{continuation} lines.
|
|
101
|
|
102 Normally, whenever line truncation is in effect for a particular
|
|
103 window, a horizontal scrollbar is displayed in that window if the
|
|
104 device supports scrollbars. @xref{Scrollbars}.
|
|
105
|
|
106 Note that continuation is different from filling; continuation happens
|
|
107 on the screen only, not in the buffer contents, and it breaks a line
|
|
108 precisely at the right margin, not at a word boundary. @xref{Filling}.
|
|
109
|
|
110 @defopt truncate-lines
|
|
111 This buffer-local variable controls how XEmacs displays lines that
|
|
112 extend beyond the right edge of the window. If it is non-@code{nil},
|
|
113 then XEmacs does not display continuation lines; rather each line of
|
|
114 text occupies exactly one screen line, and a backslash appears at the
|
|
115 edge of any line that extends to or beyond the edge of the window. The
|
|
116 default is @code{nil}.
|
|
117
|
|
118 If the variable @code{truncate-partial-width-windows} is non-@code{nil},
|
|
119 then truncation is always used for side-by-side windows (within one
|
|
120 frame) regardless of the value of @code{truncate-lines}.
|
|
121 @end defopt
|
|
122
|
|
123 @defopt default-truncate-lines
|
|
124 This variable is the default value for @code{truncate-lines}, for
|
|
125 buffers that do not have local values for it.
|
|
126 @end defopt
|
|
127
|
|
128 @defopt truncate-partial-width-windows
|
|
129 This variable controls display of lines that extend beyond the right
|
|
130 edge of the window, in side-by-side windows (@pxref{Splitting Windows}).
|
|
131 If it is non-@code{nil}, these lines are truncated; otherwise,
|
|
132 @code{truncate-lines} says what to do with them.
|
|
133 @end defopt
|
|
134
|
|
135 The backslash and curved arrow used to indicate truncated or continued
|
|
136 lines are only defaults, and can be changed. These images are actually
|
|
137 glyphs (@pxref{Glyphs}). XEmacs provides a great deal of flexibility
|
|
138 in how glyphs can be controlled. (This differs from FSF Emacs, which
|
|
139 uses display tables to control these images.)
|
|
140
|
|
141 For details, @ref{Redisplay Glyphs}.
|
|
142
|
|
143 @ignore Not yet in XEmacs
|
|
144 If your buffer contains @strong{very} long lines, and you use
|
|
145 continuation to display them, just thinking about them can make Emacs
|
|
146 redisplay slow. The column computation and indentation functions also
|
|
147 become slow. Then you might find it advisable to set
|
|
148 @code{cache-long-line-scans} to @code{t}.
|
|
149
|
|
150 @defvar cache-long-line-scans
|
|
151 If this variable is non-@code{nil}, various indentation and motion
|
|
152 functions, and Emacs redisplay, cache the results of scanning the
|
|
153 buffer, and consult the cache to avoid rescanning regions of the buffer
|
|
154 unless they are modified.
|
|
155
|
|
156 Turning on the cache slows down processing of short lines somewhat.
|
|
157
|
|
158 This variable is automatically local in every buffer.
|
|
159 @end defvar
|
|
160 @end ignore
|
|
161
|
|
162 @node The Echo Area
|
|
163 @section The Echo Area
|
|
164 @cindex error display
|
|
165 @cindex echo area
|
|
166
|
|
167 The @dfn{echo area} is used for displaying messages made with the
|
|
168 @code{message} primitive, and for echoing keystrokes. It is not the
|
|
169 same as the minibuffer, despite the fact that the minibuffer appears
|
|
170 (when active) in the same place on the screen as the echo area. The
|
|
171 @cite{XEmacs Reference Manual} specifies the rules for resolving conflicts
|
|
172 between the echo area and the minibuffer for use of that screen space
|
|
173 (@pxref{Minibuffer,, The Minibuffer, emacs, The XEmacs Reference Manual}).
|
|
174 Error messages appear in the echo area; see @ref{Errors}.
|
|
175
|
|
176 You can write output in the echo area by using the Lisp printing
|
|
177 functions with @code{t} as the stream (@pxref{Output Functions}), or as
|
|
178 follows:
|
|
179
|
|
180 @defun message string &rest arguments
|
|
181 This function displays a one-line message in the echo area. The
|
|
182 argument @var{string} is similar to a C language @code{printf} control
|
|
183 string. See @code{format} in @ref{String Conversion}, for the details
|
|
184 on the conversion specifications. @code{message} returns the
|
|
185 constructed string.
|
|
186
|
|
187 In batch mode, @code{message} prints the message text on the standard
|
|
188 error stream, followed by a newline.
|
|
189
|
|
190 @c Emacs 19 feature
|
|
191 If @var{string} is @code{nil}, @code{message} clears the echo area. If
|
|
192 the minibuffer is active, this brings the minibuffer contents back onto
|
|
193 the screen immediately.
|
|
194
|
|
195 @example
|
|
196 @group
|
|
197 (message "Minibuffer depth is %d."
|
|
198 (minibuffer-depth))
|
|
199 @print{} Minibuffer depth is 0.
|
|
200 @result{} "Minibuffer depth is 0."
|
|
201 @end group
|
|
202
|
|
203 @group
|
|
204 ---------- Echo Area ----------
|
|
205 Minibuffer depth is 0.
|
|
206 ---------- Echo Area ----------
|
|
207 @end group
|
|
208 @end example
|
|
209 @end defun
|
|
210
|
2
|
211 Some of the messages displayed in the echo area are also recorded in the
|
|
212 @samp{ *Message-Log*} buffer.
|
0
|
213
|
2
|
214 @ignore
|
0
|
215 @defopt message-log-max
|
|
216 This variable specifies how many lines to keep in the @samp{*Messages*}
|
|
217 buffer. The value @code{t} means there is no limit on how many lines to
|
|
218 keep. The value @code{nil} disables message logging entirely. Here's
|
|
219 how to display a message and prevent it from being logged:
|
2
|
220 @defopt log-message-max-size
|
|
221 This variable specifies how many lines to keep in the @samp{* Message-Log*}
|
|
222 buffer. The value @code{t} means there is no limit on how many lines to
|
|
223 keep. The value @code{nil} disables message logging entirely. Here's
|
|
224 how to display a message and prevent it from being logged:
|
0
|
225
|
|
226 @example
|
|
227 (let (message-log-max)
|
|
228 (message @dots{}))
|
|
229 @end example
|
|
230 @end defopt
|
2
|
231 @end ignore
|
|
232 @defopt log-message-max-size
|
|
233 This variable specifies the maximum size of @samp{* Message-Log*}
|
|
234 buffer.
|
|
235 @end defopt
|
0
|
236
|
|
237 @defvar echo-keystrokes
|
|
238 This variable determines how much time should elapse before command
|
|
239 characters echo. Its value must be an integer, which specifies the
|
|
240 number of seconds to wait before echoing. If the user types a prefix
|
|
241 key (such as @kbd{C-x}) and then delays this many seconds before
|
|
242 continuing, the prefix key is echoed in the echo area. Any subsequent
|
|
243 characters in the same command will be echoed as well.
|
|
244
|
|
245 If the value is zero, then command input is not echoed.
|
|
246 @end defvar
|
|
247
|
|
248 @defvar cursor-in-echo-area
|
|
249 This variable controls where the cursor appears when a message is
|
|
250 displayed in the echo area. If it is non-@code{nil}, then the cursor
|
|
251 appears at the end of the message. Otherwise, the cursor appears at
|
|
252 point---not in the echo area at all.
|
|
253
|
|
254 The value is normally @code{nil}; Lisp programs bind it to @code{t}
|
|
255 for brief periods of time.
|
|
256 @end defvar
|
|
257
|
|
258 @node Invisible Text
|
|
259 @section Invisible Text
|
|
260
|
|
261 @cindex invisible text
|
|
262 You can make characters @dfn{invisible}, so that they do not appear on
|
|
263 the screen, with the @code{invisible} property. This can be either a
|
|
264 text property or a property of an overlay.
|
|
265
|
|
266 In the simplest case, any non-@code{nil} @code{invisible} property makes
|
|
267 a character invisible. This is the default case---if you don't alter
|
|
268 the default value of @code{buffer-invisibility-spec}, this is how the
|
|
269 @code{invisibility} property works. This feature is much like selective
|
|
270 display (@pxref{Selective Display}), but more general and cleaner.
|
|
271
|
|
272 More generally, you can use the variable @code{buffer-invisibility-spec}
|
|
273 to control which values of the @code{invisible} property make text
|
|
274 invisible. This permits you to classify the text into different subsets
|
|
275 in advance, by giving them different @code{invisible} values, and
|
|
276 subsequently make various subsets visible or invisible by changing the
|
|
277 value of @code{buffer-invisibility-spec}.
|
|
278
|
|
279 Controlling visibility with @code{buffer-invisibility-spec} is
|
|
280 especially useful in a program to display the list of entries in a data
|
|
281 base. It permits the implementation of convenient filtering commands to
|
|
282 view just a part of the entries in the data base. Setting this variable
|
|
283 is very fast, much faster than scanning all the text in the buffer
|
|
284 looking for properties to change.
|
|
285
|
|
286 @defvar buffer-invisibility-spec
|
|
287 This variable specifies which kinds of @code{invisible} properties
|
|
288 actually make a character invisible.
|
|
289
|
|
290 @table @asis
|
|
291 @item @code{t}
|
|
292 A character is invisible if its @code{invisible} property is
|
|
293 non-@code{nil}. This is the default.
|
|
294
|
|
295 @item a list
|
|
296 Each element of the list makes certain characters invisible.
|
|
297 Ultimately, a character is invisible if any of the elements of this list
|
|
298 applies to it. The list can have two kinds of elements:
|
|
299
|
|
300 @table @code
|
|
301 @item @var{atom}
|
|
302 A character is invisible if its @code{invisible} propery value
|
|
303 is @var{atom} or if it is a list with @var{atom} as a member.
|
|
304
|
|
305 @item (@var{atom} . t)
|
|
306 A character is invisible if its @code{invisible} propery value
|
|
307 is @var{atom} or if it is a list with @var{atom} as a member.
|
|
308 Moreover, if this character is at the end of a line and is followed
|
|
309 by a visible newline, it displays an ellipsis.
|
|
310 @end table
|
|
311 @end table
|
|
312 @end defvar
|
|
313
|
|
314 Ordinarily, commands that operate on text or move point do not care
|
|
315 whether the text is invisible. However, the user-level line motion
|
|
316 commands explicitly ignore invisible newlines.
|
|
317
|
|
318 @node Selective Display
|
|
319 @section Selective Display
|
|
320 @cindex selective display
|
|
321
|
|
322 @dfn{Selective display} is a pair of features that hide certain
|
|
323 lines on the screen.
|
|
324
|
|
325 The first variant, explicit selective display, is designed for use in
|
|
326 a Lisp program. The program controls which lines are hidden by altering
|
|
327 the text. Outline mode has traditionally used this variant. It has
|
|
328 been partially replaced by the invisible text feature (@pxref{Invisible
|
|
329 Text}); there is a new version of Outline mode which uses that instead.
|
|
330
|
|
331 In the second variant, the choice of lines to hide is made
|
|
332 automatically based on indentation. This variant is designed to be a
|
|
333 user-level feature.
|
|
334
|
|
335 The way you control explicit selective display is by replacing a
|
|
336 newline (control-j) with a carriage return (control-m). The text that
|
|
337 was formerly a line following that newline is now invisible. Strictly
|
|
338 speaking, it is temporarily no longer a line at all, since only newlines
|
|
339 can separate lines; it is now part of the previous line.
|
|
340
|
|
341 Selective display does not directly affect editing commands. For
|
|
342 example, @kbd{C-f} (@code{forward-char}) moves point unhesitatingly into
|
|
343 invisible text. However, the replacement of newline characters with
|
|
344 carriage return characters affects some editing commands. For example,
|
|
345 @code{next-line} skips invisible lines, since it searches only for
|
|
346 newlines. Modes that use selective display can also define commands
|
|
347 that take account of the newlines, or that make parts of the text
|
|
348 visible or invisible.
|
|
349
|
|
350 When you write a selectively displayed buffer into a file, all the
|
|
351 control-m's are output as newlines. This means that when you next read
|
|
352 in the file, it looks OK, with nothing invisible. The selective display
|
|
353 effect is seen only within XEmacs.
|
|
354
|
|
355 @defvar selective-display
|
|
356 This buffer-local variable enables selective display. This means that
|
|
357 lines, or portions of lines, may be made invisible.
|
|
358
|
|
359 @itemize @bullet
|
|
360 @item
|
|
361 If the value of @code{selective-display} is @code{t}, then any portion
|
|
362 of a line that follows a control-m is not displayed.
|
|
363
|
|
364 @item
|
|
365 If the value of @code{selective-display} is a positive integer, then
|
|
366 lines that start with more than that many columns of indentation are not
|
|
367 displayed.
|
|
368 @end itemize
|
|
369
|
|
370 When some portion of a buffer is invisible, the vertical movement
|
|
371 commands operate as if that portion did not exist, allowing a single
|
|
372 @code{next-line} command to skip any number of invisible lines.
|
|
373 However, character movement commands (such as @code{forward-char}) do
|
|
374 not skip the invisible portion, and it is possible (if tricky) to insert
|
|
375 or delete text in an invisible portion.
|
|
376
|
|
377 In the examples below, we show the @emph{display appearance} of the
|
|
378 buffer @code{foo}, which changes with the value of
|
|
379 @code{selective-display}. The @emph{contents} of the buffer do not
|
|
380 change.
|
|
381
|
|
382 @example
|
|
383 @group
|
|
384 (setq selective-display nil)
|
|
385 @result{} nil
|
|
386
|
|
387 ---------- Buffer: foo ----------
|
|
388 1 on this column
|
|
389 2on this column
|
|
390 3n this column
|
|
391 3n this column
|
|
392 2on this column
|
|
393 1 on this column
|
|
394 ---------- Buffer: foo ----------
|
|
395 @end group
|
|
396
|
|
397 @group
|
|
398 (setq selective-display 2)
|
|
399 @result{} 2
|
|
400
|
|
401 ---------- Buffer: foo ----------
|
|
402 1 on this column
|
|
403 2on this column
|
|
404 2on this column
|
|
405 1 on this column
|
|
406 ---------- Buffer: foo ----------
|
|
407 @end group
|
|
408 @end example
|
|
409 @end defvar
|
|
410
|
|
411 @defvar selective-display-ellipses
|
|
412 If this buffer-local variable is non-@code{nil}, then XEmacs displays
|
|
413 @samp{@dots{}} at the end of a line that is followed by invisible text.
|
|
414 This example is a continuation of the previous one.
|
|
415
|
|
416 @example
|
|
417 @group
|
|
418 (setq selective-display-ellipses t)
|
|
419 @result{} t
|
|
420
|
|
421 ---------- Buffer: foo ----------
|
|
422 1 on this column
|
|
423 2on this column ...
|
|
424 2on this column
|
|
425 1 on this column
|
|
426 ---------- Buffer: foo ----------
|
|
427 @end group
|
|
428 @end example
|
|
429
|
|
430 You can use a display table to substitute other text for the ellipsis
|
|
431 (@samp{@dots{}}). @xref{Display Tables}.
|
|
432 @end defvar
|
|
433
|
|
434 @node Overlay Arrow
|
|
435 @section The Overlay Arrow
|
|
436 @cindex overlay arrow
|
|
437
|
|
438 The @dfn{overlay arrow} is useful for directing the user's attention
|
|
439 to a particular line in a buffer. For example, in the modes used for
|
|
440 interface to debuggers, the overlay arrow indicates the line of code
|
|
441 about to be executed.
|
|
442
|
|
443 @defvar overlay-arrow-string
|
|
444 This variable holds the string to display to call attention to a
|
|
445 particular line, or @code{nil} if the arrow feature is not in use.
|
|
446 Despite its name, the value of this variable can be either a string
|
|
447 or a glyph (@pxref{Glyphs}).
|
|
448 @end defvar
|
|
449
|
|
450 @defvar overlay-arrow-position
|
|
451 This variable holds a marker that indicates where to display the overlay
|
|
452 arrow. It should point at the beginning of a line. The arrow text
|
|
453 appears at the beginning of that line, overlaying any text that would
|
|
454 otherwise appear. Since the arrow is usually short, and the line
|
|
455 usually begins with indentation, normally nothing significant is
|
|
456 overwritten.
|
|
457
|
|
458 The overlay string is displayed only in the buffer that this marker
|
|
459 points into. Thus, only one buffer can have an overlay arrow at any
|
|
460 given time.
|
|
461 @c !!! overlay-arrow-position: but the overlay string may remain in the display
|
|
462 @c of some other buffer until an update is required. This should be fixed
|
|
463 @c now. Is it?
|
|
464 @end defvar
|
|
465
|
|
466 You can do the same job by creating an extent with a
|
|
467 @code{begin-glyph} property. @xref{Extent Properties}.
|
|
468
|
|
469 @node Temporary Displays
|
|
470 @section Temporary Displays
|
|
471
|
|
472 Temporary displays are used by commands to put output into a buffer
|
|
473 and then present it to the user for perusal rather than for editing.
|
|
474 Many of the help commands use this feature.
|
|
475
|
|
476 @defspec with-output-to-temp-buffer buffer-name forms@dots{}
|
|
477 This function executes @var{forms} while arranging to insert any
|
|
478 output they print into the buffer named @var{buffer-name}. The buffer
|
|
479 is then shown in some window for viewing, displayed but not selected.
|
|
480
|
|
481 The string @var{buffer-name} specifies the temporary buffer, which
|
|
482 need not already exist. The argument must be a string, not a buffer.
|
|
483 The buffer is erased initially (with no questions asked), and it is
|
|
484 marked as unmodified after @code{with-output-to-temp-buffer} exits.
|
|
485
|
|
486 @code{with-output-to-temp-buffer} binds @code{standard-output} to the
|
|
487 temporary buffer, then it evaluates the forms in @var{forms}. Output
|
|
488 using the Lisp output functions within @var{forms} goes by default to
|
|
489 that buffer (but screen display and messages in the echo area, although
|
|
490 they are ``output'' in the general sense of the word, are not affected).
|
|
491 @xref{Output Functions}.
|
|
492
|
|
493 The value of the last form in @var{forms} is returned.
|
|
494
|
|
495 @example
|
|
496 @group
|
|
497 ---------- Buffer: foo ----------
|
|
498 This is the contents of foo.
|
|
499 ---------- Buffer: foo ----------
|
|
500 @end group
|
|
501
|
|
502 @group
|
|
503 (with-output-to-temp-buffer "foo"
|
|
504 (print 20)
|
|
505 (print standard-output))
|
|
506 @result{} #<buffer foo>
|
|
507
|
|
508 ---------- Buffer: foo ----------
|
|
509 20
|
|
510
|
|
511 #<buffer foo>
|
|
512
|
|
513 ---------- Buffer: foo ----------
|
|
514 @end group
|
|
515 @end example
|
|
516 @end defspec
|
|
517
|
|
518 @defvar temp-buffer-show-function
|
|
519 If this variable is non-@code{nil}, @code{with-output-to-temp-buffer}
|
|
520 calls it as a function to do the job of displaying a help buffer. The
|
|
521 function gets one argument, which is the buffer it should display.
|
|
522
|
|
523 In Emacs versions 18 and earlier, this variable was called
|
|
524 @code{temp-buffer-show-hook}.
|
|
525 @end defvar
|
|
526
|
|
527 @defun momentary-string-display string position &optional char message
|
|
528 This function momentarily displays @var{string} in the current buffer at
|
|
529 @var{position}. It has no effect on the undo list or on the buffer's
|
|
530 modification status.
|
|
531
|
|
532 The momentary display remains until the next input event. If the next
|
|
533 input event is @var{char}, @code{momentary-string-display} ignores it
|
|
534 and returns. Otherwise, that event remains buffered for subsequent use
|
|
535 as input. Thus, typing @var{char} will simply remove the string from
|
|
536 the display, while typing (say) @kbd{C-f} will remove the string from
|
|
537 the display and later (presumably) move point forward. The argument
|
|
538 @var{char} is a space by default.
|
|
539
|
|
540 The return value of @code{momentary-string-display} is not meaningful.
|
|
541
|
|
542 You can do the same job in a more general way by creating an extent
|
|
543 with a begin-glyph property. @xref{Extent Properties}.
|
|
544
|
|
545 If @var{message} is non-@code{nil}, it is displayed in the echo area
|
|
546 while @var{string} is displayed in the buffer. If it is @code{nil}, a
|
|
547 default message says to type @var{char} to continue.
|
|
548
|
|
549 In this example, point is initially located at the beginning of the
|
|
550 second line:
|
|
551
|
|
552 @example
|
|
553 @group
|
|
554 ---------- Buffer: foo ----------
|
|
555 This is the contents of foo.
|
|
556 @point{}Second line.
|
|
557 ---------- Buffer: foo ----------
|
|
558 @end group
|
|
559
|
|
560 @group
|
|
561 (momentary-string-display
|
|
562 "**** Important Message! ****"
|
|
563 (point) ?\r
|
|
564 "Type RET when done reading")
|
|
565 @result{} t
|
|
566 @end group
|
|
567
|
|
568 @group
|
|
569 ---------- Buffer: foo ----------
|
|
570 This is the contents of foo.
|
|
571 **** Important Message! ****Second line.
|
|
572 ---------- Buffer: foo ----------
|
|
573
|
|
574 ---------- Echo Area ----------
|
|
575 Type RET when done reading
|
|
576 ---------- Echo Area ----------
|
|
577 @end group
|
|
578 @end example
|
|
579
|
|
580 This function works by actually changing the text in the buffer. As a
|
|
581 result, if you later undo in this buffer, you will see the message come
|
|
582 and go.
|
|
583 @end defun
|
|
584
|
|
585 @node Blinking
|
|
586 @section Blinking Parentheses
|
|
587 @cindex parenthesis matching
|
|
588 @cindex blinking
|
|
589 @cindex balancing parentheses
|
|
590 @cindex close parenthesis
|
|
591
|
|
592 This section describes the mechanism by which XEmacs shows a matching
|
|
593 open parenthesis when the user inserts a close parenthesis.
|
|
594
|
|
595 @vindex blink-paren-hook
|
|
596 @defvar blink-paren-function
|
|
597 The value of this variable should be a function (of no arguments) to
|
|
598 be called whenever a character with close parenthesis syntax is inserted.
|
|
599 The value of @code{blink-paren-function} may be @code{nil}, in which
|
|
600 case nothing is done.
|
|
601
|
|
602 @quotation
|
|
603 @strong{Please note:} This variable was named @code{blink-paren-hook} in
|
|
604 older Emacs versions, but since it is not called with the standard
|
|
605 convention for hooks, it was renamed to @code{blink-paren-function} in
|
|
606 version 19.
|
|
607 @end quotation
|
|
608 @end defvar
|
|
609
|
|
610 @defvar blink-matching-paren
|
|
611 If this variable is @code{nil}, then @code{blink-matching-open} does
|
|
612 nothing.
|
|
613 @end defvar
|
|
614
|
|
615 @defvar blink-matching-paren-distance
|
|
616 This variable specifies the maximum distance to scan for a matching
|
|
617 parenthesis before giving up.
|
|
618 @end defvar
|
|
619
|
|
620 @defvar blink-matching-paren-delay
|
|
621 This variable specifies the number of seconds for the cursor to remain
|
|
622 at the matching parenthesis. A fraction of a second often gives
|
|
623 good results, but the default is 1, which works on all systems.
|
|
624 @end defvar
|
|
625
|
|
626 @defun blink-matching-open
|
|
627 This function is the default value of @code{blink-paren-function}. It
|
|
628 assumes that point follows a character with close parenthesis syntax and
|
|
629 moves the cursor momentarily to the matching opening character. If that
|
|
630 character is not already on the screen, it displays the character's
|
|
631 context in the echo area. To avoid long delays, this function does not
|
|
632 search farther than @code{blink-matching-paren-distance} characters.
|
|
633
|
|
634 Here is an example of calling this function explicitly.
|
|
635
|
|
636 @smallexample
|
|
637 @group
|
|
638 (defun interactive-blink-matching-open ()
|
|
639 @c Do not break this line! -- rms.
|
|
640 @c The first line of a doc string
|
|
641 @c must stand alone.
|
|
642 "Indicate momentarily the start of sexp before point."
|
|
643 (interactive)
|
|
644 @end group
|
|
645 @group
|
|
646 (let ((blink-matching-paren-distance
|
|
647 (buffer-size))
|
|
648 (blink-matching-paren t))
|
|
649 (blink-matching-open)))
|
|
650 @end group
|
|
651 @end smallexample
|
|
652 @end defun
|
|
653
|
|
654 @node Usual Display
|
|
655 @section Usual Display Conventions
|
|
656
|
|
657 The usual display conventions define how to display each character
|
|
658 code. You can override these conventions by setting up a display table
|
|
659 (@pxref{Display Tables}). Here are the usual display conventions:
|
|
660
|
|
661 @itemize @bullet
|
|
662 @item
|
|
663 Character codes 32 through 126 map to glyph codes 32 through 126.
|
|
664 Normally this means they display as themselves.
|
|
665
|
|
666 @item
|
|
667 Character code 9 is a horizontal tab. It displays as whitespace
|
|
668 up to a position determined by @code{tab-width}.
|
|
669
|
|
670 @item
|
|
671 Character code 10 is a newline.
|
|
672
|
|
673 @item
|
|
674 All other codes in the range 0 through 31, and code 127, display in one
|
|
675 of two ways according to the value of @code{ctl-arrow}. If it is
|
|
676 non-@code{nil}, these codes map to sequences of two glyphs, where the
|
|
677 first glyph is the @sc{ASCII} code for @samp{^}. (A display table can
|
|
678 specify a glyph to use instead of @samp{^}.) Otherwise, these codes map
|
|
679 just like the codes in the range 128 to 255.
|
|
680
|
|
681 @item
|
|
682 Character codes 128 through 255 map to sequences of four glyphs, where
|
|
683 the first glyph is the @sc{ASCII} code for @samp{\}, and the others are
|
|
684 digit characters representing the code in octal. (A display table can
|
|
685 specify a glyph to use instead of @samp{\}.)
|
|
686 @end itemize
|
|
687
|
|
688 The usual display conventions apply even when there is a display
|
|
689 table, for any character whose entry in the active display table is
|
|
690 @code{nil}. Thus, when you set up a display table, you need only
|
|
691 specify the characters for which you want unusual behavior.
|
|
692
|
|
693 These variables affect the way certain characters are displayed on the
|
|
694 screen. Since they change the number of columns the characters occupy,
|
|
695 they also affect the indentation functions.
|
|
696
|
|
697 @defopt ctl-arrow
|
|
698 @cindex control characters in display
|
|
699 This buffer-local variable controls how control characters are
|
|
700 displayed. If it is non-@code{nil}, they are displayed as a caret
|
|
701 followed by the character: @samp{^A}. If it is @code{nil}, they are
|
|
702 displayed as a backslash followed by three octal digits: @samp{\001}.
|
|
703 @end defopt
|
|
704
|
|
705 @c Following may have overfull hbox.
|
|
706 @defvar default-ctl-arrow
|
|
707 The value of this variable is the default value for @code{ctl-arrow} in
|
|
708 buffers that do not override it. @xref{Default Value}.
|
|
709 @end defvar
|
|
710
|
|
711 @defopt tab-width
|
|
712 The value of this variable is the spacing between tab stops used for
|
|
713 displaying tab characters in Emacs buffers. The default is 8. Note
|
|
714 that this feature is completely independent from the user-settable tab
|
|
715 stops used by the command @code{tab-to-tab-stop}. @xref{Indent Tabs}.
|
|
716 @end defopt
|
|
717
|
|
718 @node Display Tables
|
|
719 @section Display Tables
|
|
720
|
|
721 @cindex display table
|
|
722 You can use the @dfn{display table} feature to control how all 256
|
|
723 possible character codes display on the screen. This is useful for
|
|
724 displaying European languages that have letters not in the @sc{ASCII}
|
|
725 character set.
|
|
726
|
|
727 The display table maps each character code into a sequence of
|
|
728 @dfn{runes}, each rune being an image that takes up one character
|
|
729 position on the screen. You can also define how to display each rune
|
|
730 on your terminal, using the @dfn{rune table}.
|
|
731
|
|
732 @menu
|
|
733 * Display Table Format:: What a display table consists of.
|
|
734 * Active Display Table:: How XEmacs selects a display table to use.
|
|
735 * Character Descriptors:: Format of an individual element of a
|
|
736 display table.
|
|
737 @end menu
|
|
738
|
|
739 @ignore Not yet working in XEmacs?
|
|
740 * ISO Latin 1:: How to use display tables
|
|
741 to support the ISO Latin 1 character set.
|
|
742 @end ignore
|
|
743
|
|
744 @node Display Table Format
|
|
745 @subsection Display Table Format
|
|
746
|
|
747 A display table is an array of 256 elements. (In FSF Emacs, a display
|
|
748 table is 262 elements. The six extra elements specify the truncation
|
|
749 and continuation glyphs, etc. This method is very kludgey, and in
|
|
750 XEmacs the variables @code{truncation-glyph}, @code{continuation-glyph},
|
|
751 etc. are used. @xref{Truncation}.)
|
|
752
|
|
753 @defun make-display-table
|
|
754 This creates and returns a display table. The table initially has
|
|
755 @code{nil} in all elements.
|
|
756 @end defun
|
|
757
|
|
758 The 256 elements correspond to character codes; the @var{n}th
|
|
759 element says how to display the character code @var{n}. The value
|
|
760 should be @code{nil}, a string, a glyph, or a vector of strings and
|
|
761 glyphs (@pxref{Character Descriptors}). If an element is @code{nil},
|
|
762 it says to display that character according to the usual display
|
|
763 conventions (@pxref{Usual Display}).
|
|
764
|
|
765 If you use the display table to change the display of newline
|
|
766 characters, the whole buffer will be displayed as one long ``line.''
|
|
767
|
|
768 For example, here is how to construct a display table that mimics the
|
|
769 effect of setting @code{ctl-arrow} to a non-@code{nil} value:
|
|
770
|
|
771 @example
|
|
772 (setq disptab (make-display-table))
|
|
773 (let ((i 0))
|
|
774 (while (< i 32)
|
|
775 (or (= i ?\t) (= i ?\n)
|
|
776 (aset disptab i (concat "^" (char-to-string (+ i 64)))))
|
|
777 (setq i (1+ i)))
|
|
778 (aset disptab 127 "^?"))
|
|
779 @end example
|
|
780
|
|
781 @node Active Display Table
|
|
782 @subsection Active Display Table
|
|
783 @cindex active display table
|
|
784
|
|
785 The active display table is controlled by the variable
|
|
786 @code{current-display-table}. This is a specifier, which means
|
|
787 that you can specify separate values for it in individual buffers,
|
|
788 windows, frames, and devices, as well as a global value. It also
|
|
789 means that you cannot set this variable using @code{setq}; use
|
|
790 @code{set-specifier} instead. @xref{Specifiers}. (FSF Emacs
|
|
791 uses @code{window-display-table}, @code{buffer-display-table},
|
|
792 @code{standard-display-table}, etc. to control the display table.
|
|
793 However, specifiers are a cleaner and more powerful way of doing
|
|
794 the same thing. FSF Emacs also uses a different format for
|
|
795 the contents of a display table, using additional indirection
|
|
796 to a ``glyph table'' and such. Note that ``glyph'' has a different
|
|
797 meaning in XEmacs.)
|
|
798
|
|
799 Individual faces can also specify an overriding display table;
|
|
800 this is set using @code{set-face-display-table}. @xref{Faces}.
|
|
801
|
|
802 If no display table can be determined for a particular window,
|
|
803 then XEmacs uses the usual display conventions. @xref{Usual Display}.
|
|
804
|
|
805 @node Character Descriptors
|
|
806 @subsection Character Descriptors
|
|
807
|
|
808 @cindex character descriptor
|
|
809 Each element of the display-table vector describes how to display
|
|
810 a particular character and is called a @dfn{character descriptor}.
|
|
811 A character descriptor can be:
|
|
812
|
|
813 @table @asis
|
|
814 @item a string
|
|
815 Display this particular string wherever the character is to be displayed.
|
|
816
|
|
817 @item a glyph
|
|
818 Display this particular glyph wherever the character is to be displayed.
|
|
819
|
|
820 @item a vector
|
|
821 The vector may contain strings and/or glyphs. Display the elements of
|
|
822 the vector one after another wherever the character is to be displayed.
|
|
823
|
|
824 @item @code{nil}
|
|
825 Display according to the standard interpretation (@pxref{Usual Display}).
|
|
826 @end table
|
|
827
|
|
828 @ignore Not yet working in XEmacs?
|
|
829 @node ISO Latin 1
|
|
830 @subsection ISO Latin 1
|
|
831
|
|
832 If you have a terminal that can handle the entire ISO Latin 1 character
|
|
833 set, you can arrange to use that character set as follows:
|
|
834
|
|
835 @example
|
|
836 (require 'disp-table)
|
|
837 ;; @r{Set char codes 160--255 to display as themselves.}
|
|
838 ;; @r{(Codes 128--159 are the additional control characters.)}
|
|
839 (standard-display-8bit 160 255)
|
|
840 @end example
|
|
841
|
|
842 If you are editing buffers written in the ISO Latin 1 character set and
|
|
843 your terminal doesn't handle anything but @sc{ASCII}, you can load the
|
|
844 file @file{iso-ascii} to set up a display table that displays the other
|
|
845 ISO characters as explanatory sequences of @sc{ASCII} characters. For
|
|
846 example, the character ``o with umlaut'' displays as @samp{@{"o@}}.
|
|
847
|
|
848 Some European countries have terminals that don't support ISO Latin 1
|
|
849 but do support the special characters for that country's language. You
|
|
850 can define a display table to work one language using such terminals.
|
|
851 For an example, see @file{lisp/iso-swed.el}, which handles certain
|
|
852 Swedish terminals.
|
|
853
|
|
854 You can load the appropriate display table for your terminal
|
|
855 automatically by writing a terminal-specific Lisp file for the terminal
|
|
856 type.
|
|
857 @end ignore
|
|
858
|
|
859 @node Beeping
|
|
860 @section Beeping
|
|
861 @cindex beeping
|
|
862 @cindex bell
|
|
863 @cindex sound
|
|
864
|
|
865 You can make XEmacs ring a bell, play a sound, or blink the screen to
|
|
866 attract the user's attention. Be conservative about how often you do
|
|
867 this; frequent bells can become irritating. Also be careful not to use
|
|
868 beeping alone when signaling an error is appropriate. (@xref{Errors}.)
|
|
869
|
|
870 @defun ding &optional dont-terminate sound device
|
|
871 @cindex keyboard macro termination
|
|
872 This function beeps, or flashes the screen (see @code{visible-bell}
|
|
873 below). It also terminates any keyboard macro currently executing
|
|
874 unless @var{dont-terminate} is non-@code{nil}. If @var{sound} is
|
|
875 specified, it should be a symbol specifying which sound to make. This
|
|
876 sound will be played if @code{visible-bell} is @code{nil}. (This only
|
|
877 works if sound support was compiled into the executable and you are
|
259
|
878 running on the console of a Sun SparcStation, SGI, HP9000s700, or Linux
|
|
879 PC. Otherwise you just get a beep.) The optional third argument
|
|
880 specifies what device to make the sound on, and defaults to the selected
|
|
881 device.
|
0
|
882 @end defun
|
|
883
|
|
884 @defun beep &optional dont-terminate sound device
|
|
885 This is a synonym for @code{ding}.
|
|
886 @end defun
|
|
887
|
|
888 @defopt visible-bell
|
|
889 This variable determines whether XEmacs should flash the screen to
|
|
890 represent a bell. Non-@code{nil} means yes, @code{nil} means no. On
|
|
891 TTY devices, this is effective only if the Termcap entry for the
|
|
892 terminal type has the visible bell flag (@samp{vb}) set.
|
|
893 @end defopt
|
|
894
|
|
895 @defvar sound-alist
|
|
896 This variable holds an alist associating names with sounds. When
|
|
897 @code{beep} or @code{ding} is called with one of the name symbols, the
|
|
898 associated sound will be generated instead of the standard beep.
|
|
899
|
|
900 Each element of @code{sound-alist} is a list describing a sound. The
|
|
901 first element of the list is the name of the sound being defined.
|
|
902 Subsequent elements of the list are alternating keyword/value pairs:
|
|
903
|
|
904 @table @code
|
|
905 @item sound
|
|
906 A string of raw sound data, or the name of another sound to play. The
|
|
907 symbol @code{t} here means use the default X beep.
|
|
908 @item volume
|
|
909 An integer from 0-100, defaulting to @code{bell-volume}.
|
|
910 @item pitch
|
|
911 If using the default X beep, the pitch (Hz) to generate.
|
|
912 @item duration
|
|
913 If using the default X beep, the duration (milliseconds).
|
|
914 @end table
|
|
915
|
|
916 For compatibility, elements of `sound-alist' may also be:
|
|
917
|
|
918 @itemize @bullet
|
|
919 @item
|
|
920 @code{( sound-name . <sound> )}
|
|
921 @item
|
|
922 @code{( sound-name <volume> <sound> )}
|
|
923 @end itemize
|
|
924
|
|
925 You should probably add things to this list by calling the function
|
|
926 @code{load-sound-file}.
|
|
927
|
|
928 Caveats:
|
|
929
|
|
930 @itemize @minus
|
|
931 @item
|
|
932 You can only play audio data if running on the console screen of a Sun
|
|
933 SparcStation, SGI, or HP9000s700.
|
|
934
|
|
935 @item
|
|
936 The pitch, duration, and volume options are available everywhere, but
|
|
937 many X servers ignore the `pitch' option.
|
|
938 @end itemize
|
|
939
|
|
940 The following beep-types are used by XEmacs itself:
|
|
941
|
|
942 @table @code
|
|
943 @item auto-save-error
|
|
944 when an auto-save does not succeed
|
|
945 @item command-error
|
|
946 when the XEmacs command loop catches an error
|
|
947 @item undefined-key
|
|
948 when you type a key that is undefined
|
|
949 @item undefined-click
|
|
950 when you use an undefined mouse-click combination
|
|
951 @item no-completion
|
|
952 during completing-read
|
|
953 @item y-or-n-p
|
|
954 when you type something other than 'y' or 'n'
|
|
955 @item yes-or-no-p
|
|
956 when you type something other than 'yes' or 'no'
|
|
957 @item default
|
|
958 used when nothing else is appropriate.
|
|
959 @end table
|
|
960
|
|
961 Other lisp packages may use other beep types, but these are the ones that
|
|
962 the C kernel of XEmacs uses.
|
|
963 @end defvar
|
|
964
|
|
965 @defopt bell-volume
|
|
966 This variable specifies the default volume for sounds, from 0 to 100.
|
|
967 @end defopt
|
|
968
|
|
969 @deffn Command load-default-sounds
|
|
970 This function loads and installs some sound files as beep-types.
|
|
971 @end deffn
|
|
972
|
|
973 @deffn Command load-sound-file filename sound-name &optional volume
|
|
974 This function reads in an audio file and adds it to @code{sound-alist}.
|
|
975 The sound file must be in the Sun/NeXT U-LAW format. @var{sound-name}
|
|
976 should be a symbol, specifying the name of the sound. If @var{volume}
|
|
977 is specified, the sound will be played at that volume; otherwise, the
|
|
978 value of @var{bell-volume} will be used.
|
|
979 @end deffn
|
|
980
|
|
981 @defun play-sound sound &optional volume device
|
|
982 This function plays sound @var{sound}, which should be a symbol
|
|
983 mentioned in @code{sound-alist}. If @var{volume} is specified, it
|
|
984 overrides the value (if any) specified in @code{sound-alist}.
|
|
985 @var{device} specifies the device to play the sound on, and defaults
|
|
986 to the selected device.
|
|
987 @end defun
|
|
988
|
|
989 @deffn Command play-sound-file file &optional volume device
|
|
990 This function plays the named sound file at volume @var{volume}, which
|
|
991 defaults to @code{bell-volume}. @var{device} specifies the device to
|
|
992 play the sound on, and defaults to the selected device.
|
|
993 @end deffn
|