1 This is ../info/lispref.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION XEmacs Editor
6 * Lispref: (lispref). XEmacs Lisp Reference Manual.
11 GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
12 Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
13 Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
14 XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
15 GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
16 Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
17 Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
18 Reference Manual (for 19.15 and 20.1, 20.2, 20.3) v3.2, April, May,
19 November 1997 XEmacs Lisp Reference Manual (for 21.0) v3.3, April 1998
21 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
22 Foundation, Inc. Copyright (C) 1994, 1995 Sun Microsystems, Inc.
23 Copyright (C) 1995, 1996 Ben Wing.
25 Permission is granted to make and distribute verbatim copies of this
26 manual provided the copyright notice and this permission notice are
27 preserved on all copies.
29 Permission is granted to copy and distribute modified versions of
30 this manual under the conditions for verbatim copying, provided that the
31 entire resulting derived work is distributed under the terms of a
32 permission notice identical to this one.
34 Permission is granted to copy and distribute translations of this
35 manual into another language, under the above conditions for modified
36 versions, except that this permission notice may be stated in a
37 translation approved by the Foundation.
39 Permission is granted to copy and distribute modified versions of
40 this manual under the conditions for verbatim copying, provided also
41 that the section entitled "GNU General Public License" is included
42 exactly as in the original, and provided that the entire resulting
43 derived work is distributed under the terms of a permission notice
44 identical to this one.
46 Permission is granted to copy and distribute translations of this
47 manual into another language, under the above conditions for modified
48 versions, except that the section entitled "GNU General Public License"
49 may be included in a translation approved by the Free Software
50 Foundation instead of in the original English.
53 File: lispref.info, Node: The Echo Area, Next: Warnings, Prev: Truncation, Up: Display
58 The "echo area" is used for displaying messages made with the
59 `message' primitive, and for echoing keystrokes. It is not the same as
60 the minibuffer, despite the fact that the minibuffer appears (when
61 active) in the same place on the screen as the echo area. The `XEmacs
62 Reference Manual' specifies the rules for resolving conflicts between
63 the echo area and the minibuffer for use of that screen space (*note
64 The Minibuffer: (emacs)Minibuffer.). Error messages appear in the echo
65 area; see *Note Errors::.
67 You can write output in the echo area by using the Lisp printing
68 functions with `t' as the stream (*note Output Functions::), or as
71 - Function: message string &rest arguments
72 This function displays a one-line message in the echo area. The
73 argument STRING is similar to a C language `printf' control
74 string. See `format' in *Note String Conversion::, for the details
75 on the conversion specifications. `message' returns the
78 In batch mode, `message' prints the message text on the standard
79 error stream, followed by a newline.
81 If STRING is `nil', `message' clears the echo area. If the
82 minibuffer is active, this brings the minibuffer contents back onto
83 the screen immediately.
85 (message "Minibuffer depth is %d."
87 -| Minibuffer depth is 0.
88 => "Minibuffer depth is 0."
90 ---------- Echo Area ----------
91 Minibuffer depth is 0.
92 ---------- Echo Area ----------
94 In addition to only displaying a message, XEmacs allows you to
95 "label" your messages, giving you fine-grained control of their
96 display. Message label is a symbol denoting the message type. Some
99 * `message'--default label used by the `message' function;
101 * `error'--default label used for reporting errors;
103 * `progress'--progress indicators like `Converting... 45%' (not
106 * `prompt'--prompt-like messages like `Isearch: foo' (not logged by
109 * `command'--helper command messages like `Mark set' (not logged by
112 * `no-log'--messages that should never be logged
114 Several messages may be stacked in the echo area at once. Lisp
115 programs may access these messages, or remove them as appropriate, via
118 - Function: display-message label message &optional frame stdout-p
119 This function displays MESSAGE (a string) labeled as LABEL, as
122 The FRAME argument specifies the frame to whose minibuffer the
123 message should be printed. This is currently unimplemented. The
124 STDOUT-P argument is used internally.
126 (display-message 'command "Mark set")
128 - Function: lmessage label string &rest arguments
129 This function displays a message STRING with label LABEL. It is
130 similar to `message' in that it accepts a `printf'-like strings
131 and any number of arguments.
133 ;; Display a command message.
134 (lmessage 'command "Comment column set to %d" comment-column)
136 ;; Display a progress message.
137 (lmessage 'progress "Fontifying %s... (%d)" buffer percentage)
139 ;; Display a message that should not be logged.
140 (lmessage 'no-log "Done")
142 - Function: clear-message &optional label frame stdout-p no-restore
143 This function remove any message with the given LABEL from the
144 message-stack, erasing it from the echo area if it's currently
147 If a message remains at the head of the message-stack and
148 NO-RESTORE is `nil', it will be displayed. The string which
149 remains in the echo area will be returned, or `nil' if the
150 message-stack is now empty. If LABEL is nil, the entire
151 message-stack is cleared.
153 ;; Show a message, wait for 2 seconds, and restore old minibuffer
155 (message "A message")
158 (lmessage 'my-label "Newsflash! Newsflash!")
159 -| Newsflash! Newsflash!
160 => "Newsflash! Newsflash!"
162 (clear-message 'my-label)
166 Unless you need the return value or you need to specify a label,
167 you should just use `(message nil)'.
169 - Function: current-message &optional frame
170 This function returns the current message in the echo area, or
171 `nil'. The FRAME argument is currently unused.
173 Some of the messages displayed in the echo area are also recorded in
174 the ` *Message-Log*' buffer. Exactly which messages will be recorded
175 can be tuned using the following variables.
177 - User Option: log-message-max-size
178 This variable specifies the maximum size of the ` *Message-log*'
181 - Variable: log-message-ignore-labels
182 This variable specifies the labels whose messages will not be
183 logged. It should be a list of symbols.
185 - Variable: log-message-ignore-regexps
186 This variable specifies the regular expressions matching messages
187 that will not be logged. It should be a list of regular
190 Normally, packages that generate messages that might need to be
191 ignored should label them with `progress', `prompt', or `no-log',
192 so they can be filtered by `log-message-ignore-labels'.
194 - Variable: echo-keystrokes
195 This variable determines how much time should elapse before command
196 characters echo. Its value must be a number, which specifies the
197 number of seconds to wait before echoing. If the user types a
198 prefix key (such as `C-x') and then delays this many seconds
199 before continuing, the prefix key is echoed in the echo area. Any
200 subsequent characters in the same command will be echoed as well.
202 If the value is zero, then command input is not echoed.
204 - Variable: cursor-in-echo-area
205 This variable controls where the cursor appears when a message is
206 displayed in the echo area. If it is non-`nil', then the cursor
207 appears at the end of the message. Otherwise, the cursor appears
208 at point--not in the echo area at all.
210 The value is normally `nil'; Lisp programs bind it to `t' for
211 brief periods of time.
214 File: lispref.info, Node: Warnings, Next: Invisible Text, Prev: The Echo Area, Up: Display
219 XEmacs contains a facility for unified display of various warnings.
220 Unlike errors, warnings are displayed in the situations when XEmacs
221 encounters a problem that is recoverable, but which should be fixed for
222 safe future operation.
224 For example, warnings are printed by the startup code when it
225 encounters problems with X keysyms, when there is an error in `.emacs',
226 and in other problematic situations. Unlike messages, warnings are
227 displayed in a separate buffer, and include an explanatory message that
228 may span across several lines. Here is an example of how a warning is
231 (1) (initialization/error) An error has occurred while loading ~/.emacs:
233 Symbol's value as variable is void: bogus-variable
235 To ensure normal operation, you should investigate the cause of the error
236 in your initialization file and remove it. Use the `-debug-init' option
237 to XEmacs to view a complete error backtrace.
239 Each warning has a "class" and a "priority level". The class is a
240 symbol describing what sort of warning this is, such as
241 `initialization', `resource' or `key-mapping'.
243 The warning priority level specifies how important the warning is.
244 The recognized warning levels, in increased order of priority, are:
245 `debug', `info', `notice', `warning', `error', `critical', `alert' and
248 - Function: display-warning class message &optional level
249 This function displays a warning message MESSAGE (a string).
250 CLASS should be a warning class symbol, as described above, or a
251 list of such symbols. LEVEL describes the warning priority level.
252 If unspecified, it default to `warning'.
254 (display-warning 'resource
255 "Bad resource specification encountered:
260 You should replace the * with a . in order to get proper behavior when
261 you use the specifier and/or `set-face-*' functions.")
263 ---------- Warning buffer ----------
264 (1) (resource/warning) Bad resource specification encountered:
269 You should replace the * with a . in order to get proper behavior when
270 you use the specifier and/or `set-face-*' functions.
271 ---------- Warning buffer ----------
273 - Function: lwarn class level message &rest args
274 This function displays a formatted labeled warning message. As
275 above, CLASS should be the warning class symbol, or a list of such
276 symbols, and LEVEL should specify the warning priority level
277 (`warning' by default).
279 Unlike in `display-warning', MESSAGE may be a formatted message,
280 which will be, together with the rest of the arguments, passed to
283 (lwarn 'message-log 'warning
284 "Error caught in `remove-message-hook': %s"
285 (error-message-string e))
287 - Variable: log-warning-minimum-level
288 This variable specifies the minimum level of warnings that should
289 be generated. Warnings with level lower than defined by this
290 variable are completely ignored, as if they never happened.
292 - Variable: display-warning-minimum-level
293 This variable specifies the minimum level of warnings that should
294 be displayed. Unlike `log-warning-minimum-level', setting this
295 function does not suppress warnings entirely--they are still
296 generated in the `*Warnings*' buffer, only they are not displayed
299 - Variable: log-warning-suppressed-classes
300 This variable specifies a list of classes that should not be
301 logged or displayed. If any of the class symbols associated with
302 a warning is the same as any of the symbols listed here, the
303 warning will be completely ignored, as it they never happened.
305 - Variable: display-warning-suppressed-classes
306 This variable specifies a list of classes that should not be
307 logged or displayed. If any of the class symbols associated with
308 a warning is the same as any of the symbols listed here, the
309 warning will not be displayed. The warning will still logged in
310 the *Warnings* buffer (unless also contained in
311 `log-warning-suppressed-classes'), but the buffer will not be
312 automatically popped up.
315 File: lispref.info, Node: Invisible Text, Next: Selective Display, Prev: Warnings, Up: Display
320 You can make characters "invisible", so that they do not appear on
321 the screen, with the `invisible' property. This can be either a text
322 property or a property of an overlay.
324 In the simplest case, any non-`nil' `invisible' property makes a
325 character invisible. This is the default case--if you don't alter the
326 default value of `buffer-invisibility-spec', this is how the
327 `invisibility' property works. This feature is much like selective
328 display (*note Selective Display::), but more general and cleaner.
330 More generally, you can use the variable `buffer-invisibility-spec'
331 to control which values of the `invisible' property make text
332 invisible. This permits you to classify the text into different subsets
333 in advance, by giving them different `invisible' values, and
334 subsequently make various subsets visible or invisible by changing the
335 value of `buffer-invisibility-spec'.
337 Controlling visibility with `buffer-invisibility-spec' is especially
338 useful in a program to display the list of entries in a data base. It
339 permits the implementation of convenient filtering commands to view
340 just a part of the entries in the data base. Setting this variable is
341 very fast, much faster than scanning all the text in the buffer looking
342 for properties to change.
344 - Variable: buffer-invisibility-spec
345 This variable specifies which kinds of `invisible' properties
346 actually make a character invisible.
349 A character is invisible if its `invisible' property is
350 non-`nil'. This is the default.
353 Each element of the list makes certain characters invisible.
354 Ultimately, a character is invisible if any of the elements
355 of this list applies to it. The list can have two kinds of
359 A character is invisible if its `invisible' property
360 value is ATOM or if it is a list with ATOM as a member.
363 A character is invisible if its `invisible' property
364 value is ATOM or if it is a list with ATOM as a member.
365 Moreover, if this character is at the end of a line and
366 is followed by a visible newline, it displays an
369 Ordinarily, commands that operate on text or move point do not care
370 whether the text is invisible. However, the user-level line motion
371 commands explicitly ignore invisible newlines.
374 File: lispref.info, Node: Selective Display, Next: Overlay Arrow, Prev: Invisible Text, Up: Display
379 "Selective display" is a pair of features that hide certain lines on
382 The first variant, explicit selective display, is designed for use in
383 a Lisp program. The program controls which lines are hidden by altering
384 the text. Outline mode has traditionally used this variant. It has
385 been partially replaced by the invisible text feature (*note Invisible
386 Text::); there is a new version of Outline mode which uses that instead.
388 In the second variant, the choice of lines to hide is made
389 automatically based on indentation. This variant is designed to be a
392 The way you control explicit selective display is by replacing a
393 newline (control-j) with a carriage return (control-m). The text that
394 was formerly a line following that newline is now invisible. Strictly
395 speaking, it is temporarily no longer a line at all, since only newlines
396 can separate lines; it is now part of the previous line.
398 Selective display does not directly affect editing commands. For
399 example, `C-f' (`forward-char') moves point unhesitatingly into
400 invisible text. However, the replacement of newline characters with
401 carriage return characters affects some editing commands. For example,
402 `next-line' skips invisible lines, since it searches only for newlines.
403 Modes that use selective display can also define commands that take
404 account of the newlines, or that make parts of the text visible or
407 When you write a selectively displayed buffer into a file, all the
408 control-m's are output as newlines. This means that when you next read
409 in the file, it looks OK, with nothing invisible. The selective display
410 effect is seen only within XEmacs.
412 - Variable: selective-display
413 This buffer-local variable enables selective display. This means
414 that lines, or portions of lines, may be made invisible.
416 * If the value of `selective-display' is `t', then any portion
417 of a line that follows a control-m is not displayed.
419 * If the value of `selective-display' is a positive integer,
420 then lines that start with more than that many columns of
421 indentation are not displayed.
423 When some portion of a buffer is invisible, the vertical movement
424 commands operate as if that portion did not exist, allowing a
425 single `next-line' command to skip any number of invisible lines.
426 However, character movement commands (such as `forward-char') do
427 not skip the invisible portion, and it is possible (if tricky) to
428 insert or delete text in an invisible portion.
430 In the examples below, we show the _display appearance_ of the
431 buffer `foo', which changes with the value of `selective-display'.
432 The _contents_ of the buffer do not change.
434 (setq selective-display nil)
437 ---------- Buffer: foo ----------
444 ---------- Buffer: foo ----------
446 (setq selective-display 2)
449 ---------- Buffer: foo ----------
454 ---------- Buffer: foo ----------
456 - Variable: selective-display-ellipses
457 If this buffer-local variable is non-`nil', then XEmacs displays
458 `...' at the end of a line that is followed by invisible text.
459 This example is a continuation of the previous one.
461 (setq selective-display-ellipses t)
464 ---------- Buffer: foo ----------
469 ---------- Buffer: foo ----------
471 You can use a display table to substitute other text for the
472 ellipsis (`...'). *Note Display Tables::.
475 File: lispref.info, Node: Overlay Arrow, Next: Temporary Displays, Prev: Selective Display, Up: Display
480 The "overlay arrow" is useful for directing the user's attention to
481 a particular line in a buffer. For example, in the modes used for
482 interface to debuggers, the overlay arrow indicates the line of code
483 about to be executed.
485 - Variable: overlay-arrow-string
486 This variable holds the string to display to call attention to a
487 particular line, or `nil' if the arrow feature is not in use.
488 Despite its name, the value of this variable can be either a string
489 or a glyph (*note Glyphs::).
491 - Variable: overlay-arrow-position
492 This variable holds a marker that indicates where to display the
493 overlay arrow. It should point at the beginning of a line. The
494 arrow text appears at the beginning of that line, overlaying any
495 text that would otherwise appear. Since the arrow is usually
496 short, and the line usually begins with indentation, normally
497 nothing significant is overwritten.
499 The overlay string is displayed only in the buffer that this marker
500 points into. Thus, only one buffer can have an overlay arrow at
503 You can do the same job by creating an extent with a `begin-glyph'
504 property. *Note Extent Properties::.
507 File: lispref.info, Node: Temporary Displays, Next: Blinking, Prev: Overlay Arrow, Up: Display
512 Temporary displays are used by commands to put output into a buffer
513 and then present it to the user for perusal rather than for editing.
514 Many of the help commands use this feature.
516 - Special Form: with-output-to-temp-buffer buffer-name forms...
517 This function executes FORMS while arranging to insert any output
518 they print into the buffer named BUFFER-NAME. The buffer is then
519 shown in some window for viewing, displayed but not selected.
521 The string BUFFER-NAME specifies the temporary buffer, which need
522 not already exist. The argument must be a string, not a buffer.
523 The buffer is erased initially (with no questions asked), and it is
524 marked as unmodified after `with-output-to-temp-buffer' exits.
526 `with-output-to-temp-buffer' binds `standard-output' to the
527 temporary buffer, then it evaluates the forms in FORMS. Output
528 using the Lisp output functions within FORMS goes by default to
529 that buffer (but screen display and messages in the echo area,
530 although they are "output" in the general sense of the word, are
531 not affected). *Note Output Functions::.
533 The value of the last form in FORMS is returned.
535 ---------- Buffer: foo ----------
536 This is the contents of foo.
537 ---------- Buffer: foo ----------
539 (with-output-to-temp-buffer "foo"
541 (print standard-output))
544 ---------- Buffer: foo ----------
549 ---------- Buffer: foo ----------
551 - Variable: temp-buffer-show-function
552 If this variable is non-`nil', `with-output-to-temp-buffer' calls
553 it as a function to do the job of displaying a help buffer. The
554 function gets one argument, which is the buffer it should display.
556 In Emacs versions 18 and earlier, this variable was called
557 `temp-buffer-show-hook'.
559 - Function: momentary-string-display string position &optional char
561 This function momentarily displays STRING in the current buffer at
562 POSITION. It has no effect on the undo list or on the buffer's
565 The momentary display remains until the next input event. If the
566 next input event is CHAR, `momentary-string-display' ignores it
567 and returns. Otherwise, that event remains buffered for
568 subsequent use as input. Thus, typing CHAR will simply remove the
569 string from the display, while typing (say) `C-f' will remove the
570 string from the display and later (presumably) move point forward.
571 The argument CHAR is a space by default.
573 The return value of `momentary-string-display' is not meaningful.
575 You can do the same job in a more general way by creating an extent
576 with a begin-glyph property. *Note Extent Properties::.
578 If MESSAGE is non-`nil', it is displayed in the echo area while
579 STRING is displayed in the buffer. If it is `nil', a default
580 message says to type CHAR to continue.
582 In this example, point is initially located at the beginning of the
585 ---------- Buffer: foo ----------
586 This is the contents of foo.
588 ---------- Buffer: foo ----------
590 (momentary-string-display
591 "**** Important Message! ****"
593 "Type RET when done reading")
596 ---------- Buffer: foo ----------
597 This is the contents of foo.
598 **** Important Message! ****Second line.
599 ---------- Buffer: foo ----------
601 ---------- Echo Area ----------
602 Type RET when done reading
603 ---------- Echo Area ----------
605 This function works by actually changing the text in the buffer.
606 As a result, if you later undo in this buffer, you will see the
610 File: lispref.info, Node: Blinking, Next: Usual Display, Prev: Temporary Displays, Up: Display
615 This section describes the mechanism by which XEmacs shows a matching
616 open parenthesis when the user inserts a close parenthesis.
618 - Variable: blink-paren-function
619 The value of this variable should be a function (of no arguments)
620 to be called whenever a character with close parenthesis syntax is
621 inserted. The value of `blink-paren-function' may be `nil', in
622 which case nothing is done.
624 *Please note:* This variable was named `blink-paren-hook' in
625 older Emacs versions, but since it is not called with the
626 standard convention for hooks, it was renamed to
627 `blink-paren-function' in version 19.
629 - Variable: blink-matching-paren
630 If this variable is `nil', then `blink-matching-open' does nothing.
632 - Variable: blink-matching-paren-distance
633 This variable specifies the maximum distance to scan for a matching
634 parenthesis before giving up.
636 - Variable: blink-matching-paren-delay
637 This variable specifies the number of seconds for the cursor to
638 remain at the matching parenthesis. A fraction of a second often
639 gives good results, but the default is 1, which works on all
642 - Function: blink-matching-open
643 This function is the default value of `blink-paren-function'. It
644 assumes that point follows a character with close parenthesis
645 syntax and moves the cursor momentarily to the matching opening
646 character. If that character is not already on the screen, it
647 displays the character's context in the echo area. To avoid long
648 delays, this function does not search farther than
649 `blink-matching-paren-distance' characters.
651 Here is an example of calling this function explicitly.
653 (defun interactive-blink-matching-open ()
654 "Indicate momentarily the start of sexp before point."
656 (let ((blink-matching-paren-distance
658 (blink-matching-paren t))
659 (blink-matching-open)))
662 File: lispref.info, Node: Usual Display, Next: Display Tables, Prev: Blinking, Up: Display
664 Usual Display Conventions
665 =========================
667 The usual display conventions define how to display each character
668 code. You can override these conventions by setting up a display table
669 (*note Display Tables::). Here are the usual display conventions:
671 * Character codes 32 through 126 map to glyph codes 32 through 126.
672 Normally this means they display as themselves.
674 * Character code 9 is a horizontal tab. It displays as whitespace
675 up to a position determined by `tab-width'.
677 * Character code 10 is a newline.
679 * All other codes in the range 0 through 31, and code 127, display
680 in one of two ways according to the value of `ctl-arrow'. If it is
681 non-`nil', these codes map to sequences of two glyphs, where the
682 first glyph is the ASCII code for `^'. (A display table can
683 specify a glyph to use instead of `^'.) Otherwise, these codes map
684 just like the codes in the range 128 to 255.
686 * Character codes 128 through 255 map to sequences of four glyphs,
687 where the first glyph is the ASCII code for `\', and the others are
688 digit characters representing the code in octal. (A display table
689 can specify a glyph to use instead of `\'.)
691 The usual display conventions apply even when there is a display
692 table, for any character whose entry in the active display table is
693 `nil'. Thus, when you set up a display table, you need only specify
694 the characters for which you want unusual behavior.
696 These variables affect the way certain characters are displayed on
697 the screen. Since they change the number of columns the characters
698 occupy, they also affect the indentation functions.
700 - User Option: ctl-arrow
701 This buffer-local variable controls how control characters are
702 displayed. If it is non-`nil', they are displayed as a caret
703 followed by the character: `^A'. If it is `nil', they are
704 displayed as a backslash followed by three octal digits: `\001'.
706 - Variable: default-ctl-arrow
707 The value of this variable is the default value for `ctl-arrow' in
708 buffers that do not override it. *Note Default Value::.
710 - User Option: tab-width
711 The value of this variable is the spacing between tab stops used
712 for displaying tab characters in Emacs buffers. The default is 8.
713 Note that this feature is completely independent from the
714 user-settable tab stops used by the command `tab-to-tab-stop'.
718 File: lispref.info, Node: Display Tables, Next: Beeping, Prev: Usual Display, Up: Display
723 You can use the "display table" feature to control how all 256
724 possible character codes display on the screen. This is useful for
725 displaying European languages that have letters not in the ASCII
728 The display table maps each character code into a sequence of
729 "runes", each rune being an image that takes up one character position
730 on the screen. You can also define how to display each rune on your
731 terminal, using the "rune table".
735 * Display Table Format:: What a display table consists of.
736 * Active Display Table:: How XEmacs selects a display table to use.
737 * Character Descriptors:: Format of an individual element of a
741 File: lispref.info, Node: Display Table Format, Next: Active Display Table, Up: Display Tables
746 A display table is an array of 256 elements. (In FSF Emacs, a display
747 table is 262 elements. The six extra elements specify the truncation
748 and continuation glyphs, etc. This method is very kludgey, and in
749 XEmacs the variables `truncation-glyph', `continuation-glyph', etc. are
750 used. *Note Truncation::.)
752 - Function: make-display-table
753 This creates and returns a display table. The table initially has
754 `nil' in all elements.
756 The 256 elements correspond to character codes; the Nth element says
757 how to display the character code N. The value should be `nil', a
758 string, a glyph, or a vector of strings and glyphs (*note Character
759 Descriptors::). If an element is `nil', it says to display that
760 character according to the usual display conventions (*note Usual
763 If you use the display table to change the display of newline
764 characters, the whole buffer will be displayed as one long "line."
766 For example, here is how to construct a display table that mimics the
767 effect of setting `ctl-arrow' to a non-`nil' value:
769 (setq disptab (make-display-table))
772 (or (= i ?\t) (= i ?\n)
773 (aset disptab i (concat "^" (char-to-string (+ i 64)))))
775 (aset disptab 127 "^?"))
778 File: lispref.info, Node: Active Display Table, Next: Character Descriptors, Prev: Display Table Format, Up: Display Tables
783 The active display table is controlled by the variable
784 `current-display-table'. This is a specifier, which means that you can
785 specify separate values for it in individual buffers, windows, frames,
786 and devices, as well as a global value. It also means that you cannot
787 set this variable using `setq'; use `set-specifier' instead. *Note
788 Specifiers::. (FSF Emacs uses `window-display-table',
789 `buffer-display-table', `standard-display-table', etc. to control the
790 display table. However, specifiers are a cleaner and more powerful way
791 of doing the same thing. FSF Emacs also uses a different format for
792 the contents of a display table, using additional indirection to a
793 "glyph table" and such. Note that "glyph" has a different meaning in
796 Individual faces can also specify an overriding display table; this
797 is set using `set-face-display-table'. *Note Faces::.
799 If no display table can be determined for a particular window, then
800 XEmacs uses the usual display conventions. *Note Usual Display::.
803 File: lispref.info, Node: Character Descriptors, Prev: Active Display Table, Up: Display Tables
805 Character Descriptors
806 ---------------------
808 Each element of the display-table vector describes how to display a
809 particular character and is called a "character descriptor". A
810 character descriptor can be:
813 Display this particular string wherever the character is to be
817 Display this particular glyph wherever the character is to be
821 The vector may contain strings and/or glyphs. Display the
822 elements of the vector one after another wherever the character is
826 Display according to the standard interpretation (*note Usual
830 File: lispref.info, Node: Beeping, Prev: Display Tables, Up: Display
835 You can make XEmacs ring a bell, play a sound, or blink the screen to
836 attract the user's attention. Be conservative about how often you do
837 this; frequent bells can become irritating. Also be careful not to use
838 beeping alone when signaling an error is appropriate. (*Note Errors::.)
840 - Function: ding &optional dont-terminate sound device
841 This function beeps, or flashes the screen (see `visible-bell'
842 below). It also terminates any keyboard macro currently executing
843 unless DONT-TERMINATE is non-`nil'. If SOUND is specified, it
844 should be a symbol specifying which sound to make. This sound
845 will be played if `visible-bell' is `nil'. (This only works if
846 sound support was compiled into the executable and you are running
847 on the console of a Sun SparcStation, SGI, HP9000s700, or Linux
848 PC. Otherwise you just get a beep.) The optional third argument
849 specifies what device to make the sound on, and defaults to the
852 - Function: beep &optional dont-terminate sound device
853 This is a synonym for `ding'.
855 - User Option: visible-bell
856 This variable determines whether XEmacs should flash the screen to
857 represent a bell. Non-`nil' means yes, `nil' means no. On TTY
858 devices, this is effective only if the Termcap entry for the
859 terminal type has the visible bell flag (`vb') set.
861 - Variable: sound-alist
862 This variable holds an alist associating names with sounds. When
863 `beep' or `ding' is called with one of the name symbols, the
864 associated sound will be generated instead of the standard beep.
866 Each element of `sound-alist' is a list describing a sound. The
867 first element of the list is the name of the sound being defined.
868 Subsequent elements of the list are alternating keyword/value
872 A string of raw sound data, or the name of another sound to
873 play. The symbol `t' here means use the default X beep.
876 An integer from 0-100, defaulting to `bell-volume'.
879 If using the default X beep, the pitch (Hz) to generate.
882 If using the default X beep, the duration (milliseconds).
884 For compatibility, elements of `sound-alist' may also be:
886 * `( sound-name . <sound> )'
888 * `( sound-name <volume> <sound> )'
890 You should probably add things to this list by calling the function
895 - You can only play audio data if running on the console screen
896 of a Sun SparcStation, SGI, or HP9000s700.
898 - The pitch, duration, and volume options are available
899 everywhere, but many X servers ignore the `pitch' option.
901 The following beep-types are used by XEmacs itself:
904 when an auto-save does not succeed
907 when the XEmacs command loop catches an error
910 when you type a key that is undefined
913 when you use an undefined mouse-click combination
916 during completing-read
919 when you type something other than 'y' or 'n'
922 when you type something other than 'yes' or 'no'
925 used when nothing else is appropriate.
927 Other lisp packages may use other beep types, but these are the
928 ones that the C kernel of XEmacs uses.
930 - User Option: bell-volume
931 This variable specifies the default volume for sounds, from 0 to
934 - Command: load-default-sounds
935 This function loads and installs some sound files as beep-types.
937 - Command: load-sound-file filename sound-name &optional volume
938 This function reads in an audio file and adds it to `sound-alist'.
939 The sound file must be in the Sun/NeXT U-LAW format. SOUND-NAME
940 should be a symbol, specifying the name of the sound. If VOLUME
941 is specified, the sound will be played at that volume; otherwise,
942 the value of BELL-VOLUME will be used.
944 - Function: play-sound sound &optional volume device
945 This function plays sound SOUND, which should be a symbol
946 mentioned in `sound-alist'. If VOLUME is specified, it overrides
947 the value (if any) specified in `sound-alist'. DEVICE specifies
948 the device to play the sound on, and defaults to the selected
951 - Command: play-sound-file file &optional volume device
952 This function plays the named sound file at volume VOLUME, which
953 defaults to `bell-volume'. DEVICE specifies the device to play
954 the sound on, and defaults to the selected device.
957 File: lispref.info, Node: Hash Tables, Next: Range Tables, Prev: Display, Up: Top
962 - Function: hash-table-p object
963 This function returns `t' if OBJECT is a hash table, else `nil'.
967 * Introduction to Hash Tables:: Hash tables are fast data structures for
968 implementing simple tables (i.e. finite
969 mappings from keys to values).
970 * Working With Hash Tables:: Hash table functions.
971 * Weak Hash Tables:: Hash tables with special garbage-collection
975 File: lispref.info, Node: Introduction to Hash Tables, Next: Working With Hash Tables, Up: Hash Tables
977 Introduction to Hash Tables
978 ===========================
980 A "hash table" is a data structure that provides mappings from
981 arbitrary Lisp objects called "keys" to other arbitrary Lisp objects
982 called "values". A key/value pair is sometimes called an "entry" in
983 the hash table. There are many ways other than hash tables of
984 implementing the same sort of mapping, e.g. association lists (*note
985 Association Lists::) and property lists (*note Property Lists::), but
986 hash tables provide much faster lookup when there are many entries in
987 the mapping. Hash tables are an implementation of the abstract data
988 type "dictionary", also known as "associative array".
990 Internally, hash tables are hashed using the "linear probing" hash
991 table implementation method. This method hashes each key to a
992 particular spot in the hash table, and then scans forward sequentially
993 until a blank entry is found. To look up a key, hash to the appropriate
994 spot, then search forward for the key until either a key is found or a
995 blank entry stops the search. This method is used in preference to
996 double hashing because of changes in recent hardware. The penalty for
997 non-sequential access to memory has been increasing, and this
998 compensates for the problem of clustering that linear probing entails.
1000 When hash tables are created, the user may (but is not required to)
1001 specify initial properties that influence performance.
1003 Use the `:size' parameter to specify the number of entries that are
1004 likely to be stored in the hash table, to avoid the overhead of resizing
1005 the table. But if the pre-allocated space for the entries is never
1006 used, it is simply wasted and makes XEmacs slower. Excess unused hash
1007 table entries exact a small continuous performance penalty, since they
1008 must be scanned at every garbage collection. If the number of entries
1009 in the hash table is unknown, simply avoid using the `:size' keyword.
1011 Use the `:rehash-size' and `:rehash-threshold' keywords to adjust
1012 the algorithm for deciding when to rehash the hash table. For
1013 temporary hash tables that are going to be very heavily used, use a
1014 small rehash threshold, for example, 0.4 and a large rehash size, for
1015 example 2.0. For permanent hash tables that will be infrequently used,
1016 specify a large rehash threshold, for example 0.8.
1018 Hash tables can also be created by the lisp reader using structure
1019 syntax, for example:
1020 #s(hash-table size 20 data (foo 1 bar 2))
1022 The structure syntax accepts the same keywords as `make-hash-table'
1023 (without the `:' character), as well as the additional keyword `data',
1024 which specifies the initial hash table contents.
1026 - Function: make-hash-table &key `test' `size' `rehash-size'
1027 `rehash-threshold' `weakness'
1028 This function returns a new empty hash table object.
1030 Keyword `:test' can be `eq', `eql' (default) or `equal'.
1031 Comparison between keys is done using this function. If speed is
1032 important, consider using `eq'. When storing strings in the hash
1033 table, you will likely need to use `equal'.
1035 Keyword `:size' specifies the number of keys likely to be inserted.
1036 This number of entries can be inserted without enlarging the hash
1039 Keyword `:rehash-size' must be a float greater than 1.0, and
1040 specifies the factor by which to increase the size of the hash
1041 table when enlarging.
1043 Keyword `:rehash-threshold' must be a float between 0.0 and 1.0,
1044 and specifies the load factor of the hash table which triggers
1047 Keyword `:weakness' can be `nil' (default), `t', `key' or `value'.
1049 A weak hash table is one whose pointers do not count as GC
1050 referents: for any key-value pair in the hash table, if the only
1051 remaining pointer to either the key or the value is in a weak hash
1052 table, then the pair will be removed from the hash table, and the
1053 key and value collected. A non-weak hash table (or any other
1054 pointer) would prevent the object from being collected.
1056 A key-weak hash table is similar to a fully-weak hash table except
1057 that a key-value pair will be removed only if the key remains
1058 unmarked outside of weak hash tables. The pair will remain in the
1059 hash table if the key is pointed to by something other than a weak
1060 hash table, even if the value is not.
1062 A value-weak hash table is similar to a fully-weak hash table
1063 except that a key-value pair will be removed only if the value
1064 remains unmarked outside of weak hash tables. The pair will
1065 remain in the hash table if the value is pointed to by something
1066 other than a weak hash table, even if the key is not.
1068 - Function: copy-hash-table hash-table
1069 This function returns a new hash table which contains the same
1070 keys and values as HASH-TABLE. The keys and values will not
1071 themselves be copied.
1073 - Function: hash-table-count hash-table
1074 This function returns the number of entries in HASH-TABLE.
1076 - Function: hash-table-test hash-table
1077 This function returns the test function of HASH-TABLE. This can
1078 be one of `eq', `eql' or `equal'.
1080 - Function: hash-table-size hash-table
1081 This function returns the current number of slots in HASH-TABLE,
1082 whether occupied or not.
1084 - Function: hash-table-rehash-size hash-table
1085 This function returns the current rehash size of HASH-TABLE. This
1086 is a float greater than 1.0; the factor by which HASH-TABLE is
1087 enlarged when the rehash threshold is exceeded.
1089 - Function: hash-table-rehash-threshold hash-table
1090 This function returns the current rehash threshold of HASH-TABLE.
1091 This is a float between 0.0 and 1.0; the maximum "load factor" of
1092 HASH-TABLE, beyond which the HASH-TABLE is enlarged by rehashing.
1094 - Function: hash-table-weakness hash-table
1095 This function returns the weakness of HASH-TABLE. This can be one
1096 of `nil', `t', `key' or `value'.
1099 File: lispref.info, Node: Working With Hash Tables, Next: Weak Hash Tables, Prev: Introduction to Hash Tables, Up: Hash Tables
1101 Working With Hash Tables
1102 ========================
1104 - Function: puthash key value hash-table
1105 This function hashes KEY to VALUE in HASH-TABLE.
1107 - Function: gethash key hash-table &optional default
1108 This function finds the hash value for KEY in HASH-TABLE. If
1109 there is no entry for KEY in HASH-TABLE, DEFAULT is returned
1110 (which in turn defaults to `nil').
1112 - Function: remhash key hash-table
1113 This function removes the entry for KEY from HASH-TABLE. Does
1114 nothing if there is no entry for KEY in HASH-TABLE.
1116 - Function: clrhash hash-table
1117 This function removes all entries from HASH-TABLE, leaving it
1120 - Function: maphash function hash-table
1121 This function maps FUNCTION over entries in HASH-TABLE, calling it
1122 with two args, each key and value in the hash table.
1124 FUNCTION may not modify HASH-TABLE, with the one exception that
1125 FUNCTION may remhash or puthash the entry currently being
1126 processed by FUNCTION.
1129 File: lispref.info, Node: Weak Hash Tables, Prev: Working With Hash Tables, Up: Hash Tables
1134 A "weak hash table" is a special variety of hash table whose
1135 elements do not count as GC referents. For any key-value pair in such a
1136 hash table, if either the key or value (or in some cases, if one
1137 particular one of the two) has no references to it outside of weak hash
1138 tables (and similar structures such as weak lists), the pair will be
1139 removed from the table, and the key and value collected. A non-weak
1140 hash table (or any other pointer) would prevent the objects from being
1143 Weak hash tables are useful for keeping track of information in a
1144 non-obtrusive way, for example to implement caching. If the cache
1145 contains objects such as buffers, markers, image instances, etc. that
1146 will eventually disappear and get garbage-collected, using a weak hash
1147 table ensures that these objects are collected normally rather than
1148 remaining around forever, long past their actual period of use.
1149 (Otherwise, you'd have to explicitly map over the hash table every so
1150 often and remove unnecessary elements.)
1152 There are three types of weak hash tables:
1154 fully weak hash tables
1155 In these hash tables, a pair disappears if either the key or the
1156 value is unreferenced outside of the table.
1158 key-weak hash tables
1159 In these hash tables, a pair disappears if the key is unreferenced
1160 outside of the table, regardless of how the value is referenced.
1162 value-weak hash tables
1163 In these hash tables, a pair disappears if the value is
1164 unreferenced outside of the table, regardless of how the key is
1167 Also see *Note Weak Lists::.
1169 Weak hash tables are created by specifying the `:weakness' keyword to
1173 File: lispref.info, Node: Range Tables, Next: Databases, Prev: Hash Tables, Up: Top
1178 A range table is a table that efficiently associated values with
1181 Note that range tables have a read syntax, like this:
1183 #s(range-table data ((-3 2) foo (5 20) bar))
1185 This maps integers in the range (-3, 2) to `foo' and integers in the
1186 range (5, 20) to `bar'.
1188 - Function: range-table-p object
1189 Return non-`nil' if OBJECT is a range table.
1193 * Introduction to Range Tables:: Range tables efficiently map ranges of
1195 * Working With Range Tables:: Range table functions.
1198 File: lispref.info, Node: Introduction to Range Tables, Next: Working With Range Tables, Up: Range Tables
1200 Introduction to Range Tables
1201 ============================
1203 - Function: make-range-table
1204 Make a new, empty range table.
1206 - Function: copy-range-table old-table
1207 Make a new range table which contains the same values for the same
1208 ranges as the given table. The values will not themselves be
1212 File: lispref.info, Node: Working With Range Tables, Prev: Introduction to Range Tables, Up: Range Tables
1214 Working With Range Tables
1215 =========================
1217 - Function: get-range-table pos table &optional default
1218 This function finds value for position POS in TABLE. If there is
1219 no corresponding value, return DEFAULT (defaults to `nil').
1221 - Function: put-range-table start end val table
1222 This function sets the value for range (START, END) to be VAL in
1225 - Function: remove-range-table start end table
1226 This function removes the value for range (START, END) in TABLE.
1228 - Function: clear-range-table table
1229 This function flushes TABLE.
1231 - Function: map-range-table function table
1232 This function maps FUNCTION over entries in TABLE, calling it with
1233 three args, the beginning and end of the range and the
1234 corresponding value.
1237 File: lispref.info, Node: Databases, Next: Processes, Prev: Range Tables, Up: Top
1242 - Function: databasep object
1243 This function returns non-`nil' if OBJECT is a database.
1247 * Connecting to a Database::
1248 * Working With a Database::
1249 * Other Database Functions::
1252 File: lispref.info, Node: Connecting to a Database, Next: Working With a Database, Up: Databases
1254 Connecting to a Database
1255 ========================
1257 - Function: open-database file &optional type subtype access mode
1258 This function opens database FILE, using database method TYPE and
1259 SUBTYPE, with access rights ACCESS and permissions MODE. ACCESS
1260 can be any combination of `r' `w' and `+', for read, write, and
1263 TYPE can have the value `'dbm' or `'berkeley_db' to select the
1264 type of database file to use. (Note: XEmacs may not support both
1267 For a TYPE of `'dbm', there are no subtypes, so SUBTYPE should by
1270 For a TYPE of `'berkeley_db', the following subtypes are
1271 available: `'hash', `'btree', and `'recno'. See the manpages for
1272 the Berkeley DB functions to more information about these types.
1274 - Function: close-database obj
1275 This function closes database OBJ.
1277 - Function: database-live-p obj
1278 This function returns `t' iff OBJ is an active database, else