Sync with r21-2-27.
[chise/xemacs-chise.git-] / info / lispref.info-37
1 This is ../info/lispref.info, produced by makeinfo version 4.0 from
2 lispref/lispref.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * Lispref: (lispref).           XEmacs Lisp Reference Manual.
7 END-INFO-DIR-ENTRY
8
9    Edition History:
10
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
20
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.
24
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.
28
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.
33
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.
38
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.
45
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.
51
52 \1f
53 File: lispref.info,  Node: The Echo Area,  Next: Warnings,  Prev: Truncation,  Up: Display
54
55 The Echo Area
56 =============
57
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::.
66
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
69 follows:
70
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
76      constructed string.
77
78      In batch mode, `message' prints the message text on the standard
79      error stream, followed by a newline.
80
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.
84
85           (message "Minibuffer depth is %d."
86                    (minibuffer-depth))
87            -| Minibuffer depth is 0.
88           => "Minibuffer depth is 0."
89           
90           ---------- Echo Area ----------
91           Minibuffer depth is 0.
92           ---------- Echo Area ----------
93
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
97 standard labels are:
98
99    * `message'--default label used by the `message' function;
100
101    * `error'--default label used for reporting errors;
102
103    * `progress'--progress indicators like `Converting... 45%' (not
104      logged by default);
105
106    * `prompt'--prompt-like messages like `Isearch: foo' (not logged by
107      default);
108
109    * `command'--helper command messages like `Mark set' (not logged by
110      default);
111
112    * `no-log'--messages that should never be logged
113
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
116 the message stack.
117
118  - Function: display-message label message &optional frame stdout-p
119      This function displays MESSAGE (a string) labeled as LABEL, as
120      described above.
121
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.
125
126           (display-message 'command "Mark set")
127
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.
132
133           ;; Display a command message.
134           (lmessage 'command "Comment column set to %d" comment-column)
135           
136           ;; Display a progress message.
137           (lmessage 'progress "Fontifying %s... (%d)" buffer percentage)
138           
139           ;; Display a message that should not be logged.
140           (lmessage 'no-log "Done")
141
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
145      displayed there.
146
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.
152
153           ;; Show a message, wait for 2 seconds, and restore old minibuffer
154           ;; contents.
155           (message "A message")
156            -| A message
157           => "A Message"
158           (lmessage 'my-label "Newsflash!  Newsflash!")
159            -| Newsflash!  Newsflash!
160           => "Newsflash!  Newsflash!"
161           (sit-for 2)
162           (clear-message 'my-label)
163            -| A message
164           => "A message"
165
166      Unless you need the return value or you need to specify a label,
167      you should just use `(message nil)'.
168
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.
172
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.
176
177  - User Option: log-message-max-size
178      This variable specifies the maximum size of the ` *Message-log*'
179      buffer.
180
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.
184
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
188      expressions.
189
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'.
193
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.
201
202      If the value is zero, then command input is not echoed.
203
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.
209
210      The value is normally `nil'; Lisp programs bind it to `t' for
211      brief periods of time.
212
213 \1f
214 File: lispref.info,  Node: Warnings,  Next: Invisible Text,  Prev: The Echo Area,  Up: Display
215
216 Warnings
217 ========
218
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.
223
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
229 displayed:
230
231      (1) (initialization/error) An error has occurred while loading ~/.emacs:
232      
233      Symbol's value as variable is void: bogus-variable
234      
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.
238
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'.
242
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
246 `emergency'.
247
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'.
253
254           (display-warning 'resource
255             "Bad resource specification encountered:
256           something like
257           
258               Emacs*foo: bar
259           
260           You should replace the * with a . in order to get proper behavior when
261           you use the specifier and/or `set-face-*' functions.")
262           
263           ---------- Warning buffer ----------
264           (1) (resource/warning) Bad resource specification encountered:
265           something like
266           
267               Emacs*foo: bar
268           
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 ----------
272
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).
278
279      Unlike in `display-warning', MESSAGE may be a formatted message,
280      which will be, together with the rest of the arguments, passed to
281      `format'.
282
283           (lwarn 'message-log 'warning
284             "Error caught in `remove-message-hook': %s"
285             (error-message-string e))
286
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.
291
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
297      by default.
298
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.
304
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.
313
314 \1f
315 File: lispref.info,  Node: Invisible Text,  Next: Selective Display,  Prev: Warnings,  Up: Display
316
317 Invisible Text
318 ==============
319
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.
323
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.
329
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'.
336
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.
343
344  - Variable: buffer-invisibility-spec
345      This variable specifies which kinds of `invisible' properties
346      actually make a character invisible.
347
348     `t'
349           A character is invisible if its `invisible' property is
350           non-`nil'.  This is the default.
351
352     a list
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
356           elements:
357
358          `ATOM'
359                A character is invisible if its `invisible' property
360                value is ATOM or if it is a list with ATOM as a member.
361
362          `(ATOM . t)'
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
367                ellipsis.
368
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.
372
373 \1f
374 File: lispref.info,  Node: Selective Display,  Next: Overlay Arrow,  Prev: Invisible Text,  Up: Display
375
376 Selective Display
377 =================
378
379    "Selective display" is a pair of features that hide certain lines on
380 the screen.
381
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.
387
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
390 user-level feature.
391
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.
397
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
405 invisible.
406
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.
411
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.
415
416         * If the value of `selective-display' is `t', then any portion
417           of a line that follows a control-m is not displayed.
418
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.
422
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.
429
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.
433
434           (setq selective-display nil)
435                => nil
436           
437           ---------- Buffer: foo ----------
438           1 on this column
439            2on this column
440             3n this column
441             3n this column
442            2on this column
443           1 on this column
444           ---------- Buffer: foo ----------
445           
446           (setq selective-display 2)
447                => 2
448           
449           ---------- Buffer: foo ----------
450           1 on this column
451            2on this column
452            2on this column
453           1 on this column
454           ---------- Buffer: foo ----------
455
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.
460
461           (setq selective-display-ellipses t)
462                => t
463           
464           ---------- Buffer: foo ----------
465           1 on this column
466            2on this column ...
467            2on this column
468           1 on this column
469           ---------- Buffer: foo ----------
470
471      You can use a display table to substitute other text for the
472      ellipsis (`...').  *Note Display Tables::.
473
474 \1f
475 File: lispref.info,  Node: Overlay Arrow,  Next: Temporary Displays,  Prev: Selective Display,  Up: Display
476
477 The Overlay Arrow
478 =================
479
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.
484
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::).
490
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.
498
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
501      any given time.
502
503    You can do the same job by creating an extent with a `begin-glyph'
504 property.  *Note Extent Properties::.
505
506 \1f
507 File: lispref.info,  Node: Temporary Displays,  Next: Blinking,  Prev: Overlay Arrow,  Up: Display
508
509 Temporary Displays
510 ==================
511
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.
515
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.
520
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.
525
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::.
532
533      The value of the last form in FORMS is returned.
534
535           ---------- Buffer: foo ----------
536            This is the contents of foo.
537           ---------- Buffer: foo ----------
538           
539           (with-output-to-temp-buffer "foo"
540               (print 20)
541               (print standard-output))
542           => #<buffer foo>
543           
544           ---------- Buffer: foo ----------
545           20
546           
547           #<buffer foo>
548           
549           ---------- Buffer: foo ----------
550
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.
555
556      In Emacs versions 18 and earlier, this variable was called
557      `temp-buffer-show-hook'.
558
559  - Function: momentary-string-display string position &optional char
560           message
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
563      modification status.
564
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.
572
573      The return value of `momentary-string-display' is not meaningful.
574
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::.
577
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.
581
582      In this example, point is initially located at the beginning of the
583      second line:
584
585           ---------- Buffer: foo ----------
586           This is the contents of foo.
587           -!-Second line.
588           ---------- Buffer: foo ----------
589           
590           (momentary-string-display
591             "**** Important Message! ****"
592             (point) ?\r
593             "Type RET when done reading")
594           => t
595           
596           ---------- Buffer: foo ----------
597           This is the contents of foo.
598           **** Important Message! ****Second line.
599           ---------- Buffer: foo ----------
600           
601           ---------- Echo Area ----------
602           Type RET when done reading
603           ---------- Echo Area ----------
604
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
607      message come and go.
608
609 \1f
610 File: lispref.info,  Node: Blinking,  Next: Usual Display,  Prev: Temporary Displays,  Up: Display
611
612 Blinking Parentheses
613 ====================
614
615    This section describes the mechanism by which XEmacs shows a matching
616 open parenthesis when the user inserts a close parenthesis.
617
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.
623
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.
628
629  - Variable: blink-matching-paren
630      If this variable is `nil', then `blink-matching-open' does nothing.
631
632  - Variable: blink-matching-paren-distance
633      This variable specifies the maximum distance to scan for a matching
634      parenthesis before giving up.
635
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
640      systems.
641
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.
650
651      Here is an example of calling this function explicitly.
652
653           (defun interactive-blink-matching-open ()
654             "Indicate momentarily the start of sexp before point."
655             (interactive)
656             (let ((blink-matching-paren-distance
657                    (buffer-size))
658                   (blink-matching-paren t))
659               (blink-matching-open)))
660
661 \1f
662 File: lispref.info,  Node: Usual Display,  Next: Display Tables,  Prev: Blinking,  Up: Display
663
664 Usual Display Conventions
665 =========================
666
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:
670
671    * Character codes 32 through 126 map to glyph codes 32 through 126.
672      Normally this means they display as themselves.
673
674    * Character code 9 is a horizontal tab.  It displays as whitespace
675      up to a position determined by `tab-width'.
676
677    * Character code 10 is a newline.
678
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.
685
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 `\'.)
690
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.
695
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.
699
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'.
705
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::.
709
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'.
715      *Note Indent Tabs::.
716
717 \1f
718 File: lispref.info,  Node: Display Tables,  Next: Beeping,  Prev: Usual Display,  Up: Display
719
720 Display Tables
721 ==============
722
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
726 character set.
727
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".
732
733 * Menu:
734
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
738                                   display table.
739
740 \1f
741 File: lispref.info,  Node: Display Table Format,  Next: Active Display Table,  Up: Display Tables
742
743 Display Table Format
744 --------------------
745
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::.)
751
752  - Function: make-display-table
753      This creates and returns a display table.  The table initially has
754      `nil' in all elements.
755
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
761 Display::).
762
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."
765
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:
768
769      (setq disptab (make-display-table))
770      (let ((i 0))
771        (while (< i 32)
772          (or (= i ?\t) (= i ?\n)
773              (aset disptab i (concat "^" (char-to-string (+ i 64)))))
774          (setq i (1+ i)))
775        (aset disptab 127 "^?"))
776
777 \1f
778 File: lispref.info,  Node: Active Display Table,  Next: Character Descriptors,  Prev: Display Table Format,  Up: Display Tables
779
780 Active Display Table
781 --------------------
782
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
794 XEmacs.)
795
796    Individual faces can also specify an overriding display table; this
797 is set using `set-face-display-table'.  *Note Faces::.
798
799    If no display table can be determined for a particular window, then
800 XEmacs uses the usual display conventions.  *Note Usual Display::.
801
802 \1f
803 File: lispref.info,  Node: Character Descriptors,  Prev: Active Display Table,  Up: Display Tables
804
805 Character Descriptors
806 ---------------------
807
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:
811
812 a string
813      Display this particular string wherever the character is to be
814      displayed.
815
816 a glyph
817      Display this particular glyph wherever the character is to be
818      displayed.
819
820 a vector
821      The vector may contain strings and/or glyphs.  Display the
822      elements of the vector one after another wherever the character is
823      to be displayed.
824
825 `nil'
826      Display according to the standard interpretation (*note Usual
827      Display::).
828
829 \1f
830 File: lispref.info,  Node: Beeping,  Prev: Display Tables,  Up: Display
831
832 Beeping
833 =======
834
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::.)
839
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
850      selected device.
851
852  - Function: beep &optional dont-terminate sound device
853      This is a synonym for `ding'.
854
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.
860
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.
865
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
869      pairs:
870
871     `sound'
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.
874
875     `volume'
876           An integer from 0-100, defaulting to `bell-volume'.
877
878     `pitch'
879           If using the default X beep, the pitch (Hz) to generate.
880
881     `duration'
882           If using the default X beep, the duration (milliseconds).
883
884      For compatibility, elements of `sound-alist' may also be:
885
886         * `( sound-name . <sound> )'
887
888         * `( sound-name <volume> <sound> )'
889
890      You should probably add things to this list by calling the function
891      `load-sound-file'.
892
893      Caveats:
894
895         - You can only play audio data if running on the console screen
896           of a Sun SparcStation, SGI, or HP9000s700.
897
898         - The pitch, duration, and volume options are available
899           everywhere, but many X servers ignore the `pitch' option.
900
901      The following beep-types are used by XEmacs itself:
902
903     `auto-save-error'
904           when an auto-save does not succeed
905
906     `command-error'
907           when the XEmacs command loop catches an error
908
909     `undefined-key'
910           when you type a key that is undefined
911
912     `undefined-click'
913           when you use an undefined mouse-click combination
914
915     `no-completion'
916           during completing-read
917
918     `y-or-n-p'
919           when you type something other than 'y' or 'n'
920
921     `yes-or-no-p'
922           when you type something other than 'yes' or 'no'
923
924     `default'
925           used when nothing else is appropriate.
926
927      Other lisp packages may use other beep types, but these are the
928      ones that the C kernel of XEmacs uses.
929
930  - User Option: bell-volume
931      This variable specifies the default volume for sounds, from 0 to
932      100.
933
934  - Command: load-default-sounds
935      This function loads and installs some sound files as beep-types.
936
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.
943
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
949      device.
950
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.
955
956 \1f
957 File: lispref.info,  Node: Hash Tables,  Next: Range Tables,  Prev: Display,  Up: Top
958
959 Hash Tables
960 ***********
961
962  - Function: hash-table-p object
963      This function returns `t' if OBJECT is a hash table, else `nil'.
964
965 * Menu:
966
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
972                                 behavior.
973
974 \1f
975 File: lispref.info,  Node: Introduction to Hash Tables,  Next: Working With Hash Tables,  Up: Hash Tables
976
977 Introduction to Hash Tables
978 ===========================
979
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".
989
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.
999
1000    When hash tables are created, the user may (but is not required to)
1001 specify initial properties that influence performance.
1002
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.
1010
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.
1017
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))
1021
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.
1025
1026  - Function: make-hash-table &key `test' `size' `rehash-size'
1027           `rehash-threshold' `weakness'
1028      This function returns a new empty hash table object.
1029
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'.
1034
1035      Keyword `:size' specifies the number of keys likely to be inserted.
1036      This number of entries can be inserted without enlarging the hash
1037      table.
1038
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.
1042
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
1045      enlarging.
1046
1047      Keyword `:weakness' can be `nil' (default), `t', `key' or `value'.
1048
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.
1055
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.
1061
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.
1067
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.
1072
1073  - Function: hash-table-count hash-table
1074      This function returns the number of entries in HASH-TABLE.
1075
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'.
1079
1080  - Function: hash-table-size hash-table
1081      This function returns the current number of slots in HASH-TABLE,
1082      whether occupied or not.
1083
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.
1088
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.
1093
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'.
1097
1098 \1f
1099 File: lispref.info,  Node: Working With Hash Tables,  Next: Weak Hash Tables,  Prev: Introduction to Hash Tables,  Up: Hash Tables
1100
1101 Working With Hash Tables
1102 ========================
1103
1104  - Function: puthash key value hash-table
1105      This function hashes KEY to VALUE in HASH-TABLE.
1106
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').
1111
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.
1115
1116  - Function: clrhash hash-table
1117      This function removes all entries from HASH-TABLE, leaving it
1118      empty.
1119
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.
1123
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.
1127
1128 \1f
1129 File: lispref.info,  Node: Weak Hash Tables,  Prev: Working With Hash Tables,  Up: Hash Tables
1130
1131 Weak Hash Tables
1132 ================
1133
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
1141 collected.
1142
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.)
1151
1152    There are three types of weak hash tables:
1153
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.
1157
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.
1161
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
1165      referenced.
1166
1167    Also see *Note Weak Lists::.
1168
1169    Weak hash tables are created by specifying the `:weakness' keyword to
1170 `make-hash-table'.
1171
1172 \1f
1173 File: lispref.info,  Node: Range Tables,  Next: Databases,  Prev: Hash Tables,  Up: Top
1174
1175 Range Tables
1176 ************
1177
1178    A range table is a table that efficiently associated values with
1179 ranges of integers.
1180
1181    Note that range tables have a read syntax, like this:
1182
1183      #s(range-table data ((-3 2) foo (5 20) bar))
1184
1185    This maps integers in the range (-3, 2) to `foo' and integers in the
1186 range (5, 20) to `bar'.
1187
1188  - Function: range-table-p object
1189      Return non-`nil' if OBJECT is a range table.
1190
1191 * Menu:
1192
1193 * Introduction to Range Tables:: Range tables efficiently map ranges of
1194                                  integers to values.
1195 * Working With Range Tables::    Range table functions.
1196
1197 \1f
1198 File: lispref.info,  Node: Introduction to Range Tables,  Next: Working With Range Tables,  Up: Range Tables
1199
1200 Introduction to Range Tables
1201 ============================
1202
1203  - Function: make-range-table
1204      Make a new, empty range table.
1205
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
1209      copied.
1210
1211 \1f
1212 File: lispref.info,  Node: Working With Range Tables,  Prev: Introduction to Range Tables,  Up: Range Tables
1213
1214 Working With Range Tables
1215 =========================
1216
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').
1220
1221  - Function: put-range-table start end val table
1222      This function sets the value for range (START, END) to be VAL in
1223      TABLE.
1224
1225  - Function: remove-range-table start end table
1226      This function removes the value for range (START, END) in TABLE.
1227
1228  - Function: clear-range-table table
1229      This function flushes TABLE.
1230
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.
1235
1236 \1f
1237 File: lispref.info,  Node: Databases,  Next: Processes,  Prev: Range Tables,  Up: Top
1238
1239 Databases
1240 *********
1241
1242  - Function: databasep object
1243      This function returns non-`nil' if OBJECT is a database.
1244
1245 * Menu:
1246
1247 * Connecting to a Database::
1248 * Working With a Database::
1249 * Other Database Functions::
1250
1251 \1f
1252 File: lispref.info,  Node: Connecting to a Database,  Next: Working With a Database,  Up: Databases
1253
1254 Connecting to a Database
1255 ========================
1256
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
1261      creation flags.
1262
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
1265      of these types.)
1266
1267      For a TYPE of `'dbm', there are no subtypes, so SUBTYPE should by
1268      `nil'.
1269
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.
1273
1274  - Function: close-database obj
1275      This function closes database OBJ.
1276
1277  - Function: database-live-p obj
1278      This function returns `t' iff OBJ is an active database, else
1279      `nil'.
1280