1 This is Info file ../../info/lispref.info, produced by Makeinfo version
2 1.68 from the input file lispref.texi.
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
389 In the second variant, the choice of lines to hide is made
390 automatically based on indentation. This variant is designed to be a
393 The way you control explicit selective display is by replacing a
394 newline (control-j) with a carriage return (control-m). The text that
395 was formerly a line following that newline is now invisible. Strictly
396 speaking, it is temporarily no longer a line at all, since only newlines
397 can separate lines; it is now part of the previous line.
399 Selective display does not directly affect editing commands. For
400 example, `C-f' (`forward-char') moves point unhesitatingly into
401 invisible text. However, the replacement of newline characters with
402 carriage return characters affects some editing commands. For example,
403 `next-line' skips invisible lines, since it searches only for newlines.
404 Modes that use selective display can also define commands that take
405 account of the newlines, or that make parts of the text visible or
408 When you write a selectively displayed buffer into a file, all the
409 control-m's are output as newlines. This means that when you next read
410 in the file, it looks OK, with nothing invisible. The selective display
411 effect is seen only within XEmacs.
413 - Variable: selective-display
414 This buffer-local variable enables selective display. This means
415 that lines, or portions of lines, may be made invisible.
417 * If the value of `selective-display' is `t', then any portion
418 of a line that follows a control-m is not displayed.
420 * If the value of `selective-display' is a positive integer,
421 then lines that start with more than that many columns of
422 indentation are not displayed.
424 When some portion of a buffer is invisible, the vertical movement
425 commands operate as if that portion did not exist, allowing a
426 single `next-line' command to skip any number of invisible lines.
427 However, character movement commands (such as `forward-char') do
428 not skip the invisible portion, and it is possible (if tricky) to
429 insert or delete text in an invisible portion.
431 In the examples below, we show the *display appearance* of the
432 buffer `foo', which changes with the value of `selective-display'.
433 The *contents* of the buffer do not change.
435 (setq selective-display nil)
438 ---------- Buffer: foo ----------
445 ---------- Buffer: foo ----------
447 (setq selective-display 2)
450 ---------- Buffer: foo ----------
455 ---------- Buffer: foo ----------
457 - Variable: selective-display-ellipses
458 If this buffer-local variable is non-`nil', then XEmacs displays
459 `...' at the end of a line that is followed by invisible text.
460 This example is a continuation of the previous one.
462 (setq selective-display-ellipses t)
465 ---------- Buffer: foo ----------
470 ---------- Buffer: foo ----------
472 You can use a display table to substitute other text for the
473 ellipsis (`...'). *Note Display Tables::.
476 File: lispref.info, Node: Overlay Arrow, Next: Temporary Displays, Prev: Selective Display, Up: Display
481 The "overlay arrow" is useful for directing the user's attention to
482 a particular line in a buffer. For example, in the modes used for
483 interface to debuggers, the overlay arrow indicates the line of code
484 about to be executed.
486 - Variable: overlay-arrow-string
487 This variable holds the string to display to call attention to a
488 particular line, or `nil' if the arrow feature is not in use.
489 Despite its name, the value of this variable can be either a string
490 or a glyph (*note Glyphs::.).
492 - Variable: overlay-arrow-position
493 This variable holds a marker that indicates where to display the
494 overlay arrow. It should point at the beginning of a line. The
495 arrow text appears at the beginning of that line, overlaying any
496 text that would otherwise appear. Since the arrow is usually
497 short, and the line usually begins with indentation, normally
498 nothing significant is overwritten.
500 The overlay string is displayed only in the buffer that this marker
501 points into. Thus, only one buffer can have an overlay arrow at
504 You can do the same job by creating an extent with a `begin-glyph'
505 property. *Note Extent Properties::.
508 File: lispref.info, Node: Temporary Displays, Next: Blinking, Prev: Overlay Arrow, Up: Display
513 Temporary displays are used by commands to put output into a buffer
514 and then present it to the user for perusal rather than for editing.
515 Many of the help commands use this feature.
517 - Special Form: with-output-to-temp-buffer BUFFER-NAME FORMS...
518 This function executes FORMS while arranging to insert any output
519 they print into the buffer named BUFFER-NAME. The buffer is then
520 shown in some window for viewing, displayed but not selected.
522 The string BUFFER-NAME specifies the temporary buffer, which need
523 not already exist. The argument must be a string, not a buffer.
524 The buffer is erased initially (with no questions asked), and it is
525 marked as unmodified after `with-output-to-temp-buffer' exits.
527 `with-output-to-temp-buffer' binds `standard-output' to the
528 temporary buffer, then it evaluates the forms in FORMS. Output
529 using the Lisp output functions within FORMS goes by default to
530 that buffer (but screen display and messages in the echo area,
531 although they are "output" in the general sense of the word, are
532 not affected). *Note Output Functions::.
534 The value of the last form in FORMS is returned.
536 ---------- Buffer: foo ----------
537 This is the contents of foo.
538 ---------- Buffer: foo ----------
540 (with-output-to-temp-buffer "foo"
542 (print standard-output))
545 ---------- Buffer: foo ----------
550 ---------- Buffer: foo ----------
552 - Variable: temp-buffer-show-function
553 If this variable is non-`nil', `with-output-to-temp-buffer' calls
554 it as a function to do the job of displaying a help buffer. The
555 function gets one argument, which is the buffer it should display.
557 In Emacs versions 18 and earlier, this variable was called
558 `temp-buffer-show-hook'.
560 - Function: momentary-string-display STRING POSITION &optional CHAR
562 This function momentarily displays STRING in the current buffer at
563 POSITION. It has no effect on the undo list or on the buffer's
566 The momentary display remains until the next input event. If the
567 next input event is CHAR, `momentary-string-display' ignores it
568 and returns. Otherwise, that event remains buffered for
569 subsequent use as input. Thus, typing CHAR will simply remove the
570 string from the display, while typing (say) `C-f' will remove the
571 string from the display and later (presumably) move point forward.
572 The argument CHAR is a space by default.
574 The return value of `momentary-string-display' is not meaningful.
576 You can do the same job in a more general way by creating an extent
577 with a begin-glyph property. *Note Extent Properties::.
579 If MESSAGE is non-`nil', it is displayed in the echo area while
580 STRING is displayed in the buffer. If it is `nil', a default
581 message says to type CHAR to continue.
583 In this example, point is initially located at the beginning of the
586 ---------- Buffer: foo ----------
587 This is the contents of foo.
589 ---------- Buffer: foo ----------
591 (momentary-string-display
592 "**** Important Message! ****"
594 "Type RET when done reading")
597 ---------- Buffer: foo ----------
598 This is the contents of foo.
599 **** Important Message! ****Second line.
600 ---------- Buffer: foo ----------
602 ---------- Echo Area ----------
603 Type RET when done reading
604 ---------- Echo Area ----------
606 This function works by actually changing the text in the buffer.
607 As a result, if you later undo in this buffer, you will see the
611 File: lispref.info, Node: Blinking, Next: Usual Display, Prev: Temporary Displays, Up: Display
616 This section describes the mechanism by which XEmacs shows a matching
617 open parenthesis when the user inserts a close parenthesis.
619 - Variable: blink-paren-function
620 The value of this variable should be a function (of no arguments)
621 to be called whenever a character with close parenthesis syntax is
622 inserted. The value of `blink-paren-function' may be `nil', in
623 which case nothing is done.
625 *Please note:* This variable was named `blink-paren-hook' in
626 older Emacs versions, but since it is not called with the
627 standard convention for hooks, it was renamed to
628 `blink-paren-function' in version 19.
630 - Variable: blink-matching-paren
631 If this variable is `nil', then `blink-matching-open' does nothing.
633 - Variable: blink-matching-paren-distance
634 This variable specifies the maximum distance to scan for a matching
635 parenthesis before giving up.
637 - Variable: blink-matching-paren-delay
638 This variable specifies the number of seconds for the cursor to
639 remain at the matching parenthesis. A fraction of a second often
640 gives good results, but the default is 1, which works on all
643 - Function: blink-matching-open
644 This function is the default value of `blink-paren-function'. It
645 assumes that point follows a character with close parenthesis
646 syntax and moves the cursor momentarily to the matching opening
647 character. If that character is not already on the screen, it
648 displays the character's context in the echo area. To avoid long
649 delays, this function does not search farther than
650 `blink-matching-paren-distance' characters.
652 Here is an example of calling this function explicitly.
654 (defun interactive-blink-matching-open ()
655 "Indicate momentarily the start of sexp before point."
658 (let ((blink-matching-paren-distance
660 (blink-matching-paren t))
661 (blink-matching-open)))
664 File: lispref.info, Node: Usual Display, Next: Display Tables, Prev: Blinking, Up: Display
666 Usual Display Conventions
667 =========================
669 The usual display conventions define how to display each character
670 code. You can override these conventions by setting up a display table
671 (*note Display Tables::.). Here are the usual display conventions:
673 * Character codes 32 through 126 map to glyph codes 32 through 126.
674 Normally this means they display as themselves.
676 * Character code 9 is a horizontal tab. It displays as whitespace
677 up to a position determined by `tab-width'.
679 * Character code 10 is a newline.
681 * All other codes in the range 0 through 31, and code 127, display
682 in one of two ways according to the value of `ctl-arrow'. If it is
683 non-`nil', these codes map to sequences of two glyphs, where the
684 first glyph is the ASCII code for `^'. (A display table can
685 specify a glyph to use instead of `^'.) Otherwise, these codes map
686 just like the codes in the range 128 to 255.
688 * Character codes 128 through 255 map to sequences of four glyphs,
689 where the first glyph is the ASCII code for `\', and the others are
690 digit characters representing the code in octal. (A display table
691 can specify a glyph to use instead of `\'.)
693 The usual display conventions apply even when there is a display
694 table, for any character whose entry in the active display table is
695 `nil'. Thus, when you set up a display table, you need only specify
696 the characters for which you want unusual behavior.
698 These variables affect the way certain characters are displayed on
699 the screen. Since they change the number of columns the characters
700 occupy, they also affect the indentation functions.
702 - User Option: ctl-arrow
703 This buffer-local variable controls how control characters are
704 displayed. If it is non-`nil', they are displayed as a caret
705 followed by the character: `^A'. If it is `nil', they are
706 displayed as a backslash followed by three octal digits: `\001'.
708 - Variable: default-ctl-arrow
709 The value of this variable is the default value for `ctl-arrow' in
710 buffers that do not override it. *Note Default Value::.
712 - User Option: tab-width
713 The value of this variable is the spacing between tab stops used
714 for displaying tab characters in Emacs buffers. The default is 8.
715 Note that this feature is completely independent from the
716 user-settable tab stops used by the command `tab-to-tab-stop'.
720 File: lispref.info, Node: Display Tables, Next: Beeping, Prev: Usual Display, Up: Display
725 You can use the "display table" feature to control how all 256
726 possible character codes display on the screen. This is useful for
727 displaying European languages that have letters not in the ASCII
730 The display table maps each character code into a sequence of
731 "runes", each rune being an image that takes up one character position
732 on the screen. You can also define how to display each rune on your
733 terminal, using the "rune table".
737 * Display Table Format:: What a display table consists of.
738 * Active Display Table:: How XEmacs selects a display table to use.
739 * Character Descriptors:: Format of an individual element of a
743 File: lispref.info, Node: Display Table Format, Next: Active Display Table, Up: Display Tables
748 A display table is an array of 256 elements. (In FSF Emacs, a display
749 table is 262 elements. The six extra elements specify the truncation
750 and continuation glyphs, etc. This method is very kludgey, and in
751 XEmacs the variables `truncation-glyph', `continuation-glyph', etc. are
752 used. *Note Truncation::.)
754 - Function: make-display-table
755 This creates and returns a display table. The table initially has
756 `nil' in all elements.
758 The 256 elements correspond to character codes; the Nth element says
759 how to display the character code N. The value should be `nil', a
760 string, a glyph, or a vector of strings and glyphs (*note Character
761 Descriptors::.). If an element is `nil', it says to display that
762 character according to the usual display conventions (*note Usual
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."
768 For example, here is how to construct a display table that mimics the
769 effect of setting `ctl-arrow' to a non-`nil' value:
771 (setq disptab (make-display-table))
774 (or (= i ?\t) (= i ?\n)
775 (aset disptab i (concat "^" (char-to-string (+ i 64)))))
777 (aset disptab 127 "^?"))
780 File: lispref.info, Node: Active Display Table, Next: Character Descriptors, Prev: Display Table Format, Up: Display Tables
785 The active display table is controlled by the variable
786 `current-display-table'. This is a specifier, which means that you can
787 specify separate values for it in individual buffers, windows, frames,
788 and devices, as well as a global value. It also means that you cannot
789 set this variable using `setq'; use `set-specifier' instead. *Note
790 Specifiers::. (FSF Emacs uses `window-display-table',
791 `buffer-display-table', `standard-display-table', etc. to control the
792 display table. However, specifiers are a cleaner and more powerful way
793 of doing the same thing. FSF Emacs also uses a different format for
794 the contents of a display table, using additional indirection to a
795 "glyph table" and such. Note that "glyph" has a different meaning in
798 Individual faces can also specify an overriding display table; this
799 is set using `set-face-display-table'. *Note Faces::.
801 If no display table can be determined for a particular window, then
802 XEmacs uses the usual display conventions. *Note Usual Display::.
805 File: lispref.info, Node: Character Descriptors, Prev: Active Display Table, Up: Display Tables
807 Character Descriptors
808 ---------------------
810 Each element of the display-table vector describes how to display a
811 particular character and is called a "character descriptor". A
812 character descriptor can be:
815 Display this particular string wherever the character is to be
819 Display this particular glyph wherever the character is to be
823 The vector may contain strings and/or glyphs. Display the
824 elements of the vector one after another wherever the character is
828 Display according to the standard interpretation (*note Usual
832 File: lispref.info, Node: Beeping, Prev: Display Tables, Up: Display
837 You can make XEmacs ring a bell, play a sound, or blink the screen to
838 attract the user's attention. Be conservative about how often you do
839 this; frequent bells can become irritating. Also be careful not to use
840 beeping alone when signaling an error is appropriate. (*Note Errors::.)
842 - Function: ding &optional DONT-TERMINATE SOUND DEVICE
843 This function beeps, or flashes the screen (see `visible-bell'
844 below). It also terminates any keyboard macro currently executing
845 unless DONT-TERMINATE is non-`nil'. If SOUND is specified, it
846 should be a symbol specifying which sound to make. This sound
847 will be played if `visible-bell' is `nil'. (This only works if
848 sound support was compiled into the executable and you are running
849 on the console of a Sun SparcStation, SGI, HP9000s700, or Linux
850 PC. Otherwise you just get a beep.) The optional third argument
851 specifies what device to make the sound on, and defaults to the
854 - Function: beep &optional DONT-TERMINATE SOUND DEVICE
855 This is a synonym for `ding'.
857 - User Option: visible-bell
858 This variable determines whether XEmacs should flash the screen to
859 represent a bell. Non-`nil' means yes, `nil' means no. On TTY
860 devices, this is effective only if the Termcap entry for the
861 terminal type has the visible bell flag (`vb') set.
863 - Variable: sound-alist
864 This variable holds an alist associating names with sounds. When
865 `beep' or `ding' is called with one of the name symbols, the
866 associated sound will be generated instead of the standard beep.
868 Each element of `sound-alist' is a list describing a sound. The
869 first element of the list is the name of the sound being defined.
870 Subsequent elements of the list are alternating keyword/value
874 A string of raw sound data, or the name of another sound to
875 play. The symbol `t' here means use the default X beep.
878 An integer from 0-100, defaulting to `bell-volume'.
881 If using the default X beep, the pitch (Hz) to generate.
884 If using the default X beep, the duration (milliseconds).
886 For compatibility, elements of `sound-alist' may also be:
888 * `( sound-name . <sound> )'
890 * `( sound-name <volume> <sound> )'
892 You should probably add things to this list by calling the function
897 - You can only play audio data if running on the console screen
898 of a Sun SparcStation, SGI, or HP9000s700.
900 - The pitch, duration, and volume options are available
901 everywhere, but many X servers ignore the `pitch' option.
903 The following beep-types are used by XEmacs itself:
906 when an auto-save does not succeed
909 when the XEmacs command loop catches an error
912 when you type a key that is undefined
915 when you use an undefined mouse-click combination
918 during completing-read
921 when you type something other than 'y' or 'n'
924 when you type something other than 'yes' or 'no'
927 used when nothing else is appropriate.
929 Other lisp packages may use other beep types, but these are the
930 ones that the C kernel of XEmacs uses.
932 - User Option: bell-volume
933 This variable specifies the default volume for sounds, from 0 to
936 - Command: load-default-sounds
937 This function loads and installs some sound files as beep-types.
939 - Command: load-sound-file FILENAME SOUND-NAME &optional VOLUME
940 This function reads in an audio file and adds it to `sound-alist'.
941 The sound file must be in the Sun/NeXT U-LAW format. SOUND-NAME
942 should be a symbol, specifying the name of the sound. If VOLUME
943 is specified, the sound will be played at that volume; otherwise,
944 the value of BELL-VOLUME will be used.
946 - Function: play-sound SOUND &optional VOLUME DEVICE
947 This function plays sound SOUND, which should be a symbol
948 mentioned in `sound-alist'. If VOLUME is specified, it overrides
949 the value (if any) specified in `sound-alist'. DEVICE specifies
950 the device to play the sound on, and defaults to the selected
953 - Command: play-sound-file FILE &optional VOLUME DEVICE
954 This function plays the named sound file at volume VOLUME, which
955 defaults to `bell-volume'. DEVICE specifies the device to play
956 the sound on, and defaults to the selected device.
959 File: lispref.info, Node: Hash Tables, Next: Range Tables, Prev: Display, Up: Top
964 - Function: hash-table-p OBJECT
965 This function returns `t' if OBJECT is a hash table, else `nil'.
969 * Introduction to Hash Tables:: Hash tables are fast data structures for
970 implementing simple tables (i.e. finite
971 mappings from keys to values).
972 * Working With Hash Tables:: Hash table functions.
973 * Weak Hash Tables:: Hash tables with special garbage-collection
977 File: lispref.info, Node: Introduction to Hash Tables, Next: Working With Hash Tables, Up: Hash Tables
979 Introduction to Hash Tables
980 ===========================
982 A "hash table" is a data structure that provides mappings from
983 arbitrary Lisp objects called "keys" to other arbitrary Lisp objects
984 called "values". A key/value pair is sometimes called an "entry" in
985 the hash table. There are many ways other than hash tables of
986 implementing the same sort of mapping, e.g. association lists (*note
987 Association Lists::.) and property lists (*note Property Lists::.), but
988 hash tables provide much faster lookup when there are many entries in
989 the mapping. Hash tables are an implementation of the abstract data
990 type "dictionary", also known as "associative array".
992 Internally, hash tables are hashed using the "linear probing" hash
993 table implementation method. This method hashes each key to a
994 particular spot in the hash table, and then scans forward sequentially
995 until a blank entry is found. To look up a key, hash to the appropriate
996 spot, then search forward for the key until either a key is found or a
997 blank entry stops the search. This method is used in preference to
998 double hashing because of changes in recent hardware. The penalty for
999 non-sequential access to memory has been increasing, and this
1000 compensates for the problem of clustering that linear probing entails.
1002 When hash tables are created, the user may (but is not required to)
1003 specify initial properties that influence performance.
1005 Use the `:size' parameter to specify the number of entries that are
1006 likely to be stored in the hash table, to avoid the overhead of resizing
1007 the table. But if the pre-allocated space for the entries is never
1008 used, it is simply wasted and makes XEmacs slower. Excess unused hash
1009 table entries exact a small continuous performance penalty, since they
1010 must be scanned at every garbage collection. If the number of entries
1011 in the hash table is unknown, simply avoid using the `:size' keyword.
1013 Use the `:rehash-size' and `:rehash-threshold' keywords to adjust
1014 the algorithm for deciding when to rehash the hash table. For
1015 temporary hash tables that are going to be very heavily used, use a
1016 small rehash threshold, for example, 0.4 and a large rehash size, for
1017 example 2.0. For permanent hash tables that will be infrequently used,
1018 specify a large rehash threshold, for example 0.8.
1020 Hash tables can also be created by the lisp reader using structure
1021 syntax, for example:
1022 #s(hash-table size 20 data (foo 1 bar 2))
1024 The structure syntax accepts the same keywords as `make-hash-table'
1025 (without the `:' character), as well as the additional keyword `data',
1026 which specifies the initial hash table contents.
1028 - Function: make-hash-table &key `test' `size' `rehash-size'
1029 `rehash-threshold' `weakness'
1030 This function returns a new empty hash table object.
1032 Keyword `:test' can be `eq', `eql' (default) or `equal'.
1033 Comparison between keys is done using this function. If speed is
1034 important, consider using `eq'. When storing strings in the hash
1035 table, you will likely need to use `equal'.
1037 Keyword `:size' specifies the number of keys likely to be inserted.
1038 This number of entries can be inserted without enlarging the hash
1041 Keyword `:rehash-size' must be a float greater than 1.0, and
1042 specifies the factor by which to increase the size of the hash
1043 table when enlarging.
1045 Keyword `:rehash-threshold' must be a float between 0.0 and 1.0,
1046 and specifies the load factor of the hash table which triggers
1049 Keyword `:weakness' can be `nil' (default), `t', `key' or `value'.
1051 A weak hash table is one whose pointers do not count as GC
1052 referents: for any key-value pair in the hash table, if the only
1053 remaining pointer to either the key or the value is in a weak hash
1054 table, then the pair will be removed from the hash table, and the
1055 key and value collected. A non-weak hash table (or any other
1056 pointer) would prevent the object from being collected.
1058 A key-weak hash table is similar to a fully-weak hash table except
1059 that a key-value pair will be removed only if the key remains
1060 unmarked outside of weak hash tables. The pair will remain in the
1061 hash table if the key is pointed to by something other than a weak
1062 hash table, even if the value is not.
1064 A value-weak hash table is similar to a fully-weak hash table
1065 except that a key-value pair will be removed only if the value
1066 remains unmarked outside of weak hash tables. The pair will
1067 remain in the hash table if the value is pointed to by something
1068 other than a weak hash table, even if the key is not.
1070 - Function: copy-hash-table HASH-TABLE
1071 This function returns a new hash table which contains the same
1072 keys and values as HASH-TABLE. The keys and values will not
1073 themselves be copied.
1075 - Function: hash-table-count HASH-TABLE
1076 This function returns the number of entries in HASH-TABLE.
1078 - Function: hash-table-test HASH-TABLE
1079 This function returns the test function of HASH-TABLE. This can
1080 be one of `eq', `eql' or `equal'.
1082 - Function: hash-table-size HASH-TABLE
1083 This function returns the current number of slots in HASH-TABLE,
1084 whether occupied or not.
1086 - Function: hash-table-rehash-size HASH-TABLE
1087 This function returns the current rehash size of HASH-TABLE. This
1088 is a float greater than 1.0; the factor by which HASH-TABLE is
1089 enlarged when the rehash threshold is exceeded.
1091 - Function: hash-table-rehash-threshold HASH-TABLE
1092 This function returns the current rehash threshold of HASH-TABLE.
1093 This is a float between 0.0 and 1.0; the maximum "load factor" of
1094 HASH-TABLE, beyond which the HASH-TABLE is enlarged by rehashing.
1096 - Function: hash-table-weakness HASH-TABLE
1097 This function returns the weakness of HASH-TABLE. This can be one
1098 of `nil', `t', `key' or `value'.
1101 File: lispref.info, Node: Working With Hash Tables, Next: Weak Hash Tables, Prev: Introduction to Hash Tables, Up: Hash Tables
1103 Working With Hash Tables
1104 ========================
1106 - Function: puthash KEY VALUE HASH-TABLE
1107 This function hashes KEY to VALUE in HASH-TABLE.
1109 - Function: gethash KEY HASH-TABLE &optional DEFAULT
1110 This function finds the hash value for KEY in HASH-TABLE. If
1111 there is no entry for KEY in HASH-TABLE, DEFAULT is returned
1112 (which in turn defaults to `nil').
1114 - Function: remhash KEY HASH-TABLE
1115 This function removes the entry for KEY from HASH-TABLE. Does
1116 nothing if there is no entry for KEY in HASH-TABLE.
1118 - Function: clrhash HASH-TABLE
1119 This function removes all entries from HASH-TABLE, leaving it
1122 - Function: maphash FUNCTION HASH-TABLE
1123 This function maps FUNCTION over entries in HASH-TABLE, calling it
1124 with two args, each key and value in the hash table.
1126 FUNCTION may not modify HASH-TABLE, with the one exception that
1127 FUNCTION may remhash or puthash the entry currently being
1128 processed by FUNCTION.
1131 File: lispref.info, Node: Weak Hash Tables, Prev: Working With Hash Tables, Up: Hash Tables
1136 A "weak hash table" is a special variety of hash table whose
1137 elements do not count as GC referents. For any key-value pair in such a
1138 hash table, if either the key or value (or in some cases, if one
1139 particular one of the two) has no references to it outside of weak hash
1140 tables (and similar structures such as weak lists), the pair will be
1141 removed from the table, and the key and value collected. A non-weak
1142 hash table (or any other pointer) would prevent the objects from being
1145 Weak hash tables are useful for keeping track of information in a
1146 non-obtrusive way, for example to implement caching. If the cache
1147 contains objects such as buffers, markers, image instances, etc. that
1148 will eventually disappear and get garbage-collected, using a weak hash
1149 table ensures that these objects are collected normally rather than
1150 remaining around forever, long past their actual period of use.
1151 (Otherwise, you'd have to explicitly map over the hash table every so
1152 often and remove unnecessary elements.)
1154 There are three types of weak hash tables:
1156 fully weak hash tables
1157 In these hash tables, a pair disappears if either the key or the
1158 value is unreferenced outside of the table.
1160 key-weak hash tables
1161 In these hash tables, a pair disappears if the key is unreferenced
1162 outside of the table, regardless of how the value is referenced.
1164 value-weak hash tables
1165 In these hash tables, a pair disappears if the value is
1166 unreferenced outside of the table, regardless of how the key is
1169 Also see *Note Weak Lists::.
1171 Weak hash tables are created by specifying the `:weakness' keyword to
1175 File: lispref.info, Node: Range Tables, Next: Databases, Prev: Hash Tables, Up: Top
1180 A range table is a table that efficiently associated values with
1183 Note that range tables have a read syntax, like this:
1185 #s(range-table data ((-3 2) foo (5 20) bar))
1187 This maps integers in the range (-3, 2) to `foo' and integers in the
1188 range (5, 20) to `bar'.
1190 - Function: range-table-p OBJECT
1191 Return non-`nil' if OBJECT is a range table.
1195 * Introduction to Range Tables:: Range tables efficiently map ranges of
1197 * Working With Range Tables:: Range table functions.
1200 File: lispref.info, Node: Introduction to Range Tables, Next: Working With Range Tables, Up: Range Tables
1202 Introduction to Range Tables
1203 ============================
1205 - Function: make-range-table
1206 Make a new, empty range table.
1208 - Function: copy-range-table OLD-TABLE
1209 Make a new range table which contains the same values for the same
1210 ranges as the given table. The values will not themselves be
1214 File: lispref.info, Node: Working With Range Tables, Prev: Introduction to Range Tables, Up: Range Tables
1216 Working With Range Tables
1217 =========================
1219 - Function: get-range-table POS TABLE &optional DEFAULT
1220 This function finds value for position POS in TABLE. If there is
1221 no corresponding value, return DEFAULT (defaults to `nil').
1223 - Function: put-range-table START END VAL TABLE
1224 This function sets the value for range (START, END) to be VAL in
1227 - Function: remove-range-table START END TABLE
1228 This function removes the value for range (START, END) in TABLE.
1230 - Function: clear-range-table TABLE
1231 This function flushes TABLE.
1233 - Function: map-range-table FUNCTION TABLE
1234 This function maps FUNCTION over entries in TABLE, calling it with
1235 three args, the beginning and end of the range and the
1236 corresponding value.
1239 File: lispref.info, Node: Databases, Next: Processes, Prev: Range Tables, Up: Top
1244 - Function: databasep OBJECT
1245 This function returns non-`nil' if OBJECT is a database.
1249 * Connecting to a Database::
1250 * Working With a Database::
1251 * Other Database Functions::
1254 File: lispref.info, Node: Connecting to a Database, Next: Working With a Database, Up: Databases
1256 Connecting to a Database
1257 ========================
1259 - Function: open-database FILE &optional TYPE SUBTYPE ACCESS MODE
1260 This function opens database FILE, using database method TYPE and
1261 SUBTYPE, with access rights ACCESS and permissions MODE. ACCESS
1262 can be any combination of `r' `w' and `+', for read, write, and
1265 TYPE can have the value `'dbm' or `'berkeley_db' to select the
1266 type of database file to use. (Note: XEmacs may not support both
1269 For a TYPE of `'dbm', there are no subtypes, so SUBTYPE should by
1272 For a TYPE of `'berkeley_db', the following subtypes are
1273 available: `'hash', `'btree', and `'recno'. See the manpages for
1274 the Berkeley DB functions to more information about these types.
1276 - Function: close-database OBJ
1277 This function closes database OBJ.
1279 - Function: database-live-p OBJ
1280 This function returns `t' iff OBJ is an active database, else