2 @c This is part of the XEmacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998 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
9 This chapter describes a number of other features related to the display
10 that XEmacs presents to the user.
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 * Warnings:: Display of Warnings.
17 * Invisible Text:: Hiding part of the buffer text.
18 * Selective Display:: Hiding part of the buffer text (the old way).
19 * Overlay Arrow:: Display of an arrow to indicate position.
20 * Temporary Displays:: Displays that go away automatically.
21 * Blinking:: How XEmacs shows the matching open parenthesis.
22 * Usual Display:: The usual conventions for displaying nonprinting chars.
23 * Display Tables:: How to specify other conventions.
24 * Beeping:: Audible signal to the user.
28 @section Refreshing the Screen
30 The function @code{redraw-frame} redisplays the entire contents of a
31 given frame. @xref{Frames}.
34 @defun redraw-frame frame
35 This function clears and redisplays frame @var{frame}.
38 Even more powerful is @code{redraw-display}:
40 @deffn Command redraw-display &optional device
41 This function redraws all frames on @var{device} marked as having their
42 image garbled. @var{device} defaults to the selected device. If
43 @var{device} is @code{t}, all devices will have their frames checked.
46 Processing user input takes absolute priority over redisplay. If you
47 call these functions when input is available, they do nothing
48 immediately, but a full redisplay does happen eventually---after all the
49 input has been processed.
51 Normally, suspending and resuming XEmacs also refreshes the screen.
52 Some terminal emulators record separate contents for display-oriented
53 programs such as XEmacs and for ordinary sequential display. If you are
54 using such a terminal, you might want to inhibit the redisplay on
55 resumption. @xref{Suspending XEmacs}.
57 @defvar no-redraw-on-reenter
58 @cindex suspend (cf. @code{no-redraw-on-reenter})
59 @cindex resume (cf. @code{no-redraw-on-reenter})
60 This variable controls whether XEmacs redraws the entire screen after it
61 has been suspended and resumed. Non-@code{nil} means yes, @code{nil}
65 @cindex display update
66 @cindex update display
67 @cindex refresh display
68 The above functions do not actually cause the display to be updated;
69 rather, they clear out the internal display records that XEmacs
70 maintains, so that the next time the display is updated it will be
71 redrawn from scratch. Normally this occurs the next time that
72 @code{next-event} or @code{sit-for} is called; however, a display update
73 will not occur if there is input pending. @xref{Command Loop}.
75 @defun force-cursor-redisplay
76 This function causes an immediate update of the cursor on the selected
77 frame. (This function does not exist in FSF Emacs.)
83 @cindex continuation lines
84 @cindex @samp{$} in display
85 @cindex @samp{\} in display
87 When a line of text extends beyond the right edge of a window, the
88 line can either be truncated or continued on the next line. When a line
89 is truncated, this is normally shown with a @samp{\} in the rightmost
90 column of the window on X displays, and with a @samp{$} on TTY devices.
91 When a line is continued or ``wrapped'' onto the next line, this is
92 shown with a curved arrow in the rightmost column of the window (or with
93 a @samp{\} on TTY devices). The additional screen lines used to display
94 a long text line are called @dfn{continuation} lines.
96 Normally, whenever line truncation is in effect for a particular
97 window, a horizontal scrollbar is displayed in that window if the
98 device supports scrollbars. @xref{Scrollbars}.
100 Note that continuation is different from filling; continuation happens
101 on the screen only, not in the buffer contents, and it breaks a line
102 precisely at the right margin, not at a word boundary. @xref{Filling}.
104 @defopt truncate-lines
105 This buffer-local variable controls how XEmacs displays lines that
106 extend beyond the right edge of the window. If it is non-@code{nil},
107 then XEmacs does not display continuation lines; rather each line of
108 text occupies exactly one screen line, and a backslash appears at the
109 edge of any line that extends to or beyond the edge of the window. The
110 default is @code{nil}.
112 If the variable @code{truncate-partial-width-windows} is non-@code{nil},
113 then truncation is always used for side-by-side windows (within one
114 frame) regardless of the value of @code{truncate-lines}.
117 @defopt default-truncate-lines
118 This variable is the default value for @code{truncate-lines}, for
119 buffers that do not have local values for it.
122 @defopt truncate-partial-width-windows
123 This variable controls display of lines that extend beyond the right
124 edge of the window, in side-by-side windows (@pxref{Splitting Windows}).
125 If it is non-@code{nil}, these lines are truncated; otherwise,
126 @code{truncate-lines} says what to do with them.
129 The backslash and curved arrow used to indicate truncated or continued
130 lines are only defaults, and can be changed. These images are actually
131 glyphs (@pxref{Glyphs}). XEmacs provides a great deal of flexibility
132 in how glyphs can be controlled. (This differs from FSF Emacs, which
133 uses display tables to control these images.)
135 For details, @ref{Redisplay Glyphs}.
137 @ignore Not yet in XEmacs
138 If your buffer contains @strong{very} long lines, and you use
139 continuation to display them, just thinking about them can make Emacs
140 redisplay slow. The column computation and indentation functions also
141 become slow. Then you might find it advisable to set
142 @code{cache-long-line-scans} to @code{t}.
144 @defvar cache-long-line-scans
145 If this variable is non-@code{nil}, various indentation and motion
146 functions, and Emacs redisplay, cache the results of scanning the
147 buffer, and consult the cache to avoid rescanning regions of the buffer
148 unless they are modified.
150 Turning on the cache slows down processing of short lines somewhat.
152 This variable is automatically local in every buffer.
157 @section The Echo Area
158 @cindex error display
161 The @dfn{echo area} is used for displaying messages made with the
162 @code{message} primitive, and for echoing keystrokes. It is not the
163 same as the minibuffer, despite the fact that the minibuffer appears
164 (when active) in the same place on the screen as the echo area. The
165 @cite{XEmacs Reference Manual} specifies the rules for resolving conflicts
166 between the echo area and the minibuffer for use of that screen space
167 (@pxref{Minibuffer,, The Minibuffer, emacs, The XEmacs Reference Manual}).
168 Error messages appear in the echo area; see @ref{Errors}.
170 You can write output in the echo area by using the Lisp printing
171 functions with @code{t} as the stream (@pxref{Output Functions}), or as
174 @defun message string &rest arguments
175 This function displays a one-line message in the echo area. The
176 argument @var{string} is similar to a C language @code{printf} control
177 string. See @code{format} in @ref{String Conversion}, for the details
178 on the conversion specifications. @code{message} returns the
181 In batch mode, @code{message} prints the message text on the standard
182 error stream, followed by a newline.
185 If @var{string} is @code{nil}, @code{message} clears the echo area. If
186 the minibuffer is active, this brings the minibuffer contents back onto
187 the screen immediately.
191 (message "Minibuffer depth is %d."
193 @print{} Minibuffer depth is 0.
194 @result{} "Minibuffer depth is 0."
198 ---------- Echo Area ----------
199 Minibuffer depth is 0.
200 ---------- Echo Area ----------
205 In addition to only displaying a message, XEmacs allows you to
206 @dfn{label} your messages, giving you fine-grained control of their
207 display. Message label is a symbol denoting the message type. Some
211 @item @code{message}---default label used by the @code{message}
214 @item @code{error}---default label used for reporting errors;
216 @item @code{progress}---progress indicators like
217 @samp{Converting... 45%} (not logged by default);
219 @item @code{prompt}---prompt-like messages like @samp{Isearch: foo} (not
222 @item @code{command}---helper command messages like @samp{Mark set} (not
225 @item @code{no-log}---messages that should never be logged
228 Several messages may be stacked in the echo area at once. Lisp programs
229 may access these messages, or remove them as appropriate, via the
232 @defun display-message label message &optional frame stdout-p
233 This function displays @var{message} (a string) labeled as @var{label},
236 The @var{frame} argument specifies the frame to whose minibuffer the
237 message should be printed. This is currently unimplemented. The
238 @var{stdout-p} argument is used internally.
241 (display-message 'command "Mark set")
245 @defun lmessage label string &rest arguments
246 This function displays a message @var{string} with label @var{label}.
247 It is similar to @code{message} in that it accepts a @code{printf}-like
248 strings and any number of arguments.
252 ;; @r{Display a command message.}
253 (lmessage 'command "Comment column set to %d" comment-column)
257 ;; @r{Display a progress message.}
258 (lmessage 'progress "Fontifying %s... (%d)" buffer percentage)
262 ;; @r{Display a message that should not be logged.}
263 (lmessage 'no-log "Done")
268 @defun clear-message &optional label frame stdout-p no-restore
269 This function remove any message with the given @var{label}
270 from the message-stack, erasing it from the echo area if it's currently
273 If a message remains at the head of the message-stack and
274 @var{no-restore} is @code{nil}, it will be displayed. The string which
275 remains in the echo area will be returned, or @code{nil} if the
276 message-stack is now empty. If @var{label} is nil, the entire
277 message-stack is cleared.
280 ;; @r{Show a message, wait for 2 seconds, and restore old minibuffer}
282 (message "A message")
284 @result{} "A Message"
285 (lmessage 'my-label "Newsflash! Newsflash!")
286 @print{} Newsflash! Newsflash!
287 @result{} "Newsflash! Newsflash!"
289 (clear-message 'my-label)
291 @result{} "A message"
294 Unless you need the return value or you need to specify a label,
295 you should just use @code{(message nil)}.
298 @defun current-message &optional frame
299 This function returns the current message in the echo area, or
300 @code{nil}. The @var{frame} argument is currently unused.
303 Some of the messages displayed in the echo area are also recorded in the
304 @samp{ *Message-Log*} buffer. Exactly which messages will be recorded
305 can be tuned using the following variables.
307 @defopt log-message-max-size
308 This variable specifies the maximum size of the @samp{ *Message-log*}
312 @defvar log-message-ignore-labels
313 This variable specifies the labels whose messages will not be logged.
314 It should be a list of symbols.
317 @defvar log-message-ignore-regexps
318 This variable specifies the regular expressions matching messages that
319 will not be logged. It should be a list of regular expressions.
321 Normally, packages that generate messages that might need to be ignored
322 should label them with @code{progress}, @code{prompt}, or @code{no-log},
323 so they can be filtered by @code{log-message-ignore-labels}.
326 @defvar echo-keystrokes
327 This variable determines how much time should elapse before command
328 characters echo. Its value must be a number, which specifies the number
329 of seconds to wait before echoing. If the user types a prefix key (such
330 as @kbd{C-x}) and then delays this many seconds before continuing, the
331 prefix key is echoed in the echo area. Any subsequent characters in the
332 same command will be echoed as well.
334 If the value is zero, then command input is not echoed.
337 @defvar cursor-in-echo-area
338 This variable controls where the cursor appears when a message is
339 displayed in the echo area. If it is non-@code{nil}, then the cursor
340 appears at the end of the message. Otherwise, the cursor appears at
341 point---not in the echo area at all.
343 The value is normally @code{nil}; Lisp programs bind it to @code{t}
344 for brief periods of time.
350 XEmacs contains a facility for unified display of various warnings.
351 Unlike errors, warnings are displayed in the situations when XEmacs
352 encounters a problem that is recoverable, but which should be fixed for
353 safe future operation.
355 For example, warnings are printed by the startup code when it encounters
356 problems with X keysyms, when there is an error in @file{.emacs}, and in
357 other problematic situations. Unlike messages, warnings are displayed
358 in a separate buffer, and include an explanatory message that may span
359 across several lines. Here is an example of how a warning is displayed:
362 (1) (initialization/error) An error has occured while loading ~/.emacs:
364 Symbol's value as variable is void: bogus-variable
366 To ensure normal operation, you should investigate the cause of the error
367 in your initialization file and remove it. Use the `-debug-init' option
368 to XEmacs to view a complete error backtrace.
371 Each warning has a @dfn{class} and a @dfn{priority level}. The class is
372 a symbol describing what sort of warning this is, such as
373 @code{initialization}, @code{resource} or @code{key-mapping}.
375 The warning priority level specifies how important the warning is. The
376 recognized warning levels, in increased order of priority, are:
377 @code{debug}, @code{info}, @code{notice}, @code{warning}, @code{error},
378 @code{critical}, @code{alert} and @code{emergency}.
380 @defun display-warning class message &optional level
381 This function displays a warning message @var{message} (a string).
382 @var{class} should be a warning class symbol, as described above, or a
383 list of such symbols. @var{level} describes the warning priority level.
384 If unspecified, it default to @code{warning}.
388 (display-warning 'resource
389 "Bad resource specification encountered:
394 You should replace the * with a . in order to get proper behavior when
395 you use the specifier and/or `set-face-*' functions.")
399 ---------- Warning buffer ----------
400 (1) (resource/warning) Bad resource specification encountered:
405 You should replace the * with a . in order to get proper behavior when
406 you use the specifier and/or `set-face-*' functions.
407 ---------- Warning buffer ----------
412 @defun lwarn class level message &rest args
413 This function displays a formatted labeled warning message. As above,
414 @var{class} should be the warning class symbol, or a list of such
415 symbols, and @var{level} should specify the warning priority level
416 (@code{warning} by default).
418 Unlike in @code{display-warning}, @var{message} may be a formatted
419 message, which will be, together with the rest of the arguments, passed
423 (lwarn 'message-log 'warning
424 "Error caught in `remove-message-hook': %s"
425 (error-message-string e))
429 @defvar log-warning-minimum-level
430 This variable specifies the minimum level of warnings that should be
431 generated. Warnings with level lower than defined by this variable are
432 completely ignored, as if they never happened.
435 @defvar display-warning-minimum-level
436 This variable specifies the minimum level of warnings that should be
437 displayed. Unlike @code{log-warning-minimum-level}, setting this
438 function does not suppress warnings entirely---they are still generated
439 in the @samp{*Warnings*} buffer, only they are not displayed by default.
442 @defvar log-warning-suppressed-classes
443 This variable specifies a list of classes that should not be logged or
444 displayed. If any of the class symbols associated with a warning is the
445 same as any of the symbols listed here, the warning will be completely
446 ignored, as it they never happened.
449 @defvar display-warning-suppressed-classes
450 This variable specifies a list of classes that should not be logged or
451 displayed. If any of the class symbols associated with a warning is the
452 same as any of the symbols listed here, the warning will not be
453 displayed. The warning will still logged in the *Warnings* buffer
454 (unless also contained in `log-warning-suppressed-classes'), but the
455 buffer will not be automatically popped up.
459 @section Invisible Text
461 @cindex invisible text
462 You can make characters @dfn{invisible}, so that they do not appear on
463 the screen, with the @code{invisible} property. This can be either a
464 text property or a property of an overlay.
466 In the simplest case, any non-@code{nil} @code{invisible} property makes
467 a character invisible. This is the default case---if you don't alter
468 the default value of @code{buffer-invisibility-spec}, this is how the
469 @code{invisibility} property works. This feature is much like selective
470 display (@pxref{Selective Display}), but more general and cleaner.
472 More generally, you can use the variable @code{buffer-invisibility-spec}
473 to control which values of the @code{invisible} property make text
474 invisible. This permits you to classify the text into different subsets
475 in advance, by giving them different @code{invisible} values, and
476 subsequently make various subsets visible or invisible by changing the
477 value of @code{buffer-invisibility-spec}.
479 Controlling visibility with @code{buffer-invisibility-spec} is
480 especially useful in a program to display the list of entries in a data
481 base. It permits the implementation of convenient filtering commands to
482 view just a part of the entries in the data base. Setting this variable
483 is very fast, much faster than scanning all the text in the buffer
484 looking for properties to change.
486 @defvar buffer-invisibility-spec
487 This variable specifies which kinds of @code{invisible} properties
488 actually make a character invisible.
492 A character is invisible if its @code{invisible} property is
493 non-@code{nil}. This is the default.
496 Each element of the list makes certain characters invisible.
497 Ultimately, a character is invisible if any of the elements of this list
498 applies to it. The list can have two kinds of elements:
502 A character is invisible if its @code{invisible} propery value
503 is @var{atom} or if it is a list with @var{atom} as a member.
505 @item (@var{atom} . t)
506 A character is invisible if its @code{invisible} propery value
507 is @var{atom} or if it is a list with @var{atom} as a member.
508 Moreover, if this character is at the end of a line and is followed
509 by a visible newline, it displays an ellipsis.
514 Ordinarily, commands that operate on text or move point do not care
515 whether the text is invisible. However, the user-level line motion
516 commands explicitly ignore invisible newlines.
518 @node Selective Display
519 @section Selective Display
520 @cindex selective display
522 @dfn{Selective display} is a pair of features that hide certain
525 The first variant, explicit selective display, is designed for use in
526 a Lisp program. The program controls which lines are hidden by altering
527 the text. Outline mode has traditionally used this variant. It has
528 been partially replaced by the invisible text feature (@pxref{Invisible
529 Text}); there is a new version of Outline mode which uses that instead.
531 In the second variant, the choice of lines to hide is made
532 automatically based on indentation. This variant is designed to be a
535 The way you control explicit selective display is by replacing a
536 newline (control-j) with a carriage return (control-m). The text that
537 was formerly a line following that newline is now invisible. Strictly
538 speaking, it is temporarily no longer a line at all, since only newlines
539 can separate lines; it is now part of the previous line.
541 Selective display does not directly affect editing commands. For
542 example, @kbd{C-f} (@code{forward-char}) moves point unhesitatingly into
543 invisible text. However, the replacement of newline characters with
544 carriage return characters affects some editing commands. For example,
545 @code{next-line} skips invisible lines, since it searches only for
546 newlines. Modes that use selective display can also define commands
547 that take account of the newlines, or that make parts of the text
548 visible or invisible.
550 When you write a selectively displayed buffer into a file, all the
551 control-m's are output as newlines. This means that when you next read
552 in the file, it looks OK, with nothing invisible. The selective display
553 effect is seen only within XEmacs.
555 @defvar selective-display
556 This buffer-local variable enables selective display. This means that
557 lines, or portions of lines, may be made invisible.
561 If the value of @code{selective-display} is @code{t}, then any portion
562 of a line that follows a control-m is not displayed.
565 If the value of @code{selective-display} is a positive integer, then
566 lines that start with more than that many columns of indentation are not
570 When some portion of a buffer is invisible, the vertical movement
571 commands operate as if that portion did not exist, allowing a single
572 @code{next-line} command to skip any number of invisible lines.
573 However, character movement commands (such as @code{forward-char}) do
574 not skip the invisible portion, and it is possible (if tricky) to insert
575 or delete text in an invisible portion.
577 In the examples below, we show the @emph{display appearance} of the
578 buffer @code{foo}, which changes with the value of
579 @code{selective-display}. The @emph{contents} of the buffer do not
584 (setq selective-display nil)
587 ---------- Buffer: foo ----------
594 ---------- Buffer: foo ----------
598 (setq selective-display 2)
601 ---------- Buffer: foo ----------
606 ---------- Buffer: foo ----------
611 @defvar selective-display-ellipses
612 If this buffer-local variable is non-@code{nil}, then XEmacs displays
613 @samp{@dots{}} at the end of a line that is followed by invisible text.
614 This example is a continuation of the previous one.
618 (setq selective-display-ellipses t)
621 ---------- Buffer: foo ----------
626 ---------- Buffer: foo ----------
630 You can use a display table to substitute other text for the ellipsis
631 (@samp{@dots{}}). @xref{Display Tables}.
635 @section The Overlay Arrow
636 @cindex overlay arrow
638 The @dfn{overlay arrow} is useful for directing the user's attention
639 to a particular line in a buffer. For example, in the modes used for
640 interface to debuggers, the overlay arrow indicates the line of code
641 about to be executed.
643 @defvar overlay-arrow-string
644 This variable holds the string to display to call attention to a
645 particular line, or @code{nil} if the arrow feature is not in use.
646 Despite its name, the value of this variable can be either a string
647 or a glyph (@pxref{Glyphs}).
650 @defvar overlay-arrow-position
651 This variable holds a marker that indicates where to display the overlay
652 arrow. It should point at the beginning of a line. The arrow text
653 appears at the beginning of that line, overlaying any text that would
654 otherwise appear. Since the arrow is usually short, and the line
655 usually begins with indentation, normally nothing significant is
658 The overlay string is displayed only in the buffer that this marker
659 points into. Thus, only one buffer can have an overlay arrow at any
661 @c !!! overlay-arrow-position: but the overlay string may remain in the display
662 @c of some other buffer until an update is required. This should be fixed
666 You can do the same job by creating an extent with a
667 @code{begin-glyph} property. @xref{Extent Properties}.
669 @node Temporary Displays
670 @section Temporary Displays
672 Temporary displays are used by commands to put output into a buffer
673 and then present it to the user for perusal rather than for editing.
674 Many of the help commands use this feature.
676 @defspec with-output-to-temp-buffer buffer-name forms@dots{}
677 This function executes @var{forms} while arranging to insert any
678 output they print into the buffer named @var{buffer-name}. The buffer
679 is then shown in some window for viewing, displayed but not selected.
681 The string @var{buffer-name} specifies the temporary buffer, which
682 need not already exist. The argument must be a string, not a buffer.
683 The buffer is erased initially (with no questions asked), and it is
684 marked as unmodified after @code{with-output-to-temp-buffer} exits.
686 @code{with-output-to-temp-buffer} binds @code{standard-output} to the
687 temporary buffer, then it evaluates the forms in @var{forms}. Output
688 using the Lisp output functions within @var{forms} goes by default to
689 that buffer (but screen display and messages in the echo area, although
690 they are ``output'' in the general sense of the word, are not affected).
691 @xref{Output Functions}.
693 The value of the last form in @var{forms} is returned.
697 ---------- Buffer: foo ----------
698 This is the contents of foo.
699 ---------- Buffer: foo ----------
703 (with-output-to-temp-buffer "foo"
705 (print standard-output))
706 @result{} #<buffer foo>
708 ---------- Buffer: foo ----------
713 ---------- Buffer: foo ----------
718 @defvar temp-buffer-show-function
719 If this variable is non-@code{nil}, @code{with-output-to-temp-buffer}
720 calls it as a function to do the job of displaying a help buffer. The
721 function gets one argument, which is the buffer it should display.
723 In Emacs versions 18 and earlier, this variable was called
724 @code{temp-buffer-show-hook}.
727 @defun momentary-string-display string position &optional char message
728 This function momentarily displays @var{string} in the current buffer at
729 @var{position}. It has no effect on the undo list or on the buffer's
732 The momentary display remains until the next input event. If the next
733 input event is @var{char}, @code{momentary-string-display} ignores it
734 and returns. Otherwise, that event remains buffered for subsequent use
735 as input. Thus, typing @var{char} will simply remove the string from
736 the display, while typing (say) @kbd{C-f} will remove the string from
737 the display and later (presumably) move point forward. The argument
738 @var{char} is a space by default.
740 The return value of @code{momentary-string-display} is not meaningful.
742 You can do the same job in a more general way by creating an extent
743 with a begin-glyph property. @xref{Extent Properties}.
745 If @var{message} is non-@code{nil}, it is displayed in the echo area
746 while @var{string} is displayed in the buffer. If it is @code{nil}, a
747 default message says to type @var{char} to continue.
749 In this example, point is initially located at the beginning of the
754 ---------- Buffer: foo ----------
755 This is the contents of foo.
757 ---------- Buffer: foo ----------
761 (momentary-string-display
762 "**** Important Message! ****"
764 "Type RET when done reading")
769 ---------- Buffer: foo ----------
770 This is the contents of foo.
771 **** Important Message! ****Second line.
772 ---------- Buffer: foo ----------
774 ---------- Echo Area ----------
775 Type RET when done reading
776 ---------- Echo Area ----------
780 This function works by actually changing the text in the buffer. As a
781 result, if you later undo in this buffer, you will see the message come
786 @section Blinking Parentheses
787 @cindex parenthesis matching
789 @cindex balancing parentheses
790 @cindex close parenthesis
792 This section describes the mechanism by which XEmacs shows a matching
793 open parenthesis when the user inserts a close parenthesis.
795 @vindex blink-paren-hook
796 @defvar blink-paren-function
797 The value of this variable should be a function (of no arguments) to
798 be called whenever a character with close parenthesis syntax is inserted.
799 The value of @code{blink-paren-function} may be @code{nil}, in which
800 case nothing is done.
803 @strong{Please note:} This variable was named @code{blink-paren-hook} in
804 older Emacs versions, but since it is not called with the standard
805 convention for hooks, it was renamed to @code{blink-paren-function} in
810 @defvar blink-matching-paren
811 If this variable is @code{nil}, then @code{blink-matching-open} does
815 @defvar blink-matching-paren-distance
816 This variable specifies the maximum distance to scan for a matching
817 parenthesis before giving up.
820 @defvar blink-matching-paren-delay
821 This variable specifies the number of seconds for the cursor to remain
822 at the matching parenthesis. A fraction of a second often gives
823 good results, but the default is 1, which works on all systems.
826 @defun blink-matching-open
827 This function is the default value of @code{blink-paren-function}. It
828 assumes that point follows a character with close parenthesis syntax and
829 moves the cursor momentarily to the matching opening character. If that
830 character is not already on the screen, it displays the character's
831 context in the echo area. To avoid long delays, this function does not
832 search farther than @code{blink-matching-paren-distance} characters.
834 Here is an example of calling this function explicitly.
838 (defun interactive-blink-matching-open ()
839 @c Do not break this line! -- rms.
840 @c The first line of a doc string
842 "Indicate momentarily the start of sexp before point."
846 (let ((blink-matching-paren-distance
848 (blink-matching-paren t))
849 (blink-matching-open)))
855 @section Usual Display Conventions
857 The usual display conventions define how to display each character
858 code. You can override these conventions by setting up a display table
859 (@pxref{Display Tables}). Here are the usual display conventions:
863 Character codes 32 through 126 map to glyph codes 32 through 126.
864 Normally this means they display as themselves.
867 Character code 9 is a horizontal tab. It displays as whitespace
868 up to a position determined by @code{tab-width}.
871 Character code 10 is a newline.
874 All other codes in the range 0 through 31, and code 127, display in one
875 of two ways according to the value of @code{ctl-arrow}. If it is
876 non-@code{nil}, these codes map to sequences of two glyphs, where the
877 first glyph is the @sc{ASCII} code for @samp{^}. (A display table can
878 specify a glyph to use instead of @samp{^}.) Otherwise, these codes map
879 just like the codes in the range 128 to 255.
882 Character codes 128 through 255 map to sequences of four glyphs, where
883 the first glyph is the @sc{ASCII} code for @samp{\}, and the others are
884 digit characters representing the code in octal. (A display table can
885 specify a glyph to use instead of @samp{\}.)
888 The usual display conventions apply even when there is a display
889 table, for any character whose entry in the active display table is
890 @code{nil}. Thus, when you set up a display table, you need only
891 specify the characters for which you want unusual behavior.
893 These variables affect the way certain characters are displayed on the
894 screen. Since they change the number of columns the characters occupy,
895 they also affect the indentation functions.
898 @cindex control characters in display
899 This buffer-local variable controls how control characters are
900 displayed. If it is non-@code{nil}, they are displayed as a caret
901 followed by the character: @samp{^A}. If it is @code{nil}, they are
902 displayed as a backslash followed by three octal digits: @samp{\001}.
905 @c Following may have overfull hbox.
906 @defvar default-ctl-arrow
907 The value of this variable is the default value for @code{ctl-arrow} in
908 buffers that do not override it. @xref{Default Value}.
912 The value of this variable is the spacing between tab stops used for
913 displaying tab characters in Emacs buffers. The default is 8. Note
914 that this feature is completely independent from the user-settable tab
915 stops used by the command @code{tab-to-tab-stop}. @xref{Indent Tabs}.
919 @section Display Tables
921 @cindex display table
922 You can use the @dfn{display table} feature to control how all 256
923 possible character codes display on the screen. This is useful for
924 displaying European languages that have letters not in the @sc{ASCII}
927 The display table maps each character code into a sequence of
928 @dfn{runes}, each rune being an image that takes up one character
929 position on the screen. You can also define how to display each rune
930 on your terminal, using the @dfn{rune table}.
933 * Display Table Format:: What a display table consists of.
934 * Active Display Table:: How XEmacs selects a display table to use.
935 * Character Descriptors:: Format of an individual element of a
939 @ignore Not yet working in XEmacs?
940 * ISO Latin 1:: How to use display tables
941 to support the ISO Latin 1 character set.
944 @node Display Table Format
945 @subsection Display Table Format
947 A display table is an array of 256 elements. (In FSF Emacs, a display
948 table is 262 elements. The six extra elements specify the truncation
949 and continuation glyphs, etc. This method is very kludgey, and in
950 XEmacs the variables @code{truncation-glyph}, @code{continuation-glyph},
951 etc. are used. @xref{Truncation}.)
953 @defun make-display-table
954 This creates and returns a display table. The table initially has
955 @code{nil} in all elements.
958 The 256 elements correspond to character codes; the @var{n}th
959 element says how to display the character code @var{n}. The value
960 should be @code{nil}, a string, a glyph, or a vector of strings and
961 glyphs (@pxref{Character Descriptors}). If an element is @code{nil},
962 it says to display that character according to the usual display
963 conventions (@pxref{Usual Display}).
965 If you use the display table to change the display of newline
966 characters, the whole buffer will be displayed as one long ``line.''
968 For example, here is how to construct a display table that mimics the
969 effect of setting @code{ctl-arrow} to a non-@code{nil} value:
972 (setq disptab (make-display-table))
975 (or (= i ?\t) (= i ?\n)
976 (aset disptab i (concat "^" (char-to-string (+ i 64)))))
978 (aset disptab 127 "^?"))
981 @node Active Display Table
982 @subsection Active Display Table
983 @cindex active display table
985 The active display table is controlled by the variable
986 @code{current-display-table}. This is a specifier, which means
987 that you can specify separate values for it in individual buffers,
988 windows, frames, and devices, as well as a global value. It also
989 means that you cannot set this variable using @code{setq}; use
990 @code{set-specifier} instead. @xref{Specifiers}. (FSF Emacs
991 uses @code{window-display-table}, @code{buffer-display-table},
992 @code{standard-display-table}, etc. to control the display table.
993 However, specifiers are a cleaner and more powerful way of doing
994 the same thing. FSF Emacs also uses a different format for
995 the contents of a display table, using additional indirection
996 to a ``glyph table'' and such. Note that ``glyph'' has a different
999 Individual faces can also specify an overriding display table;
1000 this is set using @code{set-face-display-table}. @xref{Faces}.
1002 If no display table can be determined for a particular window,
1003 then XEmacs uses the usual display conventions. @xref{Usual Display}.
1005 @node Character Descriptors
1006 @subsection Character Descriptors
1008 @cindex character descriptor
1009 Each element of the display-table vector describes how to display
1010 a particular character and is called a @dfn{character descriptor}.
1011 A character descriptor can be:
1015 Display this particular string wherever the character is to be displayed.
1018 Display this particular glyph wherever the character is to be displayed.
1021 The vector may contain strings and/or glyphs. Display the elements of
1022 the vector one after another wherever the character is to be displayed.
1025 Display according to the standard interpretation (@pxref{Usual Display}).
1028 @ignore Not yet working in XEmacs?
1030 @subsection ISO Latin 1
1032 If you have a terminal that can handle the entire ISO Latin 1 character
1033 set, you can arrange to use that character set as follows:
1036 (require 'disp-table)
1037 ;; @r{Set char codes 160--255 to display as themselves.}
1038 ;; @r{(Codes 128--159 are the additional control characters.)}
1039 (standard-display-8bit 160 255)
1042 If you are editing buffers written in the ISO Latin 1 character set and
1043 your terminal doesn't handle anything but @sc{ASCII}, you can load the
1044 file @file{iso-ascii} to set up a display table that displays the other
1045 ISO characters as explanatory sequences of @sc{ASCII} characters. For
1046 example, the character ``o with umlaut'' displays as @samp{@{"o@}}.
1048 Some European countries have terminals that don't support ISO Latin 1
1049 but do support the special characters for that country's language. You
1050 can define a display table to work one language using such terminals.
1051 For an example, see @file{lisp/iso-swed.el}, which handles certain
1054 You can load the appropriate display table for your terminal
1055 automatically by writing a terminal-specific Lisp file for the terminal
1065 You can make XEmacs ring a bell, play a sound, or blink the screen to
1066 attract the user's attention. Be conservative about how often you do
1067 this; frequent bells can become irritating. Also be careful not to use
1068 beeping alone when signaling an error is appropriate. (@xref{Errors}.)
1070 @defun ding &optional dont-terminate sound device
1071 @cindex keyboard macro termination
1072 This function beeps, or flashes the screen (see @code{visible-bell}
1073 below). It also terminates any keyboard macro currently executing
1074 unless @var{dont-terminate} is non-@code{nil}. If @var{sound} is
1075 specified, it should be a symbol specifying which sound to make. This
1076 sound will be played if @code{visible-bell} is @code{nil}. (This only
1077 works if sound support was compiled into the executable and you are
1078 running on the console of a Sun SparcStation, SGI, HP9000s700, or Linux
1079 PC. Otherwise you just get a beep.) The optional third argument
1080 specifies what device to make the sound on, and defaults to the selected
1084 @defun beep &optional dont-terminate sound device
1085 This is a synonym for @code{ding}.
1088 @defopt visible-bell
1089 This variable determines whether XEmacs should flash the screen to
1090 represent a bell. Non-@code{nil} means yes, @code{nil} means no. On
1091 TTY devices, this is effective only if the Termcap entry for the
1092 terminal type has the visible bell flag (@samp{vb}) set.
1096 This variable holds an alist associating names with sounds. When
1097 @code{beep} or @code{ding} is called with one of the name symbols, the
1098 associated sound will be generated instead of the standard beep.
1100 Each element of @code{sound-alist} is a list describing a sound. The
1101 first element of the list is the name of the sound being defined.
1102 Subsequent elements of the list are alternating keyword/value pairs:
1106 A string of raw sound data, or the name of another sound to play. The
1107 symbol @code{t} here means use the default X beep.
1109 An integer from 0-100, defaulting to @code{bell-volume}.
1111 If using the default X beep, the pitch (Hz) to generate.
1113 If using the default X beep, the duration (milliseconds).
1116 For compatibility, elements of `sound-alist' may also be:
1120 @code{( sound-name . <sound> )}
1122 @code{( sound-name <volume> <sound> )}
1125 You should probably add things to this list by calling the function
1126 @code{load-sound-file}.
1132 You can only play audio data if running on the console screen of a Sun
1133 SparcStation, SGI, or HP9000s700.
1136 The pitch, duration, and volume options are available everywhere, but
1137 many X servers ignore the `pitch' option.
1140 The following beep-types are used by XEmacs itself:
1143 @item auto-save-error
1144 when an auto-save does not succeed
1146 when the XEmacs command loop catches an error
1148 when you type a key that is undefined
1149 @item undefined-click
1150 when you use an undefined mouse-click combination
1152 during completing-read
1154 when you type something other than 'y' or 'n'
1156 when you type something other than 'yes' or 'no'
1158 used when nothing else is appropriate.
1161 Other lisp packages may use other beep types, but these are the ones that
1162 the C kernel of XEmacs uses.
1166 This variable specifies the default volume for sounds, from 0 to 100.
1169 @deffn Command load-default-sounds
1170 This function loads and installs some sound files as beep-types.
1173 @deffn Command load-sound-file filename sound-name &optional volume
1174 This function reads in an audio file and adds it to @code{sound-alist}.
1175 The sound file must be in the Sun/NeXT U-LAW format. @var{sound-name}
1176 should be a symbol, specifying the name of the sound. If @var{volume}
1177 is specified, the sound will be played at that volume; otherwise, the
1178 value of @var{bell-volume} will be used.
1181 @defun play-sound sound &optional volume device
1182 This function plays sound @var{sound}, which should be a symbol
1183 mentioned in @code{sound-alist}. If @var{volume} is specified, it
1184 overrides the value (if any) specified in @code{sound-alist}.
1185 @var{device} specifies the device to play the sound on, and defaults
1186 to the selected device.
1189 @deffn Command play-sound-file file &optional volume device
1190 This function plays the named sound file at volume @var{volume}, which
1191 defaults to @code{bell-volume}. @var{device} specifies the device to
1192 play the sound on, and defaults to the selected device.