XEmacs 21.4.15
[chise/xemacs-chise.git.1] / info / lispref.info-7
1 This is ../info/lispref.info, produced by makeinfo version 4.6 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: Font Instance Size,  Next: Font Instance Characteristics,  Prev: Font Instance Names,  Up: Fonts
54
55 Font Instance Size
56 ------------------
57
58  - Function: x-font-size font
59      This function returns the nominal size of the given font.  This is
60      done by parsing its name, so it's likely to lose.  X fonts can be
61      specified (by the user) in either pixels or 10ths of points, and
62      this returns the first one it finds, so you have to decide which
63      units the returned value is measured in yourself ...
64
65  - Function: x-find-larger-font font &optional device
66      This function loads a new, slightly larger version of the given
67      font (or font name).  Returns the font if it succeeds, `nil'
68      otherwise.  If scalable fonts are available, this returns a font
69      which is 1 point larger.  Otherwise, it returns the next larger
70      version of this font that is defined.
71
72  - Function: x-find-smaller-font font &optional device
73      This function loads a new, slightly smaller version of the given
74      font (or font name).  Returns the font if it succeeds, `nil'
75      otherwise.  If scalable fonts are available, this returns a font
76      which is 1 point smaller.  Otherwise, it returns the next smaller
77      version of this font that is defined.
78
79 \1f
80 File: lispref.info,  Node: Font Instance Characteristics,  Next: Font Convenience Functions,  Prev: Font Instance Size,  Up: Fonts
81
82 Font Instance Characteristics
83 -----------------------------
84
85  - Function: font-instance-properties font-instance
86      This function returns the properties (an alist or `nil') of
87      FONT-INSTANCE.
88
89  - Function: x-make-font-bold font &optional device
90      Given an X font specification, this attempts to make a "bold" font.
91      If it fails, it returns `nil'.
92
93  - Function: x-make-font-unbold font &optional device
94      Given an X font specification, this attempts to make a non-bold
95      font.  If it fails, it returns `nil'.
96
97  - Function: x-make-font-italic font &optional device
98      Given an X font specification, this attempts to make an "italic"
99      font.  If it fails, it returns `nil'.
100
101  - Function: x-make-font-unitalic font &optional device
102      Given an X font specification, this attempts to make a non-italic
103      font.  If it fails, it returns `nil'.
104
105  - Function: x-make-font-bold-italic font &optional device
106      Given an X font specification, this attempts to make a
107      "bold-italic" font.  If it fails, it returns `nil'.
108
109 \1f
110 File: lispref.info,  Node: Font Convenience Functions,  Prev: Font Instance Characteristics,  Up: Fonts
111
112 Font Convenience Functions
113 --------------------------
114
115  - Function: font-name font &optional domain
116      This function returns the name of the FONT in the specified
117      DOMAIN, if any.  FONT should be a font specifier object and DOMAIN
118      is normally a window and defaults to the selected window if
119      omitted.  This is equivalent to using `specifier-instance' and
120      applying `font-instance-name' to the result.
121
122  - Function: font-truename font &optional domain
123      This function returns the truename of the FONT in the specified
124      DOMAIN, if any.  FONT should be a font specifier object and DOMAIN
125      is normally a window and defaults to the selected window if
126      omitted.  This is equivalent to using `specifier-instance' and
127      applying `font-instance-truename' to the result.
128
129  - Function: font-properties font &optional domain
130      This function returns the properties of the FONT in the specified
131      DOMAIN, if any.  FONT should be a font specifier object and DOMAIN
132      is normally a window and defaults to the selected window if
133      omitted.  This is equivalent to using `specifier-instance' and
134      applying `font-instance-properties' to the result.
135
136 \1f
137 File: lispref.info,  Node: Colors,  Prev: Fonts,  Up: Faces and Window-System Objects
138
139 Colors
140 ======
141
142 * Menu:
143
144 * Color Specifiers::            Specifying how a color will appear.
145 * Color Instances::             What a color specifier gets instanced as.
146 * Color Instance Properties::   Properties of color instances.
147 * Color Convenience Functions:: Convenience functions that automatically
148                                   instance and retrieve the properties
149                                   of a color specifier.
150
151 \1f
152 File: lispref.info,  Node: Color Specifiers,  Next: Color Instances,  Up: Colors
153
154 Color Specifiers
155 ----------------
156
157  - Function: color-specifier-p object
158      This function returns non-`nil' if OBJECT is a color specifier.
159
160  - Function: make-color-specifier spec-list
161      Return a new `color' specifier object with the given specification
162      list.  SPEC-LIST can be a list of specifications (each of which is
163      a cons of a locale and a list of instantiators), a single
164      instantiator, or a list of instantiators.  *Note Specifiers::, for
165      a detailed description of how specifiers work.
166
167      Valid instantiators for color specifiers are:
168
169         * A string naming a color (e.g. under X this might be
170           "lightseagreen2" or "#F534B2").
171
172         * A color instance (use that instance directly if the device
173           matches, or use the string that generated it).
174
175         * A vector of no elements (only on TTY's; this means to set no
176           color at all, thus using the "natural" color of the
177           terminal's text).
178
179         * A vector of one or two elements: a face to inherit from, and
180           optionally a symbol naming which property of that face to
181           inherit, either `foreground' or `background' (if omitted,
182           defaults to the same property that this color specifier is
183           used for; if this specifier is not part of a face, the
184           instantiator would not be valid).
185
186  - Function: make-face-boolean-specifier spec-list
187      Return a new `face-boolean' specifier object with the given spec
188      list.  SPEC-LIST can be a list of specifications (each of which is
189      a cons of a locale and a list of instantiators), a single
190      instantiator, or a list of instantiators.  *Note Specifiers::, for
191      a detailed description of how specifiers work.
192
193      Valid instantiators for face-boolean specifiers are
194
195         * t or nil.
196
197         * A vector of two or three elements: a face to inherit from,
198           optionally a symbol naming the property of that face to
199           inherit from (if omitted, defaults to the same property that
200           this face-boolean specifier is used for; if this specifier is
201           not part of a face, the instantiator would not be valid), and
202           optionally a value which, if non-`nil', means to invert the
203           sense of the inherited property.
204
205
206 \1f
207 File: lispref.info,  Node: Color Instances,  Next: Color Instance Properties,  Prev: Color Specifiers,  Up: Colors
208
209 Color Instances
210 ---------------
211
212 A "color-instance object" is an object describing the way a color
213 specifier is instanced in a particular domain.  Functions such as
214 `face-background-instance' return a color-instance object.  For example,
215
216      (face-background-instance 'default (next-window))
217          => #<color-instance moccasin 47=(FFFF,E4E4,B5B5) 0x678d>
218
219    The color-instance object returned describes the way the background
220 color of the `default' face is displayed in the next window after the
221 selected one.
222
223  - Function: color-instance-p object
224      This function returns non-`nil' if OBJECT is a color-instance.
225
226 \1f
227 File: lispref.info,  Node: Color Instance Properties,  Next: Color Convenience Functions,  Prev: Color Instances,  Up: Colors
228
229 Color Instance Properties
230 -------------------------
231
232  - Function: color-instance-name color-instance
233      This function returns the name used to allocate COLOR-INSTANCE.
234
235  - Function: color-instance-rgb-components color-instance
236      This function returns a three element list containing the red,
237      green, and blue color components of COLOR-INSTANCE.
238
239           (color-instance-rgb-components
240             (face-background-instance 'default (next-window)))
241               => (65535 58596 46517)
242
243 \1f
244 File: lispref.info,  Node: Color Convenience Functions,  Prev: Color Instance Properties,  Up: Colors
245
246 Color Convenience Functions
247 ---------------------------
248
249  - Function: color-name color &optional domain
250      This function returns the name of the COLOR in the specified
251      DOMAIN, if any.  COLOR should be a color specifier object and
252      DOMAIN is normally a window and defaults to the selected window if
253      omitted.  This is equivalent to using `specifier-instance' and
254      applying `color-instance-name' to the result.
255
256  - Function: color-rgb-components color &optional domain
257      This function returns the RGB components of the COLOR in the
258      specified DOMAIN, if any.  COLOR should be a color specifier
259      object and DOMAIN is normally a window and defaults to the
260      selected window if omitted.  This is equivalent to using
261      `specifier-instance' and applying `color-instance-rgb-components'
262      to the result.
263
264           (color-rgb-components (face-background 'default (next-window)))
265               => (65535 58596 46517)
266
267 \1f
268 File: lispref.info,  Node: Glyphs,  Next: Annotations,  Prev: Faces and Window-System Objects,  Up: Top
269
270 Glyphs
271 ******
272
273 A "glyph" is an object that is used for pixmaps, widgets and images of
274 all sorts, as well as for things that "act" like pixmaps, such as
275 non-textual strings ("annotations") displayed in a buffer or in the
276 margins.  It is used in begin-glyphs and end-glyphs attached to
277 extents, marginal and textual annotations, overlay arrows
278 (`overlay-arrow-*' variables), toolbar buttons, mouse pointers, frame
279 icons, truncation and continuation markers, and the like. (Basically,
280 any place there is an image or something that acts like an image, there
281 will be a glyph object representing it.)
282
283    The actual image that is displayed (as opposed to its position or
284 clipping) is defined by an "image specifier" object contained within
285 the glyph.  The separation between an image specifier object and a
286 glyph object is made because the glyph includes other properties than
287 just the actual image: e.g. the face it is displayed in (for text
288 images), the alignment of the image (when it is in a buffer), etc.
289
290  - Function: glyphp object
291      This function returns `t' if OBJECT is a glyph.
292
293 * Menu:
294
295 * Glyph Functions::     Functions for working with glyphs.
296 * Images::              Graphical images displayed in a frame.
297 * Glyph Types::         Each glyph has a particular type.
298 * Mouse Pointer::       Controlling the mouse pointer.
299 * Redisplay Glyphs::    Glyphs controlling various redisplay functions.
300 * Subwindows::          Inserting an externally-controlled subwindow
301                           into a buffer.
302 * Glyph Examples::      Examples of how to work with glyphs.
303
304 \1f
305 File: lispref.info,  Node: Glyph Functions,  Next: Images,  Up: Glyphs
306
307 Glyph Functions
308 ===============
309
310 * Menu:
311
312 * Creating Glyphs::     Creating new glyphs.
313 * Glyph Properties::    Accessing and modifying a glyph's properties.
314 * Glyph Convenience Functions::
315                         Convenience functions for accessing particular
316                           properties of a glyph.
317 * Glyph Dimensions::    Determining the height, width, etc. of a glyph.
318
319 \1f
320 File: lispref.info,  Node: Creating Glyphs,  Next: Glyph Properties,  Up: Glyph Functions
321
322 Creating Glyphs
323 ---------------
324
325  - Function: make-glyph &optional spec-list type
326      This function creates a new glyph object of type TYPE.
327
328      SPEC-LIST is used to initialize the glyph's image.  It is
329      typically an image instantiator (a string or a vector; *Note Image
330      Specifiers::), but can also be a list of such instantiators (each
331      one in turn is tried until an image is successfully produced), a
332      cons of a locale (frame, buffer, etc.) and an instantiator, a list
333      of such conses, or any other form accepted by
334      `canonicalize-spec-list'.  *Note Specifiers::, for more
335      information about specifiers.
336
337      TYPE specifies the type of the glyph, which specifies in which
338      contexts the glyph can be used, and controls the allowable image
339      types into which the glyph's image can be instantiated.  TYPE
340      should be one of `buffer' (used for glyphs in an extent, the
341      modeline, the toolbar, or elsewhere in a buffer), `pointer' (used
342      for the mouse-pointer), or `icon' (used for a frame's icon), and
343      defaults to `buffer'.  *Note Glyph Types::.
344
345      A glyph in XEmacs does *NOT* refer to a single unit of textual
346      display (the XEmacs term for this is "rune"), but rather is an
347      object encapsulating a graphical element, such as an image or
348      widget (an element such as a button or text field; "widget" is the
349      term for this under X Windows, and it's called a "control" under
350      MS Windows).  This graphical element could appear in a buffer, a
351      margin, a gutter, or a toolbar, or as a mouse pointer or an icon,
352      for example.
353
354      Creating a glyph using `make-glyph' does not specify _where_ the
355      glyph will be used, but it does specify _what_ the glyph will look
356      like.  In particular, SPEC-LIST is used to specify this, and it's
357      used to initialize the glyph's `image' property, which is an image
358      specifier. (Note that "image" as used in the context of a glyph's
359      `image' property or in the terms "image specifier", "image
360      instantiator", or "image instance" does not refer to what people
361      normally think of as an image (which in XEmacs is called a
362      "pixmap"), but to any graphical element--a pixmap, a widget, or
363      even a block of text, when used in the places that call for a
364      glyph.)  The format of the SPEC-LIST is typically an image
365      instantiator (a string or a vector; *Note Image Specifiers::), but
366      can also be a list of such instantiators (each one in turn is
367      tried until an image is successfully produced), a cons of a locale
368      (frame, buffer, etc.)  and an instantiator, a list of such conses,
369      or any other form accepted by `canonicalize-spec-list'. *Note
370      Specifiers::, for more information about specifiers.
371
372      If you're not familiar with specifiers, you should be in order to
373      understand how glyphs work.  The clearest introduction to
374      specifiers is in the Lispref manual, available under Info. (Choose
375      Help->Info->Info Contents on the menubar or type C-h i.) You can
376      also see `make-specifier' for a capsule summary.  What's important
377      to keep in mind is that a specifier lets you set a different value
378      for any particular buffer, window, frame, device, or console.
379      This allows for a great deal of flexibility; in particular, only
380      one global glyph needs to exist for a particular purpose (e.g. the
381      icon used to represent an iconified frame, the mouse pointer used
382      over particular areas of a frame, etc.), and in these cases you do
383      not create your own glyph, but rather modify the existing one.
384
385      As well as using SPEC-LIST to initialize the glyph, you can set
386      specifications using `set-glyph-image'.  Note that, due to a
387      possibly questionable historical design decision, a glyph itself
388      is not actually a specifier, but rather is an object containing an
389      image specifier (as well as other, seldom-used properties).
390      Therefore, you cannot set or access specifications for the glyph's
391      image by directly using `set-specifier', `specifier-instance' or
392      the like on the glyph; instead use them on `(glyph-image GLYPH)'
393      or use the convenience functions `set-glyph-image',
394      `glyph-image-instance', and `glyph-image'.
395
396      Once you have created a glyph, you specify where it will be used as
397      follows:
398
399         * To insert a glyph into a buffer, create an extent in the
400           buffer and then use `set-extent-begin-glyph' or
401           `set-extent-end-glyph' to set a glyph to be displayed at the
402           corresponding edge of the extent. (It is common to create
403           zero-width extents for this purpose.)
404
405         * To insert a glyph into the left or right margin of a buffer,
406           first make sure the margin is visible by setting a value for
407           the specifiers `left-margin-width' or `right-margin-width'.
408           (Not strictly necessary when using margin glyphs with layout
409           policy `whitespace'.) Then follow the same procedure above
410           for inserting a glyph in a buffer, and then set a non-default
411           layout policy for the glyph using
412           `set-extent-begin-glyph-layout' or
413           `set-extent-end-glyph-layout'.  Alternatively, use the
414           high-level annotations API (see `make-annotation'). (In point
415           of fact, you can also use the annotations API for glyphs in a
416           buffer, by setting a layout policy of `text'.)
417
418         * To insert a glyph into the modeline, just put the glyph
419           directly as one of the modeline elements. (Unfortunately you
420           can't currently put a begin glyph or end glyph on one of the
421           modeline extents--they're ignored.)
422
423         * To insert a glyph into a toolbar, specify it as part of a
424           toolbar instantiator (typically set on the specifier
425           `default-toolbar').  See `default-toolbar' for more
426           information. (Note that it is standard practice to use a
427           symbol in place of the glyph list in the toolbar
428           instantiator; the symbol is evalled to get the glyph list.
429           This facilitates both creating the toolbar instantiator and
430           modifying individual glyphs in a toolbar later on.  For
431           example, you can change the way that the Mail toolbar button
432           looks by modifying the value of the variable
433           `toolbar-mail-icon' (in general, `toolbar-*-icon') and then
434           calling `(set-specifier-dirty-flag default-toolbar)'.  (####
435           Unfortunately this doesn't quite work the way it should; the
436           change will appear in new frames, but not existing ones.
437
438         * To insert a glyph into a gutter, create or modify a gutter
439           instantiator (typically set on the specifier
440           `default-gutter').  Gutter instantiators consist of strings
441           or lists of strings, so to insert a glyph, create an extent
442           over the string, and use `set-extent-begin-glyph' or
443           `set-extent-end-glyph' to set a glyph to be displayed at the
444           corresponding edge of the extent, just like for glyphs in a
445           buffer.
446
447         * To use a glyph as the icon for a frame, you do not actually
448           create a new glyph; rather, you change the specifications for
449           the existing glyph `frame-icon-glyph'. (Remember that,
450           because of the specifier nature of glyphs, you can set
451           different values for any particular buffer or frame.)
452
453         * To use a glyph as the mouse pointer, in general you do not
454           create a new glyph, but rather you change the specifications
455           of various existing glyphs, such as `text-pointer-glyph' for
456           the pointer used over text, `modeline-pointer-glyph' for the
457           pointer used over the modeline, etc.  Do an apropos over
458           `*-pointer-glyph' to find all of them. (Note also that you
459           can temporarily set the mouse pointer to some specific shape
460           by using `set-frame-pointer', which takes an image instance,
461           as obtained from calling `glyph-image-instance' on a glyph of
462           type `pointer' - either one of the above-mentioned variables
463           or one you created yourself.  (See below for what it means to
464           create a glyph of type `pointer'.)  This pointer will last
465           only until the next mouse motion event is processed or
466           certain other things happen, such as creating or deleting a
467           window. (In fact, the above-mentioned pointer glyph variables
468           are implemented as part of the default handler for mouse
469           motion events.  If you want to customize this behavior, take a
470           look at `mode-motion-hook', or `mouse-motion-handler' if you
471           really want to get low-level.)
472
473         * To use a glyph to control the shape of miscellaneous
474           redisplay effects such as the truncation and continuation
475           markers, set the appropriate existing glyph variables, as for
476           icons and pointers above.  See `continuation-glyph',
477           `control-arrow-glyph', `hscroll-glyph',
478           `invisible-text-glyph', `octal-escape-glyph', and
479           `truncation-glyph'.  See also `overlay-arrow-string', an odd
480           redisplay leftover which can be set to a glyph you created,
481           and will cause the glyph to be displayed on top of the text
482           position specified in the marker stored in
483           `overlay-arrow-position'.
484
485         * To use a glyph in a display table (i.e. to control the
486           appearance of any individual character), create the
487           appropriate character glyphs and then set a specification for
488           the specifier `current-display-table', which controls the
489           appearance of characters.  You can also set an overriding
490           display table for use with text displayed in a particular
491           face; see `set-face-display-table' and `make-display-table'.
492           #### Note: Display tables do not currently support general
493           Mule characters.  They will be overhauled at some point to
494           support this and to provide other features required under
495           Mule.
496
497         * To use a glyph as the background pixmap of a face: Note that
498           the background pixmap of a face is actually an image
499           specifier - probably the only place in XEmacs where an image
500           specifier occurs outside of a glyph.  Similarly to how the
501           glyph's image specifier works, you don't create your own
502           image specifier, but rather add specifications to the
503           existing one (using `set-face-background-pixmap').  Note that
504           the image instance that is generated in order to actually
505           display the background pixmap is of type `mono-pixmap',
506           meaning that it's a two-color image and the foreground and
507           background of the image get filled in with the corresponding
508           colors from the face.
509
510      It is extremely rare that you will ever have to specify a value for
511      TYPE, which should be one of `buffer' (used for glyphs in an
512      extent, the modeline, the toolbar, or elsewhere in a buffer),
513      `pointer' (used for the mouse-pointer), or `icon' (used for a
514      frame's icon), and defaults to `buffer'.  The only cases where it
515      needs to be specified is when creating icon or pointer glyphs, and
516      in both cases the necessary glyphs have already been created at
517      startup and are accessed through the appropriate variables, e.g.
518      `text-pointer-glyph' (or in general, `*-pointer-glyph') and
519      `frame-icon-glyph'.  *Note Glyph Types::.
520
521  - Function: make-glyph-internal &optional type
522      This function creates a new, uninitialized glyph of type TYPE.
523
524  - Function: make-pointer-glyph &optional spec-list
525      Return a new `pointer-glyph' object with the specification list
526      SPEC-LIST.  This function is equivalent to calling `make-glyph'
527      with a TYPE of `pointer'.
528
529      It is extremely unlikely that you will ever need to create a
530      pointer glyph.  Instead, you probably want to be calling
531      `set-glyph-image' on an existing glyph, e.g. `text-pointer-glyph'.
532
533  - Function: make-icon-glyph &optional spec-list
534      Return a new `pointer-glyph' object with the specification list
535      SPEC-LIST.  This function is equivalent to calling `make-glyph'
536      with a TYPE of `icon'.
537
538      It is extremely unlikely that you will ever need to create a
539      pointer glyph.  Instead, you probably want to be calling
540      `set-glyph-image' on an existing glyph, e.g. `text-pointer-glyph'.
541
542 \1f
543 File: lispref.info,  Node: Glyph Properties,  Next: Glyph Convenience Functions,  Prev: Creating Glyphs,  Up: Glyph Functions
544
545 Glyph Properties
546 ----------------
547
548 Each glyph has a list of properties, which control all of the aspects of
549 the glyph's appearance.  The following symbols have predefined meanings:
550
551 `image'
552      The image used to display the glyph.
553
554 `baseline'
555      Percent above baseline that glyph is to be displayed.  Only for
556      glyphs displayed inside of a buffer.
557
558 `contrib-p'
559      Whether the glyph contributes to the height of the line it's on.
560      Only for glyphs displayed inside of a buffer.
561
562 `face'
563      Face of this glyph (_not_ a specifier).
564
565  - Function: set-glyph-property glyph property value &optional locale
566           tag-set how-to-add
567      This function changes a property of a GLYPH.
568
569      For built-in properties, the actual value of the property is a
570      specifier and you cannot change this; but you can change the
571      specifications within the specifier, and that is what this
572      function will do.  For user-defined properties, you can use this
573      function to either change the actual value of the property or, if
574      this value is a specifier, change the specifications within it.
575
576      If PROPERTY is a built-in property, the specifications to be added
577      to this property can be supplied in many different ways:
578
579         * If VALUE is a simple instantiator (e.g. a string naming a
580           pixmap filename) or a list of instantiators, then the
581           instantiator(s) will be added as a specification of the
582           property for the given LOCALE (which defaults to `global' if
583           omitted).
584
585         * If VALUE is a list of specifications (each of which is a cons
586           of a locale and a list of instantiators), then LOCALE must be
587           `nil' (it does not make sense to explicitly specify a locale
588           in this case), and specifications will be added as given.
589
590         * If VALUE is a specifier (as would be returned by
591           `glyph-property' if no LOCALE argument is given), then some
592           or all of the specifications in the specifier will be added
593           to the property.  In this case, the function is really
594           equivalent to `copy-specifier' and LOCALE has the same
595           semantics (if it is a particular locale, the specification
596           for the locale will be copied; if a locale type,
597           specifications for all locales of that type will be copied;
598           if `nil' or `all', then all specifications will be copied).
599
600      HOW-TO-ADD should be either `nil' or one of the symbols `prepend',
601      `append', `remove-tag-set-prepend', `remove-tag-set-append',
602      `remove-locale', `remove-locale-type', or `remove-all'.  See
603      `copy-specifier' and `add-spec-to-specifier' for a description of
604      what each of these means.  Most of the time, you do not need to
605      worry about this argument; the default behavior usually is fine.
606
607      In general, it is OK to pass an instance object (e.g. as returned
608      by `glyph-property-instance') as an instantiator in place of an
609      actual instantiator.  In such a case, the instantiator used to
610      create that instance object will be used (for example, if you set
611      a font-instance object as the value of the `font' property, then
612      the font name used to create that object will be used instead).
613      If some cases, however, doing this conversion does not make sense,
614      and this will be noted in the documentation for particular types
615      of instance objects.
616
617      If PROPERTY is not a built-in property, then this function will
618      simply set its value if LOCALE is `nil'.  However, if LOCALE is
619      given, then this function will attempt to add VALUE as the
620      instantiator for the given LOCALE, using `add-spec-to-specifier'.
621      If the value of the property is not a specifier, it will
622      automatically be converted into a `generic' specifier.
623
624  - Function: glyph-property glyph property &optional locale
625      This function returns GLYPH's value of the given PROPERTY.
626
627      If LOCALE is omitted, the GLYPH's actual value for PROPERTY will
628      be returned.  For built-in properties, this will be a specifier
629      object of a type appropriate to the property (e.g. a font or color
630      specifier).  For other properties, this could be anything.
631
632      If LOCALE is supplied, then instead of returning the actual value,
633      the specification(s) for the given locale or locale type will be
634      returned.  This will only work if the actual value of PROPERTY is
635      a specifier (this will always be the case for built-in properties,
636      but may or may not apply to user-defined properties).  If the
637      actual value of PROPERTY is not a specifier, this value will
638      simply be returned regardless of LOCALE.
639
640      The return value will be a list of instantiators (e.g. vectors
641      specifying pixmap data), or a list of specifications, each of
642      which is a cons of a locale and a list of instantiators.
643      Specifically, if LOCALE is a particular locale (a buffer, window,
644      frame, device, or `global'), a list of instantiators for that
645      locale will be returned.  Otherwise, if LOCALE is a locale type
646      (one of the symbols `buffer', `window', `frame', or `device'), the
647      specifications for all locales of that type will be returned.
648      Finally, if LOCALE is `all', the specifications for all locales of
649      all types will be returned.
650
651      The specifications in a specifier determine what the value of
652      PROPERTY will be in a particular "domain" or set of circumstances,
653      which is typically a particular Emacs window along with the buffer
654      it contains and the frame and device it lies within.  The value is
655      derived from the instantiator associated with the most specific
656      locale (in the order buffer, window, frame, device, and `global')
657      that matches the domain in question.  In other words, given a
658      domain (i.e. an Emacs window, usually), the specifier for PROPERTY
659      will first be searched for a specification whose locale is the
660      buffer contained within that window; then for a specification
661      whose locale is the window itself; then for a specification whose
662      locale is the frame that the window is contained within; etc.  The
663      first instantiator that is valid for the domain (usually this
664      means that the instantiator is recognized by the device [i.e. the
665      X server or TTY device] that the domain is on).  The function
666      `glyph-property-instance' actually does all this, and is used to
667      determine how to display the glyph.
668
669  - Function: glyph-property-instance glyph property &optional domain
670           default no-fallback
671      This function returns the instance of GLYPH's PROPERTY in the
672      specified DOMAIN.
673
674      Under most circumstances, DOMAIN will be a particular window, and
675      the returned instance describes how the specified property
676      actually is displayed for that window and the particular buffer in
677      it.  Note that this may not be the same as how the property
678      appears when the buffer is displayed in a different window or
679      frame, or how the property appears in the same window if you
680      switch to another buffer in that window; and in those cases, the
681      returned instance would be different.
682
683      The returned instance is an image-instance object, and you can
684      query it using the appropriate image instance functions.  For
685      example, you could use `image-instance-depth' to find out the
686      depth (number of color planes) of a pixmap displayed in a
687      particular window.  The results might be different from the
688      results you would get for another window (perhaps the user
689      specified a different image for the frame that window is on; or
690      perhaps the same image was specified but the window is on a
691      different X server, and that X server has different color
692      capabilities from this one).
693
694      DOMAIN defaults to the selected window if omitted.
695
696      DOMAIN can be a frame or device, instead of a window.  The value
697      returned for such a domain is used in special circumstances when a
698      more specific domain does not apply; for example, a frame value
699      might be used for coloring a toolbar, which is conceptually
700      attached to a frame rather than a particular window.  The value is
701      also useful in determining what the value would be for a
702      particular window within the frame or device, if it is not
703      overridden by a more specific specification.
704
705      If PROPERTY does not name a built-in property, its value will
706      simply be returned unless it is a specifier object, in which case
707      it will be instanced using `specifier-instance'.
708
709      Optional arguments DEFAULT and NO-FALLBACK are the same as in
710      `specifier-instance'.  *Note Specifiers::.
711
712  - Function: remove-glyph-property glyph property &optional locale
713           tag-set exact-p
714      This function removes a property from a glyph.  For built-in
715      properties, this is analogous to `remove-specifier'.  *Note
716      remove-specifier-p: Specifiers, for the meaning of the LOCALE,
717      TAG-SET, and EXACT-P arguments.
718
719 \1f
720 File: lispref.info,  Node: Glyph Convenience Functions,  Next: Glyph Dimensions,  Prev: Glyph Properties,  Up: Glyph Functions
721
722 Glyph Convenience Functions
723 ---------------------------
724
725 The following functions are provided for working with specific
726 properties of a glyph.  Note that these are exactly like calling the
727 general functions described above and passing in the appropriate value
728 for PROPERTY.
729
730    Remember that if you want to determine the "value" of a specific
731 glyph property, you probably want to use the `*-instance' functions.
732 For example, to determine whether a glyph contributes to its line
733 height, use `glyph-contrib-p-instance', not `glyph-contrib-p'. (The
734 latter will return a boolean specifier or a list of specifications, and
735 you probably aren't concerned with these.)
736
737  - Function: glyph-image glyph &optional locale
738      This function is equivalent to calling `glyph-property' with a
739      property of `image'.  The return value will be an image specifier
740      if LOCALE is `nil' or omitted; otherwise, it will be a
741      specification or list of specifications.
742
743  - Function: set-glyph-image glyph spec &optional locale tag-set
744           how-to-add
745      This function is equivalent to calling `set-glyph-property' with a
746      property of `image'.
747
748  - Function: glyph-image-instance glyph &optional domain default
749           no-fallback
750      This function returns the instance of GLYPH's image in the given
751      DOMAIN, and is equivalent to calling `glyph-property-instance'
752      with a property of `image'.  The return value will be an image
753      instance.
754
755      Normally DOMAIN will be a window or `nil' (meaning the selected
756      window), and an instance object describing how the image appears
757      in that particular window and buffer will be returned.
758
759  - Function: glyph-contrib-p glyph &optional locale
760      This function is equivalent to calling `glyph-property' with a
761      property of `contrib-p'.  The return value will be a boolean
762      specifier if LOCALE is `nil' or omitted; otherwise, it will be a
763      specification or list of specifications.
764
765  - Function: set-glyph-contrib-p glyph spec &optional locale tag-set
766           how-to-add
767      This function is equivalent to calling `set-glyph-property' with a
768      property of `contrib-p'.
769
770  - Function: glyph-contrib-p-instance glyph &optional domain default
771           no-fallback
772      This function returns whether the glyph contributes to its line
773      height in the given DOMAIN, and is equivalent to calling
774      `glyph-property-instance' with a property of `contrib-p'.  The
775      return value will be either `nil' or `t'. (Normally DOMAIN will be
776      a window or `nil', meaning the selected window.)
777
778  - Function: glyph-baseline glyph &optional locale
779      This function is equivalent to calling `glyph-property' with a
780      property of `baseline'.  The return value will be a specifier if
781      LOCALE is `nil' or omitted; otherwise, it will be a specification
782      or list of specifications.
783
784  - Function: set-glyph-baseline glyph spec &optional locale tag-set
785           how-to-add
786      This function is equivalent to calling `set-glyph-property' with a
787      property of `baseline'.
788
789  - Function: glyph-baseline-instance glyph &optional domain default
790           no-fallback
791      This function returns the instance of GLYPH's baseline value in
792      the given DOMAIN, and is equivalent to calling
793      `glyph-property-instance' with a property of `baseline'.  The
794      return value will be an integer or `nil'.
795
796      Normally DOMAIN will be a window or `nil' (meaning the selected
797      window), and an instance object describing the baseline value
798      appears in that particular window and buffer will be returned.
799
800  - Function: glyph-face glyph
801      This function returns the face of GLYPH. (Remember, this is not a
802      specifier, but a simple property.)
803
804  - Function: set-glyph-face glyph face
805      This function changes the face of GLYPH to FACE.
806
807 \1f
808 File: lispref.info,  Node: Glyph Dimensions,  Prev: Glyph Convenience Functions,  Up: Glyph Functions
809
810 Glyph Dimensions
811 ----------------
812
813  - Function: glyph-width glyph &optional window
814      This function returns the width of GLYPH on WINDOW.  This may not
815      be exact as it does not take into account all of the context that
816      redisplay will.
817
818  - Function: glyph-ascent glyph &optional window
819      This function returns the ascent value of GLYPH on WINDOW.  This
820      may not be exact as it does not take into account all of the
821      context that redisplay will.
822
823  - Function: glyph-descent glyph &optional window
824      This function returns the descent value of GLYPH on WINDOW.  This
825      may not be exact as it does not take into account all of the
826      context that redisplay will.
827
828  - Function: glyph-height glyph &optional window
829      This function returns the height of GLYPH on WINDOW.  (This is
830      equivalent to the sum of the ascent and descent values.)  This may
831      not be exact as it does not take into account all of the context
832      that redisplay will.
833
834 \1f
835 File: lispref.info,  Node: Images,  Next: Glyph Types,  Prev: Glyph Functions,  Up: Glyphs
836
837 Images
838 ======
839
840 * Menu:
841
842 * Image Specifiers::            Specifying how an image will appear.
843 * Image Instantiator Conversion::
844                                 Conversion is applied to image instantiators
845                                   at the time they are added to an
846                                   image specifier or at the time they
847                                   are passed to `make-image-instance'.
848 * Image Instances::             What an image specifier gets instanced as.
849
850 \1f
851 File: lispref.info,  Node: Image Specifiers,  Next: Image Instantiator Conversion,  Up: Images
852
853 Image Specifiers
854 ----------------
855
856 An image specifier is used to describe the actual image of a glyph.  It
857 works like other specifiers (*note Specifiers::), in that it contains a
858 number of specifications describing how the image should appear in a
859 variety of circumstances.  These specifications are called "image
860 instantiators".  When XEmacs wants to display the image, it instantiates
861 the image into an "image instance".  Image instances are their own
862 primitive object type (similar to font instances and color instances),
863 describing how the image appears in a particular domain. (On the other
864 hand, image instantiators, which are just descriptions of how the image
865 should appear, are represented using strings or vectors.)
866
867  - Function: image-specifier-p object
868      This function returns non-`nil' if OBJECT is an image specifier.
869      Usually, an image specifier results from calling `glyph-image' on
870      a glyph.
871
872  - Function: make-image-specifier spec-list
873      This function creates a new image specifier object and initializes
874      it according to SPEC-LIST. *Note Specifiers::.
875
876      Note that, in practice, you rarely, if ever, need to actually
877      create an image specifier! (This function exists mainly for
878      completeness.) Pretty much the only use for image specifiers is to
879      control how glyphs are displayed, and the image specifier
880      associated with a glyph (the `image' property of a glyph) is
881      created automatically when a glyph is created and need not (and
882      cannot, for that matter) ever be changed (*note Glyphs::).  In
883      fact, the design decision to create a separate image specifier
884      type, rather than make glyphs themselves be specifiers, is
885      debatable--the other properties of glyphs are rarely used and could
886      conceivably have been incorporated into the glyph's instantiator.
887      The rarely used glyph types (buffer, pointer, icon) could also
888      have been incorporated into the instantiator.
889
890    Image instantiators come in many formats: `xbm', `xpm', `gif',
891 `jpeg', etc.  This describes the format of the data describing the
892 image.  The resulting image instances also come in many
893 types--`mono-pixmap', `color-pixmap', `text', `pointer', etc.  This
894 refers to the behavior of the image and the sorts of places it can
895 appear. (For example, a color-pixmap image has fixed colors specified
896 for it, while a mono-pixmap image comes in two unspecified shades
897 "foreground" and "background" that are determined from the face of the
898 glyph or surrounding text; a text image appears as a string of text and
899 has an unspecified foreground, background, and font; a pointer image
900 behaves like a mono-pixmap image but can only be used as a mouse
901 pointer [mono-pixmap images cannot be used as mouse pointers]; etc.) It
902 is important to keep the distinction between image instantiator format
903 and image instance type in mind.  Typically, a given image instantiator
904 format can result in many different image instance types (for example,
905 `xpm' can be instanced as `color-pixmap', `mono-pixmap', or `pointer';
906 whereas `cursor-font' can be instanced only as `pointer'), and a
907 particular image instance type can be generated by many different image
908 instantiator formats (e.g.  `color-pixmap' can be generated by `xpm',
909 `gif', `jpeg', etc.).
910
911    *Note Image Instances::, for a more detailed discussion of image
912 instance types.
913
914    An image instantiator should be a string or a vector of the form
915
916       `[FORMAT :KEYWORD VALUE ...]'
917
918    i.e. a format symbol followed by zero or more alternating
919 keyword-value pairs.  The "format" field should be a symbol, one of
920
921 `nothing'
922      Don't display anything; no keywords are valid for this.  Can only
923      be instanced as `nothing'.
924
925 `string'
926      Display this image as a text string.  Can only be instanced as
927      `text', although support for instancing as `mono-pixmap' should be
928      added.
929
930 `formatted-string'
931      Display this image as a text string with replaceable fields,
932      similar to a modeline format string; not currently implemented.
933
934 `xbm'
935      An X bitmap; only if X support was compiled into this XEmacs.  Can
936      be instanced as `mono-pixmap', `color-pixmap', or `pointer'.
937
938 `xpm'
939      An XPM pixmap; only if XPM support was compiled into this XEmacs.
940      Can be instanced as `color-pixmap', `mono-pixmap', or `pointer'.
941      XPM is an add-on library for X that was designed to rectify the
942      shortcomings of the XBM format.  Most implementations of X include
943      the XPM library as a standard part.  If your vendor does not, it
944      is highly recommended that you download it and install it.  You
945      can get it from the standard XEmacs FTP site, among other places.
946
947 `xface'
948      An X-Face bitmap, used to encode people's faces in e-mail messages;
949      only if X-Face support was compiled into this XEmacs.  Can be
950      instanced as `mono-pixmap', `color-pixmap', or `pointer'.
951
952 `gif'
953      A GIF87 or GIF89 image; only if GIF support was compiled into this
954      XEmacs.  Can be instanced as `color-pixmap'.  Note that XEmacs
955      includes GIF decoding functions as a standard part of it, so if
956      you have X support, you will normally have GIF support, unless you
957      explicitly disable it at configure time.
958
959 `jpeg'
960      A JPEG-format image; only if JPEG support was compiled into this
961      XEmacs.  Can be instanced as `color-pixmap'.  If you have the JPEG
962      libraries present on your system when XEmacs is built, XEmacs will
963      automatically detect this and use them, unless you explicitly
964      disable it at configure time.
965
966 `png'
967      A PNG/GIF24 image; only if PNG support was compiled into this
968      XEmacs.  Can be instanced as `color-pixmap'.
969
970 `tiff'
971      A TIFF-format image; only if TIFF support was compiled into this
972      XEmacs.
973
974 `cursor-font'
975      One of the standard cursor-font names, such as `watch' or
976      `right_ptr' under X.  Under X, this is, more specifically, any of
977      the standard cursor names from appendix B of the Xlib manual [also
978      known as the file `<X11/cursorfont.h>'] minus the `XC_' prefix.  On
979      other window systems, the valid names will be specific to the type
980      of window system.  Can only be instanced as `pointer'.
981
982 `font'
983      A glyph from a font; i.e. the name of a font, and glyph index into
984      it of the form `FONT fontname index [[mask-font] mask-index]'.
985      Only if X support was compiled into this XEmacs.  Currently can
986      only be instanced as `pointer', although this should probably be
987      fixed.
988
989 `mswindows-resource'
990      An MS Windows pointer resource.  Specifies a resource to retrieve
991      directly from the system (an OEM resource) or from a file,
992      particularly an executable file.  If the resource is to be
993      retrieved from a file, use :file and optionally :resource-id.
994      Otherwise use :resource-id.  Always specify :resource-type to
995      specify the type (cursor, bitmap or icon) of the resource.
996      Possible values for :resource-id are listed below.  Can be
997      instanced as `pointer' or `color-pixmap'.
998
999 `subwindow'
1000      An embedded windowing system window.  Can only be instanced as
1001      `subwindow'.
1002
1003 `button'
1004      A button widget; either a push button, radio button or toggle
1005      button.  Can only be instanced as `widget'.
1006
1007 `combo-box'
1008      A drop list of selectable items in a widget, for editing text.
1009      Can only be instanced as `widget'.
1010
1011 `edit-field'
1012      A text editing widget.  Can only be instanced as `widget'.
1013
1014 `label'
1015      A static, text-only, widget; for displaying text.  Can only be
1016      instanced as `widget'.
1017
1018 `layout'
1019      A widget for controlling the positioning of children underneath it.
1020      Through the use of nested layouts, a widget hierarchy can be
1021      created which can have the appearance of any standard dialog box
1022      or similar arrangement; all of this is counted as one "glyph" and
1023      could appear in many of the places that expect a single glyph.
1024      Can only be instanced as `widget'.
1025
1026 `native-layout'
1027      The native version of a layout widget.  Can only be instanced as
1028      `widget'.
1029
1030 `progress-gauge'
1031      A sliding widget, for showing progress.  Can only be instanced as
1032      `widget'.
1033
1034 `tab-control'
1035      A tab widget; a series of user selectable tabs.  Can only be
1036      instanced as `widget'.
1037
1038 `tree-view'
1039      A folding widget.  Can only be instanced as `widget'.
1040
1041 `scrollbar'
1042      A scrollbar widget.  Can only be instanced as `widget'.
1043
1044 `autodetect'
1045      XEmacs tries to guess what format the data is in.  If X support
1046      exists, the data string will be checked to see if it names a
1047      filename.  If so, and this filename contains XBM or XPM data, the
1048      appropriate sort of pixmap or pointer will be created. [This
1049      includes picking up any specified hotspot or associated mask
1050      file.] Otherwise, if `pointer' is one of the allowable
1051      image-instance types and the string names a valid cursor-font
1052      name, the image will be created as a pointer.  Otherwise, the
1053      image will be displayed as text.  If no X support exists, the
1054      image will always be displayed as text.
1055
1056 `inherit'
1057      Inherit from the background-pixmap property of a face.  Can only be
1058      instanced as `mono-pixmap'.
1059
1060    The valid keywords are:
1061
1062 `:data'
1063      Inline data.  For most formats above, this should be a string.  For
1064      XBM images, this should be a list of three elements: width,
1065      height, and a string of bit data.  This keyword is not valid for
1066      instantiator format `nothing'.
1067
1068 `:file'
1069      Data is contained in a file.  The value is the name of this file.
1070      If both `:data' and `:file' are specified, the image is created
1071      from what is specified in `:data' and the string in `:file'
1072      becomes the value of the `image-instance-file-name' function when
1073      applied to the resulting image-instance.  This keyword is not
1074      valid for instantiator formats `nothing', `string',
1075      `formatted-string', `cursor-font', `font', and `autodetect'.
1076
1077 `:foreground'
1078 `:background'
1079      For `xbm', `xface', `cursor-font', and `font'.  These keywords
1080      allow you to explicitly specify foreground and background colors.
1081      The argument should be anything acceptable to
1082      `make-color-instance'.  This will cause what would be a
1083      `mono-pixmap' to instead be colorized as a two-color color-pixmap,
1084      and specifies the foreground and/or background colors for a pointer
1085      instead of black and white.
1086
1087 `:mask-data'
1088      For `xbm' and `xface'.  This specifies a mask to be used with the
1089      bitmap.  The format is a list of width, height, and bits, like for
1090      `:data'.
1091
1092 `:mask-file'
1093      For `xbm' and `xface'.  This specifies a file containing the mask
1094      data.  If neither a mask file nor inline mask data is given for an
1095      XBM image, and the XBM image comes from a file, XEmacs will look
1096      for a mask file with the same name as the image file but with
1097      `Mask' or `msk' appended.  For example, if you specify the XBM file
1098      `left_ptr' [usually located in `/usr/include/X11/bitmaps'], the
1099      associated mask file `left_ptrmsk' will automatically be picked up.
1100
1101 `:hotspot-x'
1102 `:hotspot-y'
1103      For `xbm' and `xface'.  These keywords specify a hotspot if the
1104      image is instantiated as a `pointer'.  Note that if the XBM image
1105      file specifies a hotspot, it will automatically be picked up if no
1106      explicit hotspot is given.
1107
1108 `:color-symbols'
1109      Only for `xpm'.  This specifies an alist that maps strings that
1110      specify symbolic color names to the actual color to be used for
1111      that symbolic color (in the form of a string or a color-specifier
1112      object).  If this is not specified, the contents of
1113      `xpm-color-symbols' are used to generate the alist.
1114
1115 `:resource-id'
1116      Only for `mswindows-resource'.  This must be either an integer
1117      (which directly specifies a resource number) or a string.  Valid
1118      strings are
1119
1120      For bitmaps:
1121
1122      "close", "uparrow", "dnarrow", "rgarrow", "lfarrow", "reduce",
1123      "zoom", "restore", "reduced", "zoomd", "restored", "uparrowd",
1124      "dnarrowd", "rgarrowd", "lfarrowd", "mnarrow", "combo",
1125      "uparrowi", "dnarrowi", "rgarrowi", "lfarrowi", "size", "btsize",
1126      "check", "checkboxes", and "btncorners".
1127
1128      For cursors:
1129
1130      "normal", "ibeam", "wait", "cross", "up", "sizenwse", "sizenesw",
1131      "sizewe", "sizens", "sizeall", and "no".
1132
1133      For icons:
1134
1135      "sample", "hand", "ques", "bang", "note", and "winlogo".
1136
1137 `:resource-type'
1138      Only for `mswindows-resource'.  This must be a symbol, either
1139      `cursor', `icon', or `bitmap', specifying the type of resource to
1140      be retrieved.
1141
1142 `:face'
1143      Only for `inherit'.  This specifies the face to inherit from.  For
1144      widgets this also specifies the face to use for display. It
1145      defaults to gui-element-face.
1146
1147    Keywords accepted as menu item specs are also accepted by widgets.
1148 These are `:selected', `:active', `:suffix', `:keys', `:style',
1149 `:filter', `:config', `:included', `:key-sequence', `:accelerator',
1150 `:label' and `:callback'.
1151
1152    If instead of a vector, the instantiator is a string, it will be
1153 converted into a vector by looking it up according to the specs in the
1154 `console-type-image-conversion-list' for the console type of the domain
1155 (usually a window; sometimes a frame or device) over which the image is
1156 being instantiated.
1157
1158    If the instantiator specifies data from a file, the data will be
1159 read in at the time that the instantiator is added to the image
1160 specifier (which may be well before the image is actually displayed),
1161 and the instantiator will be converted into one of the inline-data
1162 forms, with the filename retained using a `:file' keyword.  This
1163 implies that the file must exist when the instantiator is added to the
1164 image, but does not need to exist at any other time (e.g. it may safely
1165 be a temporary file).
1166
1167  - Function: valid-image-instantiator-format-p format &optional locale
1168      This function returns non-`nil' if FORMAT is a valid image
1169      instantiator format.
1170
1171      If LOCALE is non-`nil' then the format is checked in that locale.
1172      If LOCALE is `nil' the current console is used.
1173
1174      Note that the return value for many formats listed above depends on
1175      whether XEmacs was compiled with support for that format.
1176
1177  - Function: image-instantiator-format-list
1178      This function return a list of valid image-instantiator formats.
1179
1180  - Variable: xpm-color-symbols
1181      This variable holds definitions of logical color-names used when
1182      reading XPM files.  Elements of this list should be of the form
1183      `(COLOR-NAME FORM-TO-EVALUATE)'.  The COLOR-NAME should be a
1184      string, which is the name of the color to define; the
1185      FORM-TO-EVALUATE should evaluate to a color specifier object, or a
1186      string to be passed to `make-color-instance' (*note Colors::).  If
1187      a loaded XPM file references a symbolic color called COLOR-NAME,
1188      it will display as the computed color instead.
1189
1190      The default value of this variable defines the logical color names
1191      `"foreground"' and `"background"' to be the colors of the
1192      `default' face.
1193
1194  - Variable: x-bitmap-file-path
1195      A list of the directories in which X bitmap files may be found.
1196      If `nil', this is initialized from the `"*bitmapFilePath"'
1197      resource.  This is used by the `make-image-instance' function
1198      (however, note that if the environment variable `XBMLANGPATH' is
1199      set, it is consulted first).
1200
1201 \1f
1202 File: lispref.info,  Node: Image Instantiator Conversion,  Next: Image Instances,  Prev: Image Specifiers,  Up: Images
1203
1204 Image Instantiator Conversion
1205 -----------------------------
1206
1207  - Function: set-console-type-image-conversion-list console-type list
1208      This function sets the image-conversion-list for consoles of the
1209      given CONSOLE-TYPE.  The image-conversion-list specifies how image
1210      instantiators that are strings should be interpreted.  Each
1211      element of the list should be a list of two elements (a regular
1212      expression string and a vector) or a list of three elements (the
1213      preceding two plus an integer index into the vector).  The string
1214      is converted to the vector associated with the first matching
1215      regular expression.  If a vector index is specified, the string
1216      itself is substituted into that position in the vector.
1217
1218      Note: The conversion above is applied when the image instantiator
1219      is added to an image specifier, not when the specifier is actually
1220      instantiated.  Therefore, changing the image-conversion-list only
1221      affects newly-added instantiators.  Existing instantiators in
1222      glyphs and image specifiers will not be affected.
1223
1224  - Function: console-type-image-conversion-list console-type
1225      This function returns the image-conversion-list for consoles of
1226      the given CONSOLE-TYPE.
1227
1228 \1f
1229 File: lispref.info,  Node: Image Instances,  Prev: Image Instantiator Conversion,  Up: Images
1230
1231 Image Instances
1232 ---------------
1233
1234 Image-instance objects encapsulate the way a particular image (pixmap,
1235 etc.) is displayed on a particular device.
1236
1237    In most circumstances, you do not need to directly create image
1238 instances; use a glyph instead.  However, it may occasionally be useful
1239 to explicitly create image instances, if you want more control over the
1240 instantiation process.
1241
1242  - Function: image-instance-p object
1243      This function returns non-`nil' if OBJECT is an image instance.
1244
1245 * Menu:
1246
1247 * Image Instance Types::         Each image instances has a particular type.
1248 * Image Instance Functions::     Functions for working with image instances.
1249
1250 \1f
1251 File: lispref.info,  Node: Image Instance Types,  Next: Image Instance Functions,  Up: Image Instances
1252
1253 Image Instance Types
1254 ....................
1255
1256 Image instances come in a number of different types.  The type of an
1257 image instance specifies the nature of the image: Whether it is a text
1258 string, a mono pixmap, a color pixmap, etc.
1259
1260    The valid image instance types are
1261
1262 `nothing'
1263      Nothing is displayed.
1264
1265 `text'
1266      Displayed as text.  The foreground and background colors and the
1267      font of the text are specified independent of the pixmap.
1268      Typically these attributes will come from the face of the
1269      surrounding text, unless a face is specified for the glyph in
1270      which the image appears.
1271
1272 `mono-pixmap'
1273      Displayed as a mono pixmap (a pixmap with only two colors where the
1274      foreground and background can be specified independent of the
1275      pixmap; typically the pixmap assumes the foreground and background
1276      colors of the text around it, unless a face is specified for the
1277      glyph in which the image appears).
1278
1279 `color-pixmap'
1280      Displayed as a color pixmap.
1281
1282 `pointer'
1283      Used as the mouse pointer for a window.
1284
1285 `subwindow'
1286      A child window that is treated as an image.  This allows (e.g.)
1287      another program to be responsible for drawing into the window.
1288      Not currently implemented.
1289
1290  - Function: valid-image-instance-type-p type
1291      This function returns non-`nil' if TYPE is a valid image instance
1292      type.
1293
1294  - Function: image-instance-type-list
1295      This function returns a list of the valid image instance types.
1296
1297  - Function: image-instance-type image-instance
1298      This function returns the type of the given image instance.  The
1299      return value will be one of `nothing', `text', `mono-pixmap',
1300      `color-pixmap', `pointer', or `subwindow'.
1301
1302  - Function: text-image-instance-p object
1303      This function returns non-`nil' if OBJECT is an image instance of
1304      type `text'.
1305
1306  - Function: mono-pixmap-image-instance-p object
1307      This function returns non-`nil' if OBJECT is an image instance of
1308      type `mono-pixmap'.
1309
1310  - Function: color-pixmap-image-instance-p object
1311      This function returns non-`nil' if OBJECT is an image instance of
1312      type `color-pixmap'.
1313
1314  - Function: pointer-image-instance-p object
1315      This function returns non-`nil' if OBJECT is an image instance of
1316      type `pointer'.
1317
1318  - Function: subwindow-image-instance-p object
1319      This function returns non-`nil' if OBJECT is an image instance of
1320      type `subwindow'.
1321
1322  - Function: nothing-image-instance-p object
1323      This function returns non-`nil' if OBJECT is an image instance of
1324      type `nothing'.
1325
1326  - Function: widget-image-instance-p object
1327      Return `t' if OBJECT is an image instance of type `widget'.
1328
1329 \1f
1330 File: lispref.info,  Node: Image Instance Functions,  Prev: Image Instance Types,  Up: Image Instances
1331
1332 Image Instance Functions
1333 ........................
1334
1335  - Function: make-image-instance data &optional domain dest-types
1336           noerror
1337      This function creates a new image-instance object.
1338
1339      DATA is an image instantiator, which describes the image (*note
1340      Image Specifiers::).
1341
1342      DEST-TYPES should be a list of allowed image instance types that
1343      can be generated.  The DEST-TYPES list is unordered.  If multiple
1344      destination types are possible for a given instantiator, the "most
1345      natural" type for the instantiator's format is chosen. (For XBM,
1346      the most natural types are `mono-pixmap', followed by
1347      `color-pixmap', followed by `pointer'.  For the other normal image
1348      formats, the most natural types are `color-pixmap', followed by
1349      `mono-pixmap', followed by `pointer'.  For the string and
1350      formatted-string formats, the most natural types are `text',
1351      followed by `mono-pixmap' (not currently implemented), followed by
1352      `color-pixmap' (not currently implemented).  For MS Windows
1353      resources, the most natural type for pointer resources is
1354      `pointer', and for the others it's `color-pixmap'.  The other
1355      formats can only be instantiated as one type. (If you want to
1356      control more specifically the order of the types into which an
1357      image is instantiated, just call `make-image-instance' repeatedly
1358      until it succeeds, passing less and less preferred destination
1359      types each time.
1360
1361      If DEST-TYPES is omitted, all possible types are allowed.
1362
1363      DOMAIN specifies the domain to which the image instance will be
1364      attached.  This domain is termed the "governing domain".  The type
1365      of the governing domain depends on the image instantiator format.
1366      (Although, more correctly, it should probably depend on the image
1367      instance type.) For example, pixmap image instances are specific
1368      to a device, but widget image instances are specific to a
1369      particular XEmacs window because in order to display such a widget
1370      when two windows onto the same buffer want to display the widget,
1371      two separate underlying widgets must be created. (That's because a
1372      widget is actually a child window-system window, and all
1373      window-system windows have a unique existence on the screen.) This
1374      means that the governing domain for a pixmap image instance will
1375      be some device (most likely, the only existing device), whereas
1376      the governing domain for a widget image instance will be some
1377      XEmacs window.
1378
1379      If you specify an overly general DOMAIN (e.g. a frame when a
1380      window was wanted), an error is signaled.  If you specify an overly
1381      specific DOMAIN (e.g. a window when a device was wanted), the
1382      corresponding general domain is fetched and used instead.  For
1383      `make-image-instance', it makes no difference whether you specify
1384      an overly specific domain or the properly general domain derived
1385      from it.  However, it does matter when creating an image instance
1386      by instantiating a specifier or glyph (e.g. with
1387      `glyph-image-instance'), because the more specific domain causes
1388      spec lookup to start there and proceed to more general domains. (It
1389      would also matter when creating an image instance with an
1390      instantiator format of `inherit', but we currently disallow this.
1391      #### We should fix this.)  n If omitted, DOMAIN defaults to the
1392      selected window.
1393
1394      NOERROR controls what happens when the image cannot be generated.
1395      If `nil', an error message is generated.  If `t', no messages are
1396      generated and this function returns `nil'.  If anything else, a
1397      warning message is generated and this function returns `nil'.
1398
1399  - Function: colorize-image-instance image-instance foreground
1400           background
1401      This function makes the image instance be displayed in the given
1402      colors.  Image instances come in two varieties: bitmaps, which are
1403      1 bit deep which are rendered in the prevailing foreground and
1404      background colors; and pixmaps, which are of arbitrary depth
1405      (including 1) and which have the colors explicitly specified.
1406      This function converts a bitmap to a pixmap.  If the image
1407      instance was a pixmap already, nothing is done (and `nil' is
1408      returned).  Otherwise `t' is returned.
1409
1410  - Function: image-instance-name image-instance
1411      This function returns the name of the given image instance.
1412
1413  - Function: image-instance-domain image-instance
1414      Return the governing domain of the given IMAGE-INSTANCE.  The
1415      governing domain of an image instance is the domain that the image
1416      instance is specific to.  It is _NOT_ necessarily the domain that
1417      was given to the call to `specifier-instance' that resulted in the
1418      creation of this image instance.  See `make-image-instance' for
1419      more information on governing domains.
1420
1421  - Function: image-instance-string image-instance
1422      This function returns the string of the given image instance.
1423      This will only be non-`nil' for text image instances.
1424
1425  - Function: image-instance-file-name image-instance
1426      This function returns the file name from which IMAGE-INSTANCE was
1427      read, if known.
1428
1429  - Function: image-instance-mask-file-name image-instance
1430      This function returns the file name from which IMAGE-INSTANCE's
1431      mask was read, if known.
1432
1433  - Function: image-instance-depth image-instance
1434      This function returns the depth of the image instance.  This is 0
1435      for a mono pixmap, or a positive integer for a color pixmap.
1436
1437  - Function: image-instance-height image-instance
1438      This function returns the height of the image instance, in pixels.
1439
1440  - Function: image-instance-width image-instance
1441      This function returns the width of the image instance, in pixels.
1442
1443  - Function: image-instance-hotspot-x image-instance
1444      This function returns the X coordinate of the image instance's
1445      hotspot, if known.  This is a point relative to the origin of the
1446      pixmap.  When an image is used as a mouse pointer, the hotspot is
1447      the point on the image that sits over the location that the
1448      pointer points to.  This is, for example, the tip of the arrow or
1449      the center of the crosshairs.
1450
1451      This will always be `nil' for a non-pointer image instance.
1452
1453  - Function: image-instance-hotspot-y image-instance
1454      This function returns the Y coordinate of the image instance's
1455      hotspot, if known.
1456
1457  - Function: image-instance-foreground image-instance
1458      This function returns the foreground color of IMAGE-INSTANCE, if
1459      applicable.  This will be a color instance or `nil'. (It will only
1460      be non-`nil' for colorized mono pixmaps and for pointers.)
1461
1462  - Function: image-instance-background image-instance
1463      This function returns the background color of IMAGE-INSTANCE, if
1464      applicable.  This will be a color instance or `nil'. (It will only
1465      be non-`nil' for colorized mono pixmaps and for pointers.)
1466
1467 \1f
1468 File: lispref.info,  Node: Glyph Types,  Next: Mouse Pointer,  Prev: Images,  Up: Glyphs
1469
1470 Glyph Types
1471 ===========
1472
1473 Each glyph has a particular type, which controls how the glyph's image
1474 is generated.  Each glyph type has a corresponding list of allowable
1475 image instance types that can be generated.  When you call
1476 `glyph-image-instance' to retrieve the image instance of a glyph,
1477 XEmacs does the equivalent of calling `make-image-instance' and passing
1478 in DEST-TYPES the list of allowable image instance types for the
1479 glyph's type.
1480
1481    * `buffer' glyphs can be used as the begin-glyph or end-glyph of an
1482      extent, in the modeline, and in the toolbar.  Their image can be
1483      instantiated as `nothing', `mono-pixmap', `color-pixmap', `text',
1484      and `subwindow'.
1485
1486    * `pointer' glyphs can be used to specify the mouse pointer.  Their
1487      image can be instantiated as `pointer'.
1488
1489    * `icon' glyphs can be used to specify the icon used when a frame is
1490      iconified.  Their image can be instantiated as `mono-pixmap' and
1491      `color-pixmap'.
1492
1493  - Function: glyph-type glyph
1494      This function returns the type of the given glyph.  The return
1495      value will be a symbol, one of `buffer', `pointer', or `icon'.
1496
1497  - Function: valid-glyph-type-p glyph-type
1498      Given a GLYPH-TYPE, this function returns non-`nil' if it is valid.
1499
1500  - Function: glyph-type-list
1501      This function returns a list of valid glyph types.
1502
1503  - Function: buffer-glyph-p object
1504      This function returns non-`nil' if OBJECT is a glyph of type
1505      `buffer'.
1506
1507  - Function: icon-glyph-p object
1508      This function returns non-`nil' if OBJECT is a glyph of type
1509      `icon'.
1510
1511  - Function: pointer-glyph-p object
1512      This function returns non-`nil' if OBJECT is a glyph of type
1513      `pointer'.
1514
1515 \1f
1516 File: lispref.info,  Node: Mouse Pointer,  Next: Redisplay Glyphs,  Prev: Glyph Types,  Up: Glyphs
1517
1518 Mouse Pointer
1519 =============
1520
1521 The shape of the mouse pointer when over a particular section of a frame
1522 is controlled using various glyph variables.  Since the image of a glyph
1523 is a specifier, it can be controlled on a per-buffer, per-frame,
1524 per-window, or per-device basis.
1525
1526    You should use `set-glyph-image' to set the following variables,
1527 _not_ `setq'.
1528
1529  - Glyph: text-pointer-glyph
1530      This variable specifies the shape of the mouse pointer when over
1531      text.
1532
1533  - Glyph: nontext-pointer-glyph
1534      This variable specifies the shape of the mouse pointer when over a
1535      buffer, but not over text.  If unspecified in a particular domain,
1536      `text-pointer-glyph' is used.
1537
1538  - Glyph: modeline-pointer-glyph
1539      This variable specifies the shape of the mouse pointer when over
1540      the modeline.  If unspecified in a particular domain,
1541      `nontext-pointer-glyph' is used.
1542
1543  - Glyph: selection-pointer-glyph
1544      This variable specifies the shape of the mouse pointer when over a
1545      selectable text region.  If unspecified in a particular domain,
1546      `text-pointer-glyph' is used.
1547
1548  - Glyph: gc-pointer-glyph
1549      This variable specifies the shape of the mouse pointer when a
1550      garbage collection is in progress.  If the selected window is on a
1551      window system and this glyph specifies a value (i.e. a pointer
1552      image instance) in the domain of the selected window, the pointer
1553      will be changed as specified during garbage collection.
1554      Otherwise, a message will be printed in the echo area, as
1555      controlled by `gc-message'.
1556
1557  - Glyph: busy-pointer-glyph
1558      This variable specifies the shape of the mouse pointer when XEmacs
1559      is busy.  If unspecified in a particular domain, the pointer is
1560      not changed when XEmacs is busy.
1561
1562  - Glyph: menubar-pointer-glyph
1563      This variable specifies the shape of the mouse pointer when over
1564      the menubar.  If unspecified in a particular domain, the
1565      window-system-provided default pointer is used.
1566
1567  - Glyph: scrollbar-pointer-glyph
1568      This variable specifies the shape of the mouse pointer when over a
1569      scrollbar.  If unspecified in a particular domain, the
1570      window-system-provided default pointer is used.
1571
1572  - Glyph: toolbar-pointer-glyph
1573      This variable specifies the shape of the mouse pointer when over a
1574      toolbar.  If unspecified in a particular domain,
1575      `nontext-pointer-glyph' is used.
1576
1577    Internally, these variables are implemented in
1578 `default-mouse-motion-handler', and thus only take effect when the
1579 mouse moves.  That function calls `set-frame-pointer', which sets the
1580 current mouse pointer for a frame.
1581
1582  - Function: set-frame-pointer frame image-instance
1583      This function sets the mouse pointer of FRAME to the given pointer
1584      image instance.  You should not call this function directly.  (If
1585      you do, the pointer will change again the next time the mouse
1586      moves.)
1587
1588 \1f
1589 File: lispref.info,  Node: Redisplay Glyphs,  Next: Subwindows,  Prev: Mouse Pointer,  Up: Glyphs
1590
1591 Redisplay Glyphs
1592 ================
1593
1594  - Glyph: truncation-glyph
1595      This variable specifies what is displayed at the end of truncated
1596      lines.
1597
1598  - Glyph: continuation-glyph
1599      This variable specifies what is displayed at the end of wrapped
1600      lines.
1601
1602  - Glyph: octal-escape-glyph
1603      This variable specifies what to prefix character codes displayed
1604      in octal with.
1605
1606  - Glyph: hscroll-glyph
1607      This variable specifies what to display at the beginning of
1608      horizontally scrolled lines.
1609
1610  - Glyph: invisible-text-glyph
1611      This variable specifies what to use to indicate the presence of
1612      invisible text.  This is the glyph that is displayed when an
1613      ellipsis is called for, according to `selective-display-ellipses'
1614      or `buffer-invisibility-spec').  Normally this is three dots
1615      ("...").
1616
1617  - Glyph: control-arrow-glyph
1618      This variable specifies what to use as an arrow for control
1619      characters.
1620
1621 \1f
1622 File: lispref.info,  Node: Subwindows,  Next: Glyph Examples,  Prev: Redisplay Glyphs,  Up: Glyphs
1623
1624 Subwindows
1625 ==========
1626
1627 Subwindows are not currently implemented.
1628
1629  - Function: subwindowp object
1630      This function returns non-`nil' if OBJECT is a subwindow.
1631
1632 \1f
1633 File: lispref.info,  Node: Glyph Examples,  Prev: Subwindows,  Up: Glyphs
1634
1635 Glyph Examples
1636 ==============
1637
1638 For many applications, displaying graphics is a simple process: you
1639 create a glyph, and then you insert it into a buffer.
1640
1641    The easiest way to create a glyph is to use a file that contains a
1642 graphical image, such as a JPEG, TIFF, or PNG file:
1643
1644      ;; Create a glyph from a JPEG file:
1645      (setq foo (make-glyph [jpeg :file "/tmp/file1.jpg"]))
1646
1647      ;; Create a glyph from a XPM file:
1648      (setq foo (make-glyph [xpm :file "/tmp/file2.xpm"]))
1649
1650      ;; Create a glyph from a PNG file:
1651      (setq foo (make-glyph [png :file "/tmp/file3.png"]))
1652
1653      ;; Create a glyph from a TIFF file:
1654      (setq foo (make-glyph [tiff :file "/tmp/file4.tiff"]))
1655
1656    The parameters passed to `make-glyph' are called "Image Specifiers",
1657 and can handle more image types than those shown above.  You can also
1658 put the raw image data into a string (e.g., if you put the contents of
1659 a JPEG file into a string), and use that to create a glyph.  *Note
1660 Image Specifiers::, for more information.
1661
1662      *Caution*: In order for XEmacs to read a particular graphics file
1663      format, support for that format must have been compiled into
1664      XEmacs.  It's possible, although somewhat unlikely, for XEmacs to
1665      have been compiled without support for any of the various graphics
1666      file formats.  To see what graphics formats your particular
1667      version of XEmacs supports, use `M-x describe-installation'.
1668
1669      To programmatically query whether or not a particular file format
1670      is supported, you can use the `featurep' function, with one of:
1671      `gif', `tiff', `jpeg', `xpm', `xbm', `png', or `xface'.  For an
1672      up-to-date list, *Note Image Specifiers::.  Example:
1673
1674           ;; Returns `t' if TIFF is supported:
1675           (featurep 'tiff)
1676
1677      Another example is:
1678
1679           ;; Returns a list of `t' or `nil', depending on whether or not the
1680           ;; corresponding feature is supported:
1681           (mapcar #'(lambda (format-symbol) (featurep format-symbol))
1682                   '(gif tiff jpeg xpm png))
1683
1684
1685    Once you have a glyph, you can then insert it into a buffer.
1686 Example:
1687
1688      ;; Use this function to insert a glyph at the left edge of point in the
1689      ;; current buffer.  Any existing glyph at this location is replaced.
1690      (defun insert-glyph (gl)
1691        "Insert a glyph at the left edge of point."
1692        (let ( (prop 'myimage)        ;; myimage is an arbitrary name, chosen
1693                                      ;; to (hopefully) not conflict with any
1694                                      ;; other properties.  Change it if
1695                                      ;; necessary.
1696               extent )
1697          ;; First, check to see if one of our extents already exists at
1698          ;; point.  For ease-of-programming, we are creating and using our
1699          ;; own extents (multiple extents are allowed to exist/overlap at the
1700          ;; same point, and it's quite possible for other applications to
1701          ;; embed extents in the current buffer without your knowledge).
1702          ;; Basically, if an extent, with the property stored in "prop",
1703          ;; exists at point, we assume that it is one of ours, and we re-use
1704          ;; it (this is why it is important for the property stored in "prop"
1705          ;; to be unique, and only used by us).
1706          (if (not (setq extent (extent-at (point) (current-buffer) prop)))
1707            (progn
1708              ;; If an extent does not already exist, create a zero-length
1709              ;; extent, and give it our special property.
1710              (setq extent (make-extent (point) (point) (current-buffer)))
1711              (set-extent-property extent prop t)
1712              ))
1713          ;; Display the glyph by storing it as the extent's "begin-glyph".
1714          (set-extent-property extent 'begin-glyph gl)
1715          ))
1716      
1717      ;; You can then use this function like:
1718      (insert-glyph (make-glyph [jpeg :file "/tmp/file1.jpg"]))
1719      ;; This will insert the glyph at point.
1720      
1721      ;; Here's an example of how to insert two glyphs side-by-side, at point
1722      ;; (using the above code):
1723      (progn
1724        (insert-glyph (make-glyph [jpeg :file "/tmp/file1.jpg"]))
1725        ;; Create a new extent at point.  We can't simply call "insert-glyph",
1726        ;; as "insert-glyph" will simply replace the first glyph with the
1727        ;; second.
1728        (setq extent (make-extent (point) (point) (current-buffer)))
1729        ;; Here, we're only setting the 'myimage property in case we need
1730        ;; to later identify/locate/reuse this particular extent.
1731        (set-extent-property extent 'myimage t)
1732        (set-extent-property extent 'begin-glyph
1733                             (make-glyph [jpeg :file "/tmp/file2.jpg"]))
1734        )
1735
1736    Here are the gory details:
1737
1738    * Glyphs are displayed by attaching them to extents (see *Note
1739      Extents::), either to the beginning or the end of extents.
1740
1741      Note that extents can be used for many things, and not just for
1742      displaying images (although, in the above example, we are creating
1743      our own extent for the sole purpose of displaying an image).
1744      Also, note that multiple extents are allowed to exist at the same
1745      position, and they can overlap.
1746
1747    * Glyphs are often displayed inside the text area (alongside text).
1748      This is the default.
1749
1750      Although glyphs can also be displayed in the margins, how to do
1751      this will not be described here.  For more information on this, see
1752      *Note Annotation Basics:: (look for information on "layout types")
1753      and *Note Extent Properties:: (look for `begin-glyph-layout' and
1754      `end-glyph-layout').
1755
1756    * The easiest way to insert a glyph into text is to create a
1757      zero-length extent at the point where you want the glyph to appear.
1758
1759      Note that zero-length extents are attached to the character to the
1760      right of the extent; deleting this character will also delete the
1761      extent.
1762
1763    * It's often a good idea to assign a unique property to the
1764      newly-created extent, in case you later want to locate it, and
1765      replace any existing glyph with a different one (or just delete
1766      the existing one).  In the above example, we are using "myimage"
1767      as our (hopefully) unique property name.
1768
1769      If you need to locate all of the extents, you'll have to use
1770      functions like `extent-list' or `next-extent', or provide
1771      additional parameters to the `extent-at' function.  Assigning a
1772      unique property to the extent makes it easy to locate your
1773      extents; for example, `extent-list' can return only those extents
1774      with a particular property.  *Note Finding Extents::, and *Note
1775      Mapping Over Extents::, for more information.
1776
1777    * Glyphs are displayed by assigning then to the `begin-glyph' or
1778      `end-glyph' property of the extent.  For zero-length extents, it
1779      doesn't really matter if you assign the glyph to the `begin-glyph'
1780      or `end-glyph' property, as they are both at the same location;
1781      however, for non-zero-length extents (extents that cover one or
1782      more characters of text), it does matter which one you use.
1783
1784      Assigning `nil' to the `begin-glyph' or `end-glyph' property will
1785      delete any existing glyph.  In this case, you may also want to
1786      delete the extent, assuming that the extent is used for no other
1787      purpose.
1788
1789    * If you happen to insert two glyphs, side-by-side, note that the
1790      example `insert-glyph' function will have trouble, if it's again
1791      used at the same point (it can only locate one of the two extents).
1792      *Note Finding Extents::, and *Note Mapping Over Extents::, for more
1793      information on locating extents in a buffer.
1794
1795    * Among other things, glyphs provide a way of displaying graphics
1796      alongside text.  Note, however, that glyphs only provide a way of
1797      displaying graphics; glyphs are not actually part of the text, and
1798      are only displayed alongside the text.  If you save the text in
1799      the buffer, the graphics are not saved.  The low-level glyph code
1800      does not provide a way of saving graphics with the text.  If you
1801      need to save graphics and text, you have to write your own code to
1802      do this, and this topic is outside the scope of this discussion.
1803
1804
1805 \1f
1806 File: lispref.info,  Node: Annotations,  Next: Display,  Prev: Glyphs,  Up: Top
1807
1808 Annotations
1809 ***********
1810
1811 An "annotation" is a pixmap or string that is not part of a buffer's
1812 text but is displayed next to a particular location in a buffer.
1813 Annotations can be displayed intermixed with text, in any whitespace at
1814 the beginning or end of a line, or in a special area at the left or
1815 right side of the frame called a "margin", whose size is controllable.
1816 Annotations are implemented using extents (*note Extents::); but you
1817 can work with annotations without knowing how extents work.
1818
1819 * Menu:
1820
1821 * Annotation Basics::           Introduction to annotations.
1822 * Annotation Primitives::       Creating and deleting annotations.
1823 * Annotation Properties::       Retrieving and changing the characteristics
1824                                   of an annotation.
1825 * Margin Primitives::           Controlling the size of the margins.
1826 * Locating Annotations::        Looking for annotations in a buffer.
1827 * Annotation Hooks::            Hooks called at certain times during an
1828                                   annotation's lifetime.
1829
1830 \1f
1831 File: lispref.info,  Node: Annotation Basics,  Next: Annotation Primitives,  Up: Annotations
1832
1833 Annotation Basics
1834 =================
1835
1836 Marginal annotations are notes associated with a particular location in
1837 a buffer.  They may be displayed in a margin created on the left-hand or
1838 right-hand side of the frame, in any whitespace at the beginning or end
1839 of a line, or inside of the text itself.  Every annotation may have an
1840 associated action to be performed when the annotation is selected.  The
1841 term "annotation" is used to refer to an individual note.  The term
1842 "margin" is generically used to refer to the whitespace before the
1843 first character on a line or after the last character on a line.
1844
1845    Each annotation has the following characteristics:
1846 GLYPH
1847      This is a glyph object and is used as the displayed representation
1848      of the annotation.
1849
1850 DOWN-GLYPH
1851      If given, this glyph is used as the displayed representation of
1852      the annotation when the mouse is pressed down over the annotation.
1853
1854 FACE
1855      The face with which to display the glyph.
1856
1857 SIDE
1858      Which side of the text (left or right) the annotation is displayed
1859      at.
1860
1861 ACTION
1862      If non-`nil', this field must contain a function capable of being
1863      the first argument to `funcall'.  This function is normally
1864      evaluated with a single argument, the value of the DATA field,
1865      each time the annotation is selected.  However, if the WITH-EVENT
1866      parameter to `make-annotation' is non-`nil', the function is
1867      called with two arguments.  The first argument is the same as
1868      before, and the second argument is the event (a button-up event,
1869      usually) that activated the annotation.
1870
1871 DATA
1872      Not used internally.  This field can contain any E-Lisp object.
1873      It is passed as the first argument to ACTION described above.
1874
1875 MENU
1876      A menu displayed when the right mouse button is pressed over the
1877      annotation.
1878
1879    The margin is divided into "outside" and "inside".  The outside
1880 margin is space on the left or right side of the frame which normal text
1881 cannot be displayed in.  The inside margin is that space between the
1882 leftmost or rightmost point at which text can be displayed and where the
1883 first or last character actually is.
1884
1885    There are four different "layout types" which affect the exact
1886 location an annotation appears.
1887
1888 `outside-margin'
1889      The annotation is placed in the outside margin area. as close as
1890      possible to the edge of the frame.  If the outside margin is not
1891      wide enough for an annotation to fit, it is not displayed.
1892
1893 `inside-margin'
1894      The annotation is placed in the inside margin area, as close as
1895      possible to the edge of the frame.  If the inside margin is not
1896      wide enough for the annotation to fit, it will be displayed using
1897      any available outside margin space if and only if the specifier
1898      `use-left-overflow' or `use-right-overflow' (depending on which
1899      side the annotation appears in) is non-`nil'.
1900
1901 `whitespace'
1902      The annotation is placed in the inside margin area, as close as
1903      possible to the first or last non-whitespace character on a line.
1904      If the inside margin is not wide enough for the annotation to fit,
1905      it will be displayed if and only if the specifier
1906      `use-left-overflow' or `use-right-overflow' (depending on which
1907      side the annotation appears in) is non-`nil'.
1908
1909 `text'
1910      The annotation is placed at the position it is inserted.  It will
1911      create enough space for itself inside of the text area.  It does
1912      not take up a place in the logical buffer, only in the display of
1913      the buffer.
1914
1915    The current layout policy is that all `whitespace' annotations are
1916 displayed first.  Next, all `inside-margin' annotations are displayed
1917 using any remaining space.  Finally as many `outside-margin'
1918 annotations are displayed as possible.  The `text' annotations will
1919 always display as they create their own space to display in.
1920
1921 \1f
1922 File: lispref.info,  Node: Annotation Primitives,  Next: Annotation Properties,  Prev: Annotation Basics,  Up: Annotations
1923
1924 Annotation Primitives
1925 =====================
1926
1927  - Function: make-annotation glyph &optional position layout buffer
1928           with-event d-glyph rightp
1929      This function creates a marginal annotation at position POSITION in
1930      BUFFER.  The annotation is displayed using GLYPH, which should be
1931      a glyph object or a string, and is positioned using layout policy
1932      LAYOUT.  If POSITION is `nil', point is used.  If LAYOUT is `nil',
1933      `whitespace' is used.  If BUFFER is `nil', the current buffer is
1934      used.
1935
1936      If WITH-EVENT is non-`nil', then when an annotation is activated,
1937      the triggering event is passed as the second arg to the annotation
1938      function.  If D-GLYPH is non-`nil' then it is used as the glyph
1939      that will be displayed when button1 is down.  If RIGHTP is
1940      non-`nil' then the glyph will be displayed on the right side of
1941      the buffer instead of the left.
1942
1943      The newly created annotation is returned.
1944
1945  - Function: delete-annotation annotation
1946      This function removes ANNOTATION from its buffer.  This does not
1947      modify the buffer text.
1948
1949  - Function: annotationp annotation
1950      This function returns `t' if ANNOTATION is an annotation, `nil'
1951      otherwise.
1952
1953 \1f
1954 File: lispref.info,  Node: Annotation Properties,  Next: Margin Primitives,  Prev: Annotation Primitives,  Up: Annotations
1955
1956 Annotation Properties
1957 =====================
1958
1959  - Function: annotation-glyph annotation
1960      This function returns the glyph object used to display ANNOTATION.
1961
1962  - Function: set-annotation-glyph annotation glyph &optional layout side
1963      This function sets the glyph of ANNOTATION to GLYPH, which should
1964      be a glyph object.  If LAYOUT is non-`nil', set the layout policy
1965      of ANNOTATION to LAYOUT.  If SIDE is `left' or `right', change the
1966      side of the buffer at which the annotation is displayed to the
1967      given side.  The new value of `annotation-glyph' is returned.
1968
1969  - Function: annotation-down-glyph annotation
1970      This function returns the glyph used to display ANNOTATION when
1971      the left mouse button is depressed on the annotation.
1972
1973  - Function: set-annotation-down-glyph annotation glyph
1974      This function returns the glyph used to display ANNOTATION when
1975      the left mouse button is depressed on the annotation to GLYPH,
1976      which should be a glyph object.
1977
1978  - Function: annotation-face annotation
1979      This function returns the face associated with ANNOTATION.
1980
1981  - Function: set-annotation-face annotation face
1982      This function sets the face associated with ANNOTATION to FACE.
1983
1984  - Function: annotation-layout annotation
1985      This function returns the layout policy of ANNOTATION.
1986
1987  - Function: set-annotation-layout annotation layout
1988      This function sets the layout policy of ANNOTATION to LAYOUT.
1989
1990  - Function: annotation-side annotation
1991      This function returns the side of the buffer that ANNOTATION is
1992      displayed on.  Return value is a symbol, either `left' or `right'.
1993
1994  - Function: annotation-data annotation
1995      This function returns the data associated with ANNOTATION.
1996
1997  - Function: set-annotation-data annotation data
1998      This function sets the data field of ANNOTATION to DATA.  DATA is
1999      returned.
2000
2001  - Function: annotation-action annotation
2002      This function returns the action associated with ANNOTATION.
2003
2004  - Function: set-annotation-action annotation action
2005      This function sets the action field of ANNOTATION to ACTION.
2006      ACTION is returned..
2007
2008  - Function: annotation-menu annotation
2009      This function returns the menu associated with ANNOTATION.
2010
2011  - Function: set-annotation-menu annotation menu
2012      This function sets the menu associated with ANNOTATION to MENU.
2013      This menu will be displayed when the right mouse button is pressed
2014      over the annotation.
2015
2016  - Function: annotation-visible annotation
2017      This function returns `t' if there is enough available space to
2018      display ANNOTATION, `nil' otherwise.
2019
2020  - Function: annotation-width annotation
2021      This function returns the width of ANNOTATION in pixels.
2022
2023  - Function: hide-annotation annotation
2024      This function removes ANNOTATION's glyph, making it invisible.
2025
2026  - Function: reveal-annotation annotation
2027      This function restores ANNOTATION's glyph, making it visible.
2028
2029 \1f
2030 File: lispref.info,  Node: Locating Annotations,  Next: Annotation Hooks,  Prev: Margin Primitives,  Up: Annotations
2031
2032 Locating Annotations
2033 ====================
2034
2035  - Function: annotations-in-region start end buffer
2036      This function returns a list of all annotations in BUFFER which
2037      are between START and END inclusively.
2038
2039  - Function: annotations-at &optional position buffer
2040      This function returns a list of all annotations at POSITION in
2041      BUFFER.  If POSITION is `nil' point is used.  If BUFFER is `nil'
2042      the current buffer is used.
2043
2044  - Function: annotation-list &optional buffer
2045      This function returns a list of all annotations in BUFFER.  If
2046      BUFFER is `nil', the current buffer is used.
2047
2048  - Function: all-annotations
2049      This function returns a list of all annotations in all buffers in
2050      existence.
2051
2052 \1f
2053 File: lispref.info,  Node: Margin Primitives,  Next: Locating Annotations,  Prev: Annotation Properties,  Up: Annotations
2054
2055 Margin Primitives
2056 =================
2057
2058 The margin widths are controllable on a buffer-local, window-local,
2059 frame-local, device-local, or device-type-local basis through the use
2060 of specifiers.  *Note Specifiers::.
2061
2062  - Specifier: left-margin-width
2063      This is a specifier variable controlling the width of the left
2064      outside margin, in characters.  Use `set-specifier' to change its
2065      value.
2066
2067  - Specifier: right-margin-width
2068      This is a specifier variable controlling the width of the right
2069      outside margin, in characters.  Use `set-specifier' to change its
2070      value.
2071
2072  - Specifier: use-left-overflow
2073      If non-`nil', use the left outside margin as extra whitespace when
2074      displaying `whitespace' and `inside-margin' annotations.  Defaults
2075      to `nil'.  This is a specifier variable; use `set-specifier' to
2076      change its value.
2077
2078  - Specifier: use-right-overflow
2079      If non-`nil', use the right outside margin as extra whitespace when
2080      displaying `whitespace' and `inside-margin' annotations.  Defaults
2081      to `nil'.  This is a specifier variable; use `set-specifier' to
2082      change its value.
2083
2084  - Function: window-left-margin-pixel-width &optional window
2085      This function returns the width in pixels of the left outside
2086      margin of WINDOW.  If WINDOW is `nil', the selected window is
2087      assumed.
2088
2089  - Function: window-right-margin-pixel-width &optional window
2090      This function returns the width in pixels of the right outside
2091      margin of WINDOW.  If WINDOW is `nil', the selected window is
2092      assumed.
2093
2094    The margin colors are controlled by the faces `left-margin' and
2095 `right-margin'.  These can be set using the X resources
2096 `Emacs.left-margin.background' and `Emacs.left-margin.foreground';
2097 likewise for the right margin.
2098
2099 \1f
2100 File: lispref.info,  Node: Annotation Hooks,  Prev: Locating Annotations,  Up: Annotations
2101
2102 Annotation Hooks
2103 ================
2104
2105 The following three hooks are provided for use with the marginal
2106 annotations:
2107
2108 `before-delete-annotation-hook'
2109      This hook is called immediately before an annotation is destroyed.
2110      It is passed a single argument, the annotation being destroyed.
2111
2112 `after-delete-annotation-hook'
2113      This normal hook is called immediately after an annotation is
2114      destroyed.
2115
2116 `make-annotation-hook'
2117      This hook is called immediately after an annotation is created.
2118      It is passed a single argument, the newly created annotation.
2119
2120 \1f
2121 File: lispref.info,  Node: Display,  Next: Hash Tables,  Prev: Annotations,  Up: Top
2122
2123 Emacs Display
2124 *************
2125
2126 This chapter describes a number of other features related to the display
2127 that XEmacs presents to the user.
2128
2129 * Menu:
2130
2131 * Refresh Screen::      Clearing the screen and redrawing everything on it.
2132 * Truncation::          Folding or wrapping long text lines.
2133 * The Echo Area::       Where messages are displayed.
2134 * Warnings::            Display of Warnings.
2135 * Invisible Text::      Hiding part of the buffer text.
2136 * Selective Display::   Hiding part of the buffer text (the old way).
2137 * Overlay Arrow::       Display of an arrow to indicate position.
2138 * Temporary Displays::  Displays that go away automatically.
2139 * Blinking::            How XEmacs shows the matching open parenthesis.
2140 * Usual Display::       The usual conventions for displaying nonprinting chars.
2141 * Display Tables::      How to specify other conventions.
2142 * Beeping::             Audible signal to the user.
2143
2144 \1f
2145 File: lispref.info,  Node: Refresh Screen,  Next: Truncation,  Up: Display
2146
2147 Refreshing the Screen
2148 =====================
2149
2150 The function `redraw-frame' redisplays the entire contents of a given
2151 frame.  *Note Frames::.
2152
2153  - Function: redraw-frame &optional frame no-preempt
2154      This function clears and redisplays frame FRAME.
2155
2156      FRAME defaults to the selected frame if omitted.
2157
2158      Normally, redisplay is preempted as normal if input arrives.
2159      However, if optional second arg NO-PREEMPT is non-`nil', redisplay
2160      will not stop for input and is guaranteed to proceed to completion.
2161
2162    Even more powerful is `redraw-display':
2163
2164  - Command: redraw-display &optional device
2165      This function redraws all frames on DEVICE marked as having their
2166      image garbled.  DEVICE defaults to the selected device.  If DEVICE
2167      is `t', all devices will have their frames checked.
2168
2169    Processing user input takes absolute priority over redisplay.  If you
2170 call these functions when input is available, they do nothing
2171 immediately, but a full redisplay does happen eventually--after all the
2172 input has been processed.
2173
2174    Normally, suspending and resuming XEmacs also refreshes the screen.
2175 Some terminal emulators record separate contents for display-oriented
2176 programs such as XEmacs and for ordinary sequential display.  If you are
2177 using such a terminal, you might want to inhibit the redisplay on
2178 resumption.  *Note Suspending XEmacs::.
2179
2180  - Variable: no-redraw-on-reenter
2181      This variable controls whether XEmacs redraws the entire screen
2182      after it has been suspended and resumed.  Non-`nil' means yes,
2183      `nil' means no.
2184
2185    The above functions do not actually cause the display to be updated;
2186 rather, they clear out the internal display records that XEmacs
2187 maintains, so that the next time the display is updated it will be
2188 redrawn from scratch.  Normally this occurs the next time that
2189 `next-event' or `sit-for' is called; however, a display update will not
2190 occur if there is input pending.  *Note Command Loop::.
2191
2192  - Function: force-cursor-redisplay &optional frame
2193      This function causes an immediate update of the cursor on FRAME,
2194      which defaults to the selected frame.
2195
2196 \1f
2197 File: lispref.info,  Node: Truncation,  Next: The Echo Area,  Prev: Refresh Screen,  Up: Display
2198
2199 Truncation
2200 ==========
2201
2202 When a line of text extends beyond the right edge of a window, the line
2203 can either be truncated or continued on the next line.  When a line is
2204 truncated, this is normally shown with a `\' in the rightmost column of
2205 the window on X displays, and with a `$' on TTY devices.  When a line
2206 is continued or "wrapped" onto the next line, this is shown with a
2207 curved arrow in the rightmost column of the window (or with a `\' on
2208 TTY devices).  The additional screen lines used to display a long text
2209 line are called "continuation" lines.
2210
2211    Normally, whenever line truncation is in effect for a particular
2212 window, a horizontal scrollbar is displayed in that window if the
2213 device supports scrollbars.  *Note Scrollbars::.
2214
2215    Note that continuation is different from filling; continuation
2216 happens on the screen only, not in the buffer contents, and it breaks a
2217 line precisely at the right margin, not at a word boundary.  *Note
2218 Filling::.
2219
2220  - User Option: truncate-lines
2221      This buffer-local variable controls how XEmacs displays lines that
2222      extend beyond the right edge of the window.  If it is non-`nil',
2223      then XEmacs does not display continuation lines; rather each line
2224      of text occupies exactly one screen line, and a backslash appears
2225      at the edge of any line that extends to or beyond the edge of the
2226      window.  The default is `nil'.
2227
2228      If the variable `truncate-partial-width-windows' is non-`nil',
2229      then truncation is always used for side-by-side windows (within one
2230      frame) regardless of the value of `truncate-lines'.
2231
2232  - User Option: default-truncate-lines
2233      This variable is the default value for `truncate-lines', for
2234      buffers that do not have local values for it.
2235
2236  - User Option: truncate-partial-width-windows
2237      This variable controls display of lines that extend beyond the
2238      right edge of the window, in side-by-side windows (*note Splitting
2239      Windows::).  If it is non-`nil', these lines are truncated;
2240      otherwise, `truncate-lines' says what to do with them.
2241
2242    The backslash and curved arrow used to indicate truncated or
2243 continued lines are only defaults, and can be changed.  These images
2244 are actually glyphs (*note Glyphs::).  XEmacs provides a great deal of
2245 flexibility in how glyphs can be controlled. (This differs from FSF
2246 Emacs, which uses display tables to control these images.)
2247
2248    For details, *Note Redisplay Glyphs::.
2249
2250 \1f
2251 File: lispref.info,  Node: The Echo Area,  Next: Warnings,  Prev: Truncation,  Up: Display
2252
2253 The Echo Area
2254 =============
2255
2256 The "echo area" is used for displaying messages made with the `message'
2257 primitive, and for echoing keystrokes.  It is not the same as the
2258 minibuffer, despite the fact that the minibuffer appears (when active)
2259 in the same place on the screen as the echo area.  The `XEmacs Lisp
2260 Reference Manual' specifies the rules for resolving conflicts between
2261 the echo area and the minibuffer for use of that screen space (*note
2262 The Minibuffer: (xemacs)Minibuffer.).  Error messages appear in the
2263 echo area; see *Note Errors::.
2264
2265    You can write output in the echo area by using the Lisp printing
2266 functions with `t' as the stream (*note Output Functions::), or as
2267 follows:
2268
2269  - Function: message string &rest arguments
2270      This function displays a one-line message in the echo area.  The
2271      argument STRING is similar to a C language `printf' control
2272      string.  See `format' in *Note String Conversion::, for the details
2273      on the conversion specifications.  `message' returns the
2274      constructed string.
2275
2276      In batch mode, `message' prints the message text on the standard
2277      error stream, followed by a newline.
2278
2279      If STRING is `nil', `message' clears the echo area.  If the
2280      minibuffer is active, this brings the minibuffer contents back onto
2281      the screen immediately.
2282
2283           (message "Minibuffer depth is %d."
2284                    (minibuffer-depth))
2285            -| Minibuffer depth is 0.
2286           => "Minibuffer depth is 0."
2287           
2288           ---------- Echo Area ----------
2289           Minibuffer depth is 0.
2290           ---------- Echo Area ----------
2291
2292    In addition to only displaying a message, XEmacs allows you to
2293 "label" your messages, giving you fine-grained control of their
2294 display.  Message label is a symbol denoting the message type.  Some
2295 standard labels are:
2296
2297    * `message'--default label used by the `message' function;
2298
2299    * `error'--default label used for reporting errors;
2300
2301    * `progress'--progress indicators like `Converting... 45%' (not
2302      logged by default);
2303
2304    * `prompt'--prompt-like messages like `Isearch: foo' (not logged by
2305      default);
2306
2307    * `command'--helper command messages like `Mark set' (not logged by
2308      default);
2309
2310    * `no-log'--messages that should never be logged
2311
2312    Several messages may be stacked in the echo area at once.  Lisp
2313 programs may access these messages, or remove them as appropriate, via
2314 the message stack.
2315
2316  - Function: display-message label message &optional frame stdout-p
2317      This function displays MESSAGE (a string) labeled as LABEL, as
2318      described above.
2319
2320      The FRAME argument specifies the frame to whose minibuffer the
2321      message should be printed.  This is currently unimplemented.  The
2322      STDOUT-P argument is used internally.
2323
2324           (display-message 'command "Mark set")
2325
2326  - Function: lmessage label string &rest arguments
2327      This function displays a message STRING with label LABEL.  It is
2328      similar to `message' in that it accepts a `printf'-like strings
2329      and any number of arguments.
2330
2331           ;; Display a command message.
2332           (lmessage 'command "Comment column set to %d" comment-column)
2333           
2334           ;; Display a progress message.
2335           (lmessage 'progress "Fontifying %s... (%d)" buffer percentage)
2336           
2337           ;; Display a message that should not be logged.
2338           (lmessage 'no-log "Done")
2339
2340  - Function: clear-message &optional label frame stdout-p no-restore
2341      This function remove any message with the given LABEL from the
2342      message-stack, erasing it from the echo area if it's currently
2343      displayed there.
2344
2345      If a message remains at the head of the message-stack and
2346      NO-RESTORE is `nil', it will be displayed.  The string which
2347      remains in the echo area will be returned, or `nil' if the
2348      message-stack is now empty.  If LABEL is `nil', the entire
2349      message-stack is cleared.
2350
2351           ;; Show a message, wait for 2 seconds, and restore old minibuffer
2352           ;; contents.
2353           (message "A message")
2354            -| A message
2355           => "A Message"
2356           (lmessage 'my-label "Newsflash!  Newsflash!")
2357            -| Newsflash!  Newsflash!
2358           => "Newsflash!  Newsflash!"
2359           (sit-for 2)
2360           (clear-message 'my-label)
2361            -| A message
2362           => "A message"
2363
2364      Unless you need the return value or you need to specify a label,
2365      you should just use `(message nil)'.
2366
2367  - Function: current-message &optional frame
2368      This function returns the current message in the echo area, or
2369      `nil'.  The FRAME argument is currently unused.
2370
2371    Some of the messages displayed in the echo area are also recorded in
2372 the ` *Message-Log*' buffer.  Exactly which messages will be recorded
2373 can be tuned using the following variables.
2374
2375  - User Option: log-message-max-size
2376      This variable specifies the maximum size of the ` *Message-log*'
2377      buffer.
2378
2379  - Variable: log-message-ignore-labels
2380      This variable specifies the labels whose messages will not be
2381      logged.  It should be a list of symbols.
2382
2383  - Variable: log-message-ignore-regexps
2384      This variable specifies the regular expressions matching messages
2385      that will not be logged.  It should be a list of regular
2386      expressions.
2387
2388      Normally, packages that generate messages that might need to be
2389      ignored should label them with `progress', `prompt', or `no-log',
2390      so they can be filtered by `log-message-ignore-labels'.
2391
2392  - Variable: echo-keystrokes
2393      This variable determines how much time should elapse before command
2394      characters echo.  Its value must be a number, which specifies the
2395      number of seconds to wait before echoing.  If the user types a
2396      prefix key (such as `C-x') and then delays this many seconds
2397      before continuing, the prefix key is echoed in the echo area.  Any
2398      subsequent characters in the same command will be echoed as well.
2399
2400      If the value is zero, then command input is not echoed.
2401
2402  - Variable: cursor-in-echo-area
2403      This variable controls where the cursor appears when a message is
2404      displayed in the echo area.  If it is non-`nil', then the cursor
2405      appears at the end of the message.  Otherwise, the cursor appears
2406      at point--not in the echo area at all.
2407
2408      The value is normally `nil'; Lisp programs bind it to `t' for
2409      brief periods of time.
2410
2411 \1f
2412 File: lispref.info,  Node: Warnings,  Next: Invisible Text,  Prev: The Echo Area,  Up: Display
2413
2414 Warnings
2415 ========
2416
2417 XEmacs contains a facility for unified display of various warnings.
2418 Unlike errors, warnings are displayed in the situations when XEmacs
2419 encounters a problem that is recoverable, but which should be fixed for
2420 safe future operation.
2421
2422    For example, warnings are printed by the startup code when it
2423 encounters problems with X keysyms, when there is an error in `.emacs',
2424 and in other problematic situations.  Unlike messages, warnings are
2425 displayed in a separate buffer, and include an explanatory message that
2426 may span across several lines.  Here is an example of how a warning is
2427 displayed:
2428
2429      (1) (initialization/error) An error has occurred while loading ~/.emacs:
2430      
2431      Symbol's value as variable is void: bogus-variable
2432      
2433      To ensure normal operation, you should investigate the cause of the error
2434      in your initialization file and remove it.  Use the `-debug-init' option
2435      to XEmacs to view a complete error backtrace.
2436
2437    Each warning has a "class" and a "priority level".  The class is a
2438 symbol describing what sort of warning this is, such as
2439 `initialization', `resource' or `key-mapping'.
2440
2441    The warning priority level specifies how important the warning is.
2442 The recognized warning levels, in increased order of priority, are:
2443 `debug', `info', `notice', `warning', `error', `critical', `alert' and
2444 `emergency'.
2445
2446  - Function: display-warning class message &optional level
2447      This function displays a warning message MESSAGE (a string).
2448      CLASS should be a warning class symbol, as described above, or a
2449      list of such symbols.  LEVEL describes the warning priority level.
2450      If unspecified, it default to `warning'.
2451
2452           (display-warning 'resource
2453             "Bad resource specification encountered:
2454           something like
2455           
2456               Emacs*foo: bar
2457           
2458           You should replace the * with a . in order to get proper behavior when
2459           you use the specifier and/or `set-face-*' functions.")
2460           
2461           ---------- Warning buffer ----------
2462           (1) (resource/warning) Bad resource specification encountered:
2463           something like
2464           
2465               Emacs*foo: bar
2466           
2467           You should replace the * with a . in order to get proper behavior when
2468           you use the specifier and/or `set-face-*' functions.
2469           ---------- Warning buffer ----------
2470
2471  - Function: lwarn class level message &rest args
2472      This function displays a formatted labeled warning message.  As
2473      above, CLASS should be the warning class symbol, or a list of such
2474      symbols, and LEVEL should specify the warning priority level
2475      (`warning' by default).
2476
2477      Unlike in `display-warning', MESSAGE may be a formatted message,
2478      which will be, together with the rest of the arguments, passed to
2479      `format'.
2480
2481           (lwarn 'message-log 'warning
2482             "Error caught in `remove-message-hook': %s"
2483             (error-message-string e))
2484
2485  - Variable: log-warning-minimum-level
2486      This variable specifies the minimum level of warnings that should
2487      be generated.  Warnings with level lower than defined by this
2488      variable are completely ignored, as if they never happened.
2489
2490  - Variable: display-warning-minimum-level
2491      This variable specifies the minimum level of warnings that should
2492      be displayed.  Unlike `log-warning-minimum-level', setting this
2493      function does not suppress warnings entirely--they are still
2494      generated in the `*Warnings*' buffer, only they are not displayed
2495      by default.
2496
2497  - Variable: log-warning-suppressed-classes
2498      This variable specifies a list of classes that should not be
2499      logged or displayed.  If any of the class symbols associated with
2500      a warning is the same as any of the symbols listed here, the
2501      warning will be completely ignored, as it they never happened.
2502
2503  - Variable: display-warning-suppressed-classes
2504      This variable specifies a list of classes that should not be
2505      logged or displayed.  If any of the class symbols associated with
2506      a warning is the same as any of the symbols listed here, the
2507      warning will not be displayed.  The warning will still logged in
2508      the *Warnings* buffer (unless also contained in
2509      `log-warning-suppressed-classes'), but the buffer will not be
2510      automatically popped up.
2511
2512 \1f
2513 File: lispref.info,  Node: Invisible Text,  Next: Selective Display,  Prev: Warnings,  Up: Display
2514
2515 Invisible Text
2516 ==============
2517
2518 You can make characters "invisible", so that they do not appear on the
2519 screen, with the `invisible' property.  This can be either a text
2520 property or a property of an overlay.
2521
2522    In the simplest case, any non-`nil' `invisible' property makes a
2523 character invisible.  This is the default case--if you don't alter the
2524 default value of `buffer-invisibility-spec', this is how the
2525 `invisibility' property works.  This feature is much like selective
2526 display (*note Selective Display::), but more general and cleaner.
2527
2528    More generally, you can use the variable `buffer-invisibility-spec'
2529 to control which values of the `invisible' property make text
2530 invisible.  This permits you to classify the text into different subsets
2531 in advance, by giving them different `invisible' values, and
2532 subsequently make various subsets visible or invisible by changing the
2533 value of `buffer-invisibility-spec'.
2534
2535    Controlling visibility with `buffer-invisibility-spec' is especially
2536 useful in a program to display the list of entries in a data base.  It
2537 permits the implementation of convenient filtering commands to view
2538 just a part of the entries in the data base.  Setting this variable is
2539 very fast, much faster than scanning all the text in the buffer looking
2540 for properties to change.
2541
2542  - Variable: buffer-invisibility-spec
2543      This variable specifies which kinds of `invisible' properties
2544      actually make a character invisible.
2545
2546     `t'
2547           A character is invisible if its `invisible' property is
2548           non-`nil'.  This is the default.
2549
2550     a list
2551           Each element of the list makes certain characters invisible.
2552           Ultimately, a character is invisible if any of the elements
2553           of this list applies to it.  The list can have two kinds of
2554           elements:
2555
2556          `ATOM'
2557                A character is invisible if its `invisible' property
2558                value is ATOM or if it is a list with ATOM as a member.
2559
2560          `(ATOM . t)'
2561                A character is invisible if its `invisible' property
2562                value is ATOM or if it is a list with ATOM as a member.
2563                Moreover, if this character is at the end of a line and
2564                is followed by a visible newline, it displays an
2565                ellipsis.
2566
2567    Ordinarily, commands that operate on text or move point do not care
2568 whether the text is invisible.  However, the user-level line motion
2569 commands explicitly ignore invisible newlines.  Since this causes a
2570 slow-down of these commands it is turned off by default, controlled by
2571 the variable `line-move-ignore-invisible'.
2572
2573 \1f
2574 File: lispref.info,  Node: Selective Display,  Next: Overlay Arrow,  Prev: Invisible Text,  Up: Display
2575
2576 Selective Display
2577 =================
2578
2579 "Selective display" is a pair of features that hide certain lines on
2580 the screen.
2581
2582    The first variant, explicit selective display, is designed for use in
2583 a Lisp program.  The program controls which lines are hidden by altering
2584 the text.  Outline mode has traditionally used this variant.  It has
2585 been partially replaced by the invisible text feature (*note Invisible
2586 Text::); there is a new version of Outline mode which uses that instead.
2587
2588    In the second variant, the choice of lines to hide is made
2589 automatically based on indentation.  This variant is designed to be a
2590 user-level feature.
2591
2592    The way you control explicit selective display is by replacing a
2593 newline (control-j) with a carriage return (control-m).  The text that
2594 was formerly a line following that newline is now invisible.  Strictly
2595 speaking, it is temporarily no longer a line at all, since only newlines
2596 can separate lines; it is now part of the previous line.
2597
2598    Selective display does not directly affect editing commands.  For
2599 example, `C-f' (`forward-char') moves point unhesitatingly into
2600 invisible text.  However, the replacement of newline characters with
2601 carriage return characters affects some editing commands.  For example,
2602 `next-line' skips invisible lines, since it searches only for newlines.
2603 Modes that use selective display can also define commands that take
2604 account of the newlines, or that make parts of the text visible or
2605 invisible.
2606
2607    When you write a selectively displayed buffer into a file, all the
2608 control-m's are output as newlines.  This means that when you next read
2609 in the file, it looks OK, with nothing invisible.  The selective display
2610 effect is seen only within XEmacs.
2611
2612  - Variable: selective-display
2613      This buffer-local variable enables selective display.  This means
2614      that lines, or portions of lines, may be made invisible.
2615
2616         * If the value of `selective-display' is `t', then any portion
2617           of a line that follows a control-m is not displayed.
2618
2619         * If the value of `selective-display' is a positive integer,
2620           then lines that start with more than that many columns of
2621           indentation are not displayed.
2622
2623      When some portion of a buffer is invisible, the vertical movement
2624      commands operate as if that portion did not exist, allowing a
2625      single `next-line' command to skip any number of invisible lines.
2626      However, character movement commands (such as `forward-char') do
2627      not skip the invisible portion, and it is possible (if tricky) to
2628      insert or delete text in an invisible portion.
2629
2630      In the examples below, we show the _display appearance_ of the
2631      buffer `foo', which changes with the value of `selective-display'.
2632      The _contents_ of the buffer do not change.
2633
2634           (setq selective-display nil)
2635                => nil
2636           
2637           ---------- Buffer: foo ----------
2638           1 on this column
2639            2on this column
2640             3n this column
2641             3n this column
2642            2on this column
2643           1 on this column
2644           ---------- Buffer: foo ----------
2645           
2646           (setq selective-display 2)
2647                => 2
2648           
2649           ---------- Buffer: foo ----------
2650           1 on this column
2651            2on this column
2652            2on this column
2653           1 on this column
2654           ---------- Buffer: foo ----------
2655
2656  - Variable: selective-display-ellipses
2657      If this buffer-local variable is non-`nil', then XEmacs displays
2658      `...' at the end of a line that is followed by invisible text.
2659      This example is a continuation of the previous one.
2660
2661           (setq selective-display-ellipses t)
2662                => t
2663           
2664           ---------- Buffer: foo ----------
2665           1 on this column
2666            2on this column ...
2667            2on this column
2668           1 on this column
2669           ---------- Buffer: foo ----------
2670
2671      You can use a display table to substitute other text for the
2672      ellipsis (`...').  *Note Display Tables::.
2673
2674 \1f
2675 File: lispref.info,  Node: Overlay Arrow,  Next: Temporary Displays,  Prev: Selective Display,  Up: Display
2676
2677 The Overlay Arrow
2678 =================
2679
2680 The "overlay arrow" is useful for directing the user's attention to a
2681 particular line in a buffer.  For example, in the modes used for
2682 interface to debuggers, the overlay arrow indicates the line of code
2683 about to be executed.
2684
2685  - Variable: overlay-arrow-string
2686      This variable holds the string to display to call attention to a
2687      particular line, or `nil' if the arrow feature is not in use.
2688      Despite its name, the value of this variable can be either a string
2689      or a glyph (*note Glyphs::).
2690
2691  - Variable: overlay-arrow-position
2692      This variable holds a marker that indicates where to display the
2693      overlay arrow.  It should point at the beginning of a line.  The
2694      arrow text appears at the beginning of that line, overlaying any
2695      text that would otherwise appear.  Since the arrow is usually
2696      short, and the line usually begins with indentation, normally
2697      nothing significant is overwritten.
2698
2699      The overlay string is displayed only in the buffer that this marker
2700      points into.  Thus, only one buffer can have an overlay arrow at
2701      any given time.
2702
2703    You can do the same job by creating an extent with a `begin-glyph'
2704 property.  *Note Extent Properties::.
2705
2706 \1f
2707 File: lispref.info,  Node: Temporary Displays,  Next: Blinking,  Prev: Overlay Arrow,  Up: Display
2708
2709 Temporary Displays
2710 ==================
2711
2712 Temporary displays are used by commands to put output into a buffer and
2713 then present it to the user for perusal rather than for editing.  Many
2714 of the help commands use this feature.
2715
2716  - Special Form: with-output-to-temp-buffer buffer-name forms...
2717      This function executes FORMS while arranging to insert any output
2718      they print into the buffer named BUFFER-NAME.  The buffer is then
2719      shown in some window for viewing, displayed but not selected.
2720
2721      The string BUFFER-NAME specifies the temporary buffer, which need
2722      not already exist.  The argument must be a string, not a buffer.
2723      The buffer is erased initially (with no questions asked), and it is
2724      marked as unmodified after `with-output-to-temp-buffer' exits.
2725
2726      `with-output-to-temp-buffer' binds `standard-output' to the
2727      temporary buffer, then it evaluates the forms in FORMS.  Output
2728      using the Lisp output functions within FORMS goes by default to
2729      that buffer (but screen display and messages in the echo area,
2730      although they are "output" in the general sense of the word, are
2731      not affected).  *Note Output Functions::.
2732
2733      The value of the last form in FORMS is returned.
2734
2735           ---------- Buffer: foo ----------
2736            This is the contents of foo.
2737           ---------- Buffer: foo ----------
2738           
2739           (with-output-to-temp-buffer "foo"
2740               (print 20)
2741               (print standard-output))
2742           => #<buffer foo>
2743           
2744           ---------- Buffer: foo ----------
2745           20
2746           
2747           #<buffer foo>
2748           
2749           ---------- Buffer: foo ----------
2750
2751  - Variable: temp-buffer-show-function
2752      If this variable is non-`nil', `with-output-to-temp-buffer' calls
2753      it as a function to do the job of displaying a help buffer.  The
2754      function gets one argument, which is the buffer it should display.
2755
2756      In Emacs versions 18 and earlier, this variable was called
2757      `temp-buffer-show-hook'.
2758
2759  - Function: momentary-string-display string position &optional char
2760           message
2761      This function momentarily displays STRING in the current buffer at
2762      POSITION.  It has no effect on the undo list or on the buffer's
2763      modification status.
2764
2765      The momentary display remains until the next input event.  If the
2766      next input event is CHAR, `momentary-string-display' ignores it
2767      and returns.  Otherwise, that event remains buffered for
2768      subsequent use as input.  Thus, typing CHAR will simply remove the
2769      string from the display, while typing (say) `C-f' will remove the
2770      string from the display and later (presumably) move point forward.
2771      The argument CHAR is a space by default.
2772
2773      The return value of `momentary-string-display' is not meaningful.
2774
2775      You can do the same job in a more general way by creating an extent
2776      with a begin-glyph property.  *Note Extent Properties::.
2777
2778      If MESSAGE is non-`nil', it is displayed in the echo area while
2779      STRING is displayed in the buffer.  If it is `nil', a default
2780      message says to type CHAR to continue.
2781
2782      In this example, point is initially located at the beginning of the
2783      second line:
2784
2785           ---------- Buffer: foo ----------
2786           This is the contents of foo.
2787           -!-Second line.
2788           ---------- Buffer: foo ----------
2789           
2790           (momentary-string-display
2791             "**** Important Message! ****"
2792             (point) ?\r
2793             "Type RET when done reading")
2794           => t
2795           
2796           ---------- Buffer: foo ----------
2797           This is the contents of foo.
2798           **** Important Message! ****Second line.
2799           ---------- Buffer: foo ----------
2800           
2801           ---------- Echo Area ----------
2802           Type RET when done reading
2803           ---------- Echo Area ----------
2804
2805      This function works by actually changing the text in the buffer.
2806      As a result, if you later undo in this buffer, you will see the
2807      message come and go.
2808
2809 \1f
2810 File: lispref.info,  Node: Blinking,  Next: Usual Display,  Prev: Temporary Displays,  Up: Display
2811
2812 Blinking Parentheses
2813 ====================
2814
2815 This section describes the mechanism by which XEmacs shows a matching
2816 open parenthesis when the user inserts a close parenthesis.
2817
2818  - Variable: blink-paren-function
2819      The value of this variable should be a function (of no arguments)
2820      to be called whenever a character with close parenthesis syntax is
2821      inserted.  The value of `blink-paren-function' may be `nil', in
2822      which case nothing is done.
2823
2824           *Please note:* This variable was named `blink-paren-hook' in
2825           older Emacs versions, but since it is not called with the
2826           standard convention for hooks, it was renamed to
2827           `blink-paren-function' in version 19.
2828
2829  - Variable: blink-matching-paren
2830      If this variable is `nil', then `blink-matching-open' does nothing.
2831
2832  - Variable: blink-matching-paren-distance
2833      This variable specifies the maximum distance to scan for a matching
2834      parenthesis before giving up.
2835
2836  - Variable: blink-matching-paren-delay
2837      This variable specifies the number of seconds for the cursor to
2838      remain at the matching parenthesis.  A fraction of a second often
2839      gives good results, but the default is 1, which works on all
2840      systems.
2841
2842  - Command: blink-matching-open
2843      This function is the default value of `blink-paren-function'.  It
2844      assumes that point follows a character with close parenthesis
2845      syntax and moves the cursor momentarily to the matching opening
2846      character.  If that character is not already on the screen, it
2847      displays the character's context in the echo area.  To avoid long
2848      delays, this function does not search farther than
2849      `blink-matching-paren-distance' characters.
2850
2851      Here is an example of calling this function explicitly.
2852
2853           (defun interactive-blink-matching-open ()
2854             "Indicate momentarily the start of sexp before point."
2855             (interactive)
2856             (let ((blink-matching-paren-distance
2857                    (buffer-size))
2858                   (blink-matching-paren t))
2859               (blink-matching-open)))
2860
2861 \1f
2862 File: lispref.info,  Node: Usual Display,  Next: Display Tables,  Prev: Blinking,  Up: Display
2863
2864 Usual Display Conventions
2865 =========================
2866
2867 The usual display conventions define how to display each character
2868 code.  You can override these conventions by setting up a display table
2869 (*note Display Tables::).  Here are the usual display conventions:
2870
2871    * Character codes 32 through 126 map to glyph codes 32 through 126.
2872      Normally this means they display as themselves.
2873
2874    * Character code 9 is a horizontal tab.  It displays as whitespace
2875      up to a position determined by `tab-width'.
2876
2877    * Character code 10 is a newline.
2878
2879    * All other codes in the range 0 through 31, and code 127, display
2880      in one of two ways according to the value of `ctl-arrow'.  If it is
2881      non-`nil', these codes map to sequences of two glyphs, where the
2882      first glyph is the ASCII code for `^'.  (A display table can
2883      specify a glyph to use instead of `^'.)  Otherwise, these codes map
2884      just like the codes in the range 128 to 255.
2885
2886    * Character codes 128 through 255 map to sequences of four glyphs,
2887      where the first glyph is the ASCII code for `\', and the others are
2888      digit characters representing the code in octal.  (A display table
2889      can specify a glyph to use instead of `\'.)
2890
2891    The usual display conventions apply even when there is a display
2892 table, for any character whose entry in the active display table is
2893 `nil'.  Thus, when you set up a display table, you need only specify
2894 the characters for which you want unusual behavior.
2895
2896    These variables affect the way certain characters are displayed on
2897 the screen.  Since they change the number of columns the characters
2898 occupy, they also affect the indentation functions.
2899
2900  - User Option: ctl-arrow
2901      This buffer-local variable controls how control characters are
2902      displayed.  If it is non-`nil', they are displayed as a caret
2903      followed by the character: `^A'.  If it is `nil', they are
2904      displayed as a backslash followed by three octal digits: `\001'.
2905
2906  - Variable: default-ctl-arrow
2907      The value of this variable is the default value for `ctl-arrow' in
2908      buffers that do not override it.  *Note Default Value::.
2909
2910  - User Option: tab-width
2911      The value of this variable is the spacing between tab stops used
2912      for displaying tab characters in Emacs buffers.  The default is 8.
2913      Note that this feature is completely independent from the
2914      user-settable tab stops used by the command `tab-to-tab-stop'.
2915      *Note Indent Tabs::.
2916
2917 \1f
2918 File: lispref.info,  Node: Display Tables,  Next: Beeping,  Prev: Usual Display,  Up: Display
2919
2920 Display Tables
2921 ==============
2922
2923 You can use the "display table" feature to control how all 256 possible
2924 character codes display on the screen.  This is useful for displaying
2925 European languages that have letters not in the ASCII character set.
2926
2927    The display table maps each character code into a sequence of
2928 "runes", each rune being an image that takes up one character position
2929 on the screen.  You can also define how to display each rune on your
2930 terminal, using the "rune table".
2931
2932 * Menu:
2933
2934 * Display Table Format::        What a display table consists of.
2935 * Active Display Table::        How XEmacs selects a display table to use.
2936 * Character Descriptors::       Format of an individual element of a
2937                                   display table.
2938
2939 \1f
2940 File: lispref.info,  Node: Display Table Format,  Next: Active Display Table,  Up: Display Tables
2941
2942 Display Table Format
2943 --------------------
2944
2945 A display table is an array of 256 elements. (In FSF Emacs, a display
2946 table is 262 elements.  The six extra elements specify the truncation
2947 and continuation glyphs, etc.  This method is very kludgey, and in
2948 XEmacs the variables `truncation-glyph', `continuation-glyph', etc. are
2949 used.  *Note Truncation::.)
2950
2951  - Function: make-display-table
2952      This creates and returns a display table.  The table initially has
2953      `nil' in all elements.
2954
2955    The 256 elements correspond to character codes; the Nth element says
2956 how to display the character code N.  The value should be `nil', a
2957 string, a glyph, or a vector of strings and glyphs (*note Character
2958 Descriptors::).  If an element is `nil', it says to display that
2959 character according to the usual display conventions (*note Usual
2960 Display::).
2961
2962    If you use the display table to change the display of newline
2963 characters, the whole buffer will be displayed as one long "line."
2964
2965    For example, here is how to construct a display table that mimics the
2966 effect of setting `ctl-arrow' to a non-`nil' value:
2967
2968      (setq disptab (make-display-table))
2969      (let ((i 0))
2970        (while (< i 32)
2971          (or (= i ?\t) (= i ?\n)
2972              (aset disptab i (concat "^" (char-to-string (+ i 64)))))
2973          (setq i (1+ i)))
2974        (aset disptab 127 "^?"))
2975
2976 \1f
2977 File: lispref.info,  Node: Active Display Table,  Next: Character Descriptors,  Prev: Display Table Format,  Up: Display Tables
2978
2979 Active Display Table
2980 --------------------
2981
2982 The active display table is controlled by the variable
2983 `current-display-table'.  This is a specifier, which means that you can
2984 specify separate values for it in individual buffers, windows, frames,
2985 and devices, as well as a global value.  It also means that you cannot
2986 set this variable using `setq'; use `set-specifier' instead.  *Note
2987 Specifiers::. (FSF Emacs uses `window-display-table',
2988 `buffer-display-table', `standard-display-table', etc. to control the
2989 display table.  However, specifiers are a cleaner and more powerful way
2990 of doing the same thing.  FSF Emacs also uses a different format for
2991 the contents of a display table, using additional indirection to a
2992 "glyph table" and such.  Note that "glyph" has a different meaning in
2993 XEmacs.)
2994
2995  - Variable: current-display-table
2996      The display table currently in use.  This is a specifier.
2997
2998      Display tables are used to control how characters are displayed.
2999      Each time that redisplay processes a character, it is looked up in
3000      all the display tables that apply (obtained by calling
3001      `specifier-instance' on `current-display-table' and any overriding
3002      display tables specified in currently active faces).  The first
3003      entry found that matches the character determines how the
3004      character is displayed.  If there is no matching entry, the
3005      default display method is used. (Non-control characters are
3006      displayed as themselves and control characters are displayed
3007      according to the buffer-local variable `ctl-arrow'.  Control
3008      characters are further affected by `control-arrow-glyph' and
3009      `octal-escape-glyph'.)
3010
3011      Each instantiator in this specifier and the display-table
3012      specifiers in faces is a display table or a list of such tables.
3013      If a list, each table will be searched in turn for an entry
3014      matching a particular character.  Each display table is one of
3015
3016         * A vector, specifying values for characters starting at 0.
3017
3018         * A char table, either of type `char' or `generic'.
3019
3020         * A range table.
3021
3022      Each entry in a display table should be one of
3023
3024         * nil (this entry is ignored and the search continues).
3025
3026         * A character (use this character; if it happens to be the same
3027           as the original character, default processing happens,
3028           otherwise redisplay attempts to display this character
3029           directly; #### At some point recursive display-table lookup
3030           will be implemented).
3031
3032         * A string (display each character in the string directly; ####
3033           At some point recursive display-table lookup will be
3034           implemented).
3035
3036         * A glyph (display the glyph; #### At some point recursive
3037           display-table lookup will be implemented when a string glyph
3038           is being processed).
3039
3040         * A cons of the form (format "STRING") where STRING is a
3041           printf-like spec used to process the character. ####
3042           Unfortunately no formatting directives other than %% are
3043           implemented.
3044
3045         * A vector (each element of the vector is processed recursively;
3046           in such a case, nil elements in the vector are simply
3047           ignored).
3048
3049           #### At some point in the near future, display tables are
3050           likely to be expanded to include other features, such as
3051           referencing characters in particular fonts and allowing the
3052           character search to continue all the way up the chain of
3053           specifier instantiators.  These features are necessary to
3054           properly display Unicode characters.
3055
3056    Individual faces can also specify an overriding display table; this
3057 is set using `set-face-display-table'.  *Note Faces::.
3058
3059    If no display table can be determined for a particular window, then
3060 XEmacs uses the usual display conventions.  *Note Usual Display::.
3061
3062 \1f
3063 File: lispref.info,  Node: Character Descriptors,  Prev: Active Display Table,  Up: Display Tables
3064
3065 Character Descriptors
3066 ---------------------
3067
3068 Each element of the display-table vector describes how to display a
3069 particular character and is called a "character descriptor".  A
3070 character descriptor can be:
3071
3072 a string
3073      Display this particular string wherever the character is to be
3074      displayed.
3075
3076 a glyph
3077      Display this particular glyph wherever the character is to be
3078      displayed.
3079
3080 a vector
3081      The vector may contain strings and/or glyphs.  Display the
3082      elements of the vector one after another wherever the character is
3083      to be displayed.
3084
3085 `nil'
3086      Display according to the standard interpretation (*note Usual
3087      Display::).
3088
3089 \1f
3090 File: lispref.info,  Node: Beeping,  Prev: Display Tables,  Up: Display
3091
3092 Beeping
3093 =======
3094
3095 You can make XEmacs ring a bell, play a sound, or blink the screen to
3096 attract the user's attention.  Be conservative about how often you do
3097 this; frequent bells can become irritating.  Also be careful not to use
3098 beeping alone when signaling an error is appropriate.  (*Note Errors::.)
3099
3100  - Function: ding &optional dont-terminate sound device
3101      This function beeps, or flashes the screen (see `visible-bell'
3102      below).  It also terminates any keyboard macro currently executing
3103      unless DONT-TERMINATE is non-`nil'.  If SOUND is specified, it
3104      should be a symbol specifying which sound to make.  This sound
3105      will be played if `visible-bell' is `nil'. (This only works if
3106      sound support was compiled into the executable and you are running
3107      on the console of a Sun SparcStation, SGI, HP9000s700, or Linux
3108      PC. Otherwise you just get a beep.) The optional third argument
3109      specifies what device to make the sound on, and defaults to the
3110      selected device.
3111
3112  - Function: beep &optional dont-terminate sound device
3113      This is a synonym for `ding'.
3114
3115  - User Option: visible-bell
3116      This variable determines whether XEmacs should flash the screen to
3117      represent a bell.  Non-`nil' means yes, `nil' means no.  On TTY
3118      devices, this is effective only if the Termcap entry for the
3119      terminal type has the visible bell flag (`vb') set.
3120
3121  - Variable: sound-alist
3122      This variable holds an alist associating names with sounds.  When
3123      `beep' or `ding' is called with one of the name symbols, the
3124      associated sound will be generated instead of the standard beep.
3125
3126      Each element of `sound-alist' is a list describing a sound.  The
3127      first element of the list is the name of the sound being defined.
3128      Subsequent elements of the list are alternating keyword/value
3129      pairs:
3130
3131     `sound'
3132           A string of raw sound data, or the name of another sound to
3133           play.  The symbol `t' here means use the default X beep.
3134
3135     `volume'
3136           An integer from 0-100, defaulting to `bell-volume'.
3137
3138     `pitch'
3139           If using the default X beep, the pitch (Hz) to generate.
3140
3141     `duration'
3142           If using the default X beep, the duration (milliseconds).
3143
3144      For compatibility, elements of `sound-alist' may also be:
3145
3146         * `( sound-name . <sound> )'
3147
3148         * `( sound-name <volume> <sound> )'
3149
3150      You should probably add things to this list by calling the function
3151      `load-sound-file'.
3152
3153      Caveats:
3154
3155         - You can only play audio data if running on the console screen
3156           of a Sun SparcStation, SGI, or HP9000s700.
3157
3158         - The pitch, duration, and volume options are available
3159           everywhere, but many X servers ignore the `pitch' option.
3160
3161      The following beep-types are used by XEmacs itself:
3162
3163     `auto-save-error'
3164           when an auto-save does not succeed
3165
3166     `command-error'
3167           when the XEmacs command loop catches an error
3168
3169     `undefined-key'
3170           when you type a key that is undefined
3171
3172     `undefined-click'
3173           when you use an undefined mouse-click combination
3174
3175     `no-completion'
3176           during completing-read
3177
3178     `y-or-n-p'
3179           when you type something other than 'y' or 'n'
3180
3181     `yes-or-no-p'
3182           when you type something other than 'yes' or 'no'
3183
3184     `default'
3185           used when nothing else is appropriate.
3186
3187      Other lisp packages may use other beep types, but these are the
3188      ones that the C kernel of XEmacs uses.
3189
3190  - User Option: bell-volume
3191      This variable specifies the default volume for sounds, from 0 to
3192      100.
3193
3194  - Command: load-default-sounds
3195      This function loads and installs some sound files as beep-types.
3196
3197  - Command: load-sound-file filename sound-name &optional volume
3198      This function reads in an audio file and adds it to `sound-alist'.
3199      The sound file must be in the Sun/NeXT U-LAW format.  SOUND-NAME
3200      should be a symbol, specifying the name of the sound.  If VOLUME
3201      is specified, the sound will be played at that volume; otherwise,
3202      the value of `bell-volume' will be used.
3203
3204  - Function: play-sound sound &optional volume device
3205      This function plays sound SOUND, which should be a symbol
3206      mentioned in `sound-alist'.  If VOLUME is specified, it overrides
3207      the value (if any) specified in `sound-alist'.  DEVICE specifies
3208      the device to play the sound on, and defaults to the selected
3209      device.
3210
3211  - Command: play-sound-file file &optional volume device
3212      This function plays the named sound file at volume VOLUME, which
3213      defaults to `bell-volume'.  DEVICE specifies the device to play
3214      the sound on, and defaults to the selected device.
3215
3216 \1f
3217 File: lispref.info,  Node: Hash Tables,  Next: Range Tables,  Prev: Display,  Up: Top
3218
3219 Hash Tables
3220 ***********
3221
3222  - Function: hash-table-p object
3223      This function returns `t' if OBJECT is a hash table, else `nil'.
3224
3225 * Menu:
3226
3227 * Introduction to Hash Tables:: Hash tables are fast data structures for
3228                                 implementing simple tables (i.e. finite
3229                                 mappings from keys to values).
3230 * Working With Hash Tables::    Hash table functions.
3231 * Weak Hash Tables::            Hash tables with special garbage-collection
3232                                 behavior.
3233
3234 \1f
3235 File: lispref.info,  Node: Introduction to Hash Tables,  Next: Working With Hash Tables,  Up: Hash Tables
3236
3237 Introduction to Hash Tables
3238 ===========================
3239
3240 A "hash table" is a data structure that provides mappings from
3241 arbitrary Lisp objects called "keys" to other arbitrary Lisp objects
3242 called "values".  A key/value pair is sometimes called an "entry" in
3243 the hash table.  There are many ways other than hash tables of
3244 implementing the same sort of mapping, e.g.  association lists (*note
3245 Association Lists::) and property lists (*note Property Lists::), but
3246 hash tables provide much faster lookup when there are many entries in
3247 the mapping.  Hash tables are an implementation of the abstract data
3248 type "dictionary", also known as "associative array".
3249
3250    Internally, hash tables are hashed using the "linear probing" hash
3251 table implementation method.  This method hashes each key to a
3252 particular spot in the hash table, and then scans forward sequentially
3253 until a blank entry is found.  To look up a key, hash to the appropriate
3254 spot, then search forward for the key until either a key is found or a
3255 blank entry stops the search.  This method is used in preference to
3256 double hashing because of changes in recent hardware.  The penalty for
3257 non-sequential access to memory has been increasing, and this
3258 compensates for the problem of clustering that linear probing entails.
3259
3260    When hash tables are created, the user may (but is not required to)
3261 specify initial properties that influence performance.
3262
3263    Use the `:size' parameter to specify the number of entries that are
3264 likely to be stored in the hash table, to avoid the overhead of resizing
3265 the table.  But if the pre-allocated space for the entries is never
3266 used, it is simply wasted and makes XEmacs slower.  Excess unused hash
3267 table entries exact a small continuous performance penalty, since they
3268 must be scanned at every garbage collection.  If the number of entries
3269 in the hash table is unknown, simply avoid using the `:size' keyword.
3270
3271    Use the `:rehash-size' and `:rehash-threshold' keywords to adjust
3272 the algorithm for deciding when to rehash the hash table.  For
3273 temporary hash tables that are going to be very heavily used, use a
3274 small rehash threshold, for example, 0.4 and a large rehash size, for
3275 example 2.0.  For permanent hash tables that will be infrequently used,
3276 specify a large rehash threshold, for example 0.8.
3277
3278    Hash tables can also be created by the lisp reader using structure
3279 syntax, for example:
3280      #s(hash-table size 20 data (foo 1 bar 2))
3281
3282    The structure syntax accepts the same keywords as `make-hash-table'
3283 (without the `:' character), as well as the additional keyword `data',
3284 which specifies the initial hash table contents.
3285
3286  - Function: make-hash-table &key `test' `size' `rehash-size'
3287           `rehash-threshold' `weakness'
3288      This function returns a new empty hash table object.
3289
3290      Keyword `:test' can be `eq', `eql' (default) or `equal'.
3291      Comparison between keys is done using this function.  If speed is
3292      important, consider using `eq'.  When storing strings in the hash
3293      table, you will likely need to use `equal'.
3294
3295      Keyword `:size' specifies the number of keys likely to be inserted.
3296      This number of entries can be inserted without enlarging the hash
3297      table.
3298
3299      Keyword `:rehash-size' must be a float greater than 1.0, and
3300      specifies the factor by which to increase the size of the hash
3301      table when enlarging.
3302
3303      Keyword `:rehash-threshold' must be a float between 0.0 and 1.0,
3304      and specifies the load factor of the hash table which triggers
3305      enlarging.
3306
3307      Non-standard keyword `:weakness' can be `nil' (default), `t',
3308      `key-and-value', `key', `value' or `key-or-value'.  `t' is an
3309      alias for `key-and-value'.
3310
3311      A key-and-value-weak hash table, also known as a fully-weak or
3312      simply as a weak hash table, is one whose pointers do not count as
3313      GC referents: for any key-value pair in the hash table, if the only
3314      remaining pointer to either the key or the value is in a weak hash
3315      table, then the pair will be removed from the hash table, and the
3316      key and value collected.  A non-weak hash table (or any other
3317      pointer) would prevent the object from being collected.
3318
3319      A key-weak hash table is similar to a fully-weak hash table except
3320      that a key-value pair will be removed only if the key remains
3321      unmarked outside of weak hash tables.  The pair will remain in the
3322      hash table if the key is pointed to by something other than a weak
3323      hash table, even if the value is not.
3324
3325      A value-weak hash table is similar to a fully-weak hash table
3326      except that a key-value pair will be removed only if the value
3327      remains unmarked outside of weak hash tables.  The pair will
3328      remain in the hash table if the value is pointed to by something
3329      other than a weak hash table, even if the key is not.
3330
3331      A key-or-value-weak hash table is similar to a fully-weak hash
3332      table except that a key-value pair will be removed only if the
3333      value and the key remain unmarked outside of weak hash tables.
3334      The pair will remain in the hash table if the value or key are
3335      pointed to by something other than a weak hash table, even if the
3336      other is not.
3337
3338  - Function: copy-hash-table hash-table
3339      This function returns a new hash table which contains the same
3340      keys and values as HASH-TABLE.  The keys and values will not
3341      themselves be copied.
3342
3343  - Function: hash-table-count hash-table
3344      This function returns the number of entries in HASH-TABLE.
3345
3346  - Function: hash-table-test hash-table
3347      This function returns the test function of HASH-TABLE.  This can
3348      be one of `eq', `eql' or `equal'.
3349
3350  - Function: hash-table-size hash-table
3351      This function returns the current number of slots in HASH-TABLE,
3352      whether occupied or not.
3353
3354  - Function: hash-table-rehash-size hash-table
3355      This function returns the current rehash size of HASH-TABLE.  This
3356      is a float greater than 1.0; the factor by which HASH-TABLE is
3357      enlarged when the rehash threshold is exceeded.
3358
3359  - Function: hash-table-rehash-threshold hash-table
3360      This function returns the current rehash threshold of HASH-TABLE.
3361      This is a float between 0.0 and 1.0; the maximum "load factor" of
3362      HASH-TABLE, beyond which the HASH-TABLE is enlarged by rehashing.
3363
3364  - Function: hash-table-weakness hash-table
3365      This function returns the weakness of HASH-TABLE.  This can be one
3366      of `nil', `t', `key' or `value'.
3367
3368 \1f
3369 File: lispref.info,  Node: Working With Hash Tables,  Next: Weak Hash Tables,  Prev: Introduction to Hash Tables,  Up: Hash Tables
3370
3371 Working With Hash Tables
3372 ========================
3373
3374  - Function: puthash key value hash-table
3375      This function hashes KEY to VALUE in HASH-TABLE.
3376
3377  - Function: gethash key hash-table &optional default
3378      This function finds the hash value for KEY in HASH-TABLE.  If
3379      there is no entry for KEY in HASH-TABLE, DEFAULT is returned
3380      (which in turn defaults to `nil').
3381
3382  - Function: remhash key hash-table
3383      This function removes the entry for KEY from HASH-TABLE.  Does
3384      nothing if there is no entry for KEY in HASH-TABLE.
3385
3386  - Function: clrhash hash-table
3387      This function removes all entries from HASH-TABLE, leaving it
3388      empty.
3389
3390  - Function: maphash function hash-table
3391      This function maps FUNCTION over entries in HASH-TABLE, calling it
3392      with two args, each key and value in the hash table.
3393
3394      FUNCTION may not modify HASH-TABLE, with the one exception that
3395      FUNCTION may remhash or puthash the entry currently being
3396      processed by FUNCTION.
3397
3398 \1f
3399 File: lispref.info,  Node: Weak Hash Tables,  Prev: Working With Hash Tables,  Up: Hash Tables
3400
3401 Weak Hash Tables
3402 ================
3403
3404 A "weak hash table" is a special variety of hash table whose elements
3405 do not count as GC referents.  For any key-value pair in such a hash
3406 table, if either the key or value (or in some cases, if one particular
3407 one of the two) has no references to it outside of weak hash tables
3408 (and similar structures such as weak lists), the pair will be removed
3409 from the table, and the key and value collected.  A non-weak hash table
3410 (or any other pointer) would prevent the objects from being collected.
3411
3412    Weak hash tables are useful for keeping track of information in a
3413 non-obtrusive way, for example to implement caching.  If the cache
3414 contains objects such as buffers, markers, image instances, etc. that
3415 will eventually disappear and get garbage-collected, using a weak hash
3416 table ensures that these objects are collected normally rather than
3417 remaining around forever, long past their actual period of use.
3418 (Otherwise, you'd have to explicitly map over the hash table every so
3419 often and remove unnecessary elements.)
3420
3421    There are four types of weak hash tables:
3422
3423 key-and-value-weak hash tables
3424      In these hash tables, also known as fully weak or simply as weak
3425      hash tables, a pair disappears if either the key or the value is
3426      unreferenced outside of the table.
3427
3428 key-weak hash tables
3429      In these hash tables, a pair disappears if the key is unreferenced
3430      outside of the table, regardless of how the value is referenced.
3431
3432 value-weak hash tables
3433      In these hash tables, a pair disappears if the value is
3434      unreferenced outside of the table, regardless of how the key is
3435      referenced.
3436
3437 key-or-value-weak hash tables
3438      In these hash tables, a pair disappears if both the key and the
3439      value are unreferenced outside of the table.
3440
3441    Also see *Note Weak Lists::.
3442
3443    Weak hash tables are created by specifying the `:weakness' keyword to
3444 `make-hash-table'.
3445
3446 \1f
3447 File: lispref.info,  Node: Range Tables,  Next: Databases,  Prev: Hash Tables,  Up: Top
3448
3449 Range Tables
3450 ************
3451
3452 A range table is a table that efficiently associated values with ranges
3453 of integers.
3454
3455    Note that range tables have a read syntax, like this:
3456
3457      #s(range-table data ((-3 2) foo (5 20) bar))
3458
3459    This maps integers in the range (-3, 2) to `foo' and integers in the
3460 range (5, 20) to `bar'.
3461
3462  - Function: range-table-p object
3463      Return non-`nil' if OBJECT is a range table.
3464
3465 * Menu:
3466
3467 * Introduction to Range Tables:: Range tables efficiently map ranges of
3468                                  integers to values.
3469 * Working With Range Tables::    Range table functions.
3470
3471 \1f
3472 File: lispref.info,  Node: Introduction to Range Tables,  Next: Working With Range Tables,  Up: Range Tables
3473
3474 Introduction to Range Tables
3475 ============================
3476
3477  - Function: make-range-table
3478      Make a new, empty range table.
3479
3480  - Function: copy-range-table range-table
3481      This function returns a new range table which contains the same
3482      values for the same ranges as RANGE-TABLE.  The values will not
3483      themselves be copied.
3484
3485 \1f
3486 File: lispref.info,  Node: Working With Range Tables,  Prev: Introduction to Range Tables,  Up: Range Tables
3487
3488 Working With Range Tables
3489 =========================
3490
3491  - Function: get-range-table pos range-table &optional default
3492      This function finds value for position POS in RANGE-TABLE.  If
3493      there is no corresponding value, return DEFAULT (defaults to
3494      `nil').
3495
3496  - Function: put-range-table start end value range-table
3497      This function sets the value for range (START, END) to be VALUE in
3498      RANGE-TABLE.
3499
3500  - Function: remove-range-table start end range-table
3501      This function removes the value for range (START, END) in
3502      RANGE-TABLE.
3503
3504  - Function: clear-range-table range-table
3505      This function flushes RANGE-TABLE.
3506
3507  - Function: map-range-table function range-table
3508      This function maps FUNCTION over entries in RANGE-TABLE, calling
3509      it with three args, the beginning and end of the range and the
3510      corresponding value.
3511
3512 \1f
3513 File: lispref.info,  Node: Databases,  Next: Processes,  Prev: Range Tables,  Up: Top
3514
3515 Databases
3516 *********
3517
3518  - Function: databasep object
3519      This function returns non-`nil' if OBJECT is a database.
3520
3521 * Menu:
3522
3523 * Connecting to a Database::
3524 * Working With a Database::
3525 * Other Database Functions::
3526
3527 \1f
3528 File: lispref.info,  Node: Connecting to a Database,  Next: Working With a Database,  Up: Databases
3529
3530 Connecting to a Database
3531 ========================
3532
3533  - Function: open-database file &optional type subtype access mode
3534      This function opens database FILE, using database method TYPE and
3535      SUBTYPE, with access rights ACCESS and permissions MODE.  ACCESS
3536      can be any combination of `r' `w' and `+', for read, write, and
3537      creation flags.
3538
3539      TYPE can have the value `'dbm' or `'berkeley-db' to select the
3540      type of database file to use.  (Note:  XEmacs may not support both
3541      of these types.)
3542
3543      For a TYPE of `'dbm', there are no subtypes, so SUBTYPE should be
3544      `nil'.
3545
3546      For a TYPE of `'berkeley-db', the following subtypes are
3547      available:  `'hash', `'btree', and `'recno'.  See the manpages for
3548      the Berkeley DB functions for more information about these types.
3549
3550  - Function: close-database database
3551      This function closes database DATABASE.
3552
3553  - Function: database-live-p object
3554      This function returns `t' if OBJECT is an active database, else
3555      `nil'.
3556
3557 \1f
3558 File: lispref.info,  Node: Working With a Database,  Next: Other Database Functions,  Prev: Connecting to a Database,  Up: Databases
3559
3560 Working With a Database
3561 =======================
3562
3563  - Function: get-database key database &optional default
3564      This function finds the value for KEY in DATABASE.  If there is no
3565      corresponding value, DEFAULT is returned (`nil' if DEFAULT is
3566      omitted).
3567
3568  - Function: map-database function database
3569      This function maps FUNCTION over entries in DATABASE, calling it
3570      with two args, each key and value in the database.
3571
3572  - Function: put-database key value database &optional replace
3573      This function stores KEY and VALUE in DATABASE.  If optional
3574      fourth arg REPLACE is non-`nil', replace any existing entry in the
3575      database.
3576
3577  - Function: remove-database key database
3578      This function removes KEY from DATABASE.
3579
3580 \1f
3581 File: lispref.info,  Node: Other Database Functions,  Prev: Working With a Database,  Up: Databases
3582
3583 Other Database Functions
3584 ========================
3585
3586  - Function: database-file-name database
3587      This function returns the filename associated with DATABASE.
3588
3589  - Function: database-last-error &optional database
3590      This function returns the last error associated with DATABASE.
3591
3592  - Function: database-subtype database
3593      This function returns the subtype of DATABASE, if any.
3594
3595  - Function: database-type database
3596      This function returns the type of DATABASE.
3597
3598 \1f
3599 File: lispref.info,  Node: Processes,  Next: System Interface,  Prev: Databases,  Up: Top
3600
3601 Processes
3602 *********
3603
3604 In the terminology of operating systems, a "process" is a space in
3605 which a program can execute.  XEmacs runs in a process.  XEmacs Lisp
3606 programs can invoke other programs in processes of their own.  These are
3607 called "subprocesses" or "child processes" of the XEmacs process, which
3608 is their "parent process".
3609
3610    A subprocess of XEmacs may be "synchronous" or "asynchronous",
3611 depending on how it is created.  When you create a synchronous
3612 subprocess, the Lisp program waits for the subprocess to terminate
3613 before continuing execution.  When you create an asynchronous
3614 subprocess, it can run in parallel with the Lisp program.  This kind of
3615 subprocess is represented within XEmacs by a Lisp object which is also
3616 called a "process".  Lisp programs can use this object to communicate
3617 with the subprocess or to control it.  For example, you can send
3618 signals, obtain status information, receive output from the process, or
3619 send input to it.
3620
3621  - Function: processp object
3622      This function returns `t' if OBJECT is a process, `nil' otherwise.
3623
3624 * Menu:
3625
3626 * Subprocess Creation::      Functions that start subprocesses.
3627 * Synchronous Processes::    Details of using synchronous subprocesses.
3628 * MS-DOS Subprocesses::      On MS-DOS, you must indicate text vs binary
3629                                 for data sent to and from a subprocess.
3630 * Asynchronous Processes::   Starting up an asynchronous subprocess.
3631 * Deleting Processes::       Eliminating an asynchronous subprocess.
3632 * Process Information::      Accessing run-status and other attributes.
3633 * Input to Processes::       Sending input to an asynchronous subprocess.
3634 * Signals to Processes::     Stopping, continuing or interrupting
3635                                an asynchronous subprocess.
3636 * Output from Processes::    Collecting output from an asynchronous subprocess.
3637 * Sentinels::                Sentinels run when process run-status changes.
3638 * Process Window Size::      Changing the logical window size of a process.
3639 * Transaction Queues::       Transaction-based communication with subprocesses.
3640 * Network::                  Opening network connections.
3641
3642 \1f
3643 File: lispref.info,  Node: Subprocess Creation,  Next: Synchronous Processes,  Up: Processes
3644
3645 Functions that Create Subprocesses
3646 ==================================
3647
3648 There are three functions that create a new subprocess in which to run
3649 a program.  One of them, `start-process', creates an asynchronous
3650 process and returns a process object (*note Asynchronous Processes::).
3651 The other two, `call-process' and `call-process-region', create a
3652 synchronous process and do not return a process object (*note
3653 Synchronous Processes::).
3654
3655    Synchronous and asynchronous processes are explained in the following
3656 sections.  Since the three functions are all called in a similar
3657 fashion, their common arguments are described here.
3658
3659    In all cases, the function's PROGRAM argument specifies the program
3660 to be run.  An error is signaled if the file is not found or cannot be
3661 executed.  If the file name is relative, the variable `exec-path'
3662 contains a list of directories to search.  Emacs initializes
3663 `exec-path' when it starts up, based on the value of the environment
3664 variable `PATH'.  The standard file name constructs, `~', `.', and
3665 `..', are interpreted as usual in `exec-path', but environment variable
3666 substitutions (`$HOME', etc.) are not recognized; use
3667 `substitute-in-file-name' to perform them (*note File Name Expansion::).
3668
3669    Each of the subprocess-creating functions has a BUFFER-OR-NAME
3670 argument which specifies where the standard output from the program will
3671 go.  If BUFFER-OR-NAME is `nil', that says to discard the output unless
3672 a filter function handles it.  (*Note Filter Functions::, and *Note
3673 Read and Print::.)  Normally, you should avoid having multiple
3674 processes send output to the same buffer because their output would be
3675 intermixed randomly.
3676
3677    All three of the subprocess-creating functions have a `&rest'
3678 argument, ARGS.  The ARGS must all be strings, and they are supplied to
3679 PROGRAM as separate command line arguments.  Wildcard characters and
3680 other shell constructs are not allowed in these strings, since they are
3681 passed directly to the specified program.
3682
3683    *Please note:* The argument PROGRAM contains only the name of the
3684 program; it may not contain any command-line arguments.  You must use
3685 ARGS to provide those.
3686
3687    If you want to use features of the shell, then invoke the shell
3688 directly using, for example, PROGRAM of `"sh"', and ARGS of `"-c"' and
3689 "COMMAND LINE...".
3690
3691    The subprocess gets its current directory from the value of
3692 `default-directory' (*note File Name Expansion::).
3693
3694    The subprocess inherits its environment from XEmacs; but you can
3695 specify overrides for it with `process-environment'.  *Note System
3696 Environment::.
3697
3698  - Variable: exec-directory
3699      The value of this variable is the name of a directory (a string)
3700      that contains programs that come with XEmacs, that are intended
3701      for XEmacs to invoke.  The program `wakeup' is an example of such
3702      a program; the `display-time' command uses it to get a reminder
3703      once per minute.
3704
3705  - User Option: exec-path
3706      The value of this variable is a list of directories to search for
3707      programs to run in subprocesses.  Each element is either the name
3708      of a directory (i.e., a string), or `nil', which stands for the
3709      default directory (which is the value of `default-directory').
3710
3711      The value of `exec-path' is used by `call-process' and
3712      `start-process' when the PROGRAM argument is not an absolute file
3713      name.
3714
3715 \1f
3716 File: lispref.info,  Node: Synchronous Processes,  Next: MS-DOS Subprocesses,  Prev: Subprocess Creation,  Up: Processes
3717
3718 Creating a Synchronous Process
3719 ==============================
3720
3721 After a "synchronous process" is created, XEmacs waits for the process
3722 to terminate before continuing.  Starting Dired is an example of this:
3723 it runs `ls' in a synchronous process, then modifies the output
3724 slightly.  Because the process is synchronous, the entire directory
3725 listing arrives in the buffer before XEmacs tries to do anything with
3726 it.
3727
3728    While Emacs waits for the synchronous subprocess to terminate, the
3729 user can quit by typing `C-g'.  The first `C-g' tries to kill the
3730 subprocess with a `SIGINT' signal; but it waits until the subprocess
3731 actually terminates before quitting.  If during that time the user
3732 types another `C-g', that kills the subprocess instantly with `SIGKILL'
3733 and quits immediately.  *Note Quitting::.
3734
3735    The synchronous subprocess functions returned `nil' in version 18.
3736 In version 19, they return an indication of how the process terminated.
3737
3738  - Function: call-process program &optional infile destination display
3739           &rest args
3740      This function calls PROGRAM in a separate process and waits for it
3741      to finish.
3742
3743      The standard input for the process comes from file INFILE if
3744      INFILE is not `nil' and from `/dev/null' otherwise.  The argument
3745      DESTINATION says where to put the process output.  Here are the
3746      possibilities:
3747
3748     a buffer
3749           Insert the output in that buffer, before point.  This
3750           includes both the standard output stream and the standard
3751           error stream of the process.
3752
3753     a string
3754           Find or create a buffer with that name, then insert the
3755           output in that buffer, before point.
3756
3757     `t'
3758           Insert the output in the current buffer, before point.
3759
3760     `nil'
3761           Discard the output.
3762
3763     0
3764           Discard the output, and return immediately without waiting
3765           for the subprocess to finish.
3766
3767           In this case, the process is not truly synchronous, since it
3768           can run in parallel with Emacs; but you can think of it as
3769           synchronous in that Emacs is essentially finished with the
3770           subprocess as soon as this function returns.
3771
3772     (REAL-DESTINATION ERROR-DESTINATION)
3773           Keep the standard output stream separate from the standard
3774           error stream; deal with the ordinary output as specified by
3775           REAL-DESTINATION, and dispose of the error output according
3776           to ERROR-DESTINATION.  The value `nil' means discard it, `t'
3777           means mix it with the ordinary output, and a string specifies
3778           a file name to redirect error output into.
3779
3780           You can't directly specify a buffer to put the error output
3781           in; that is too difficult to implement.  But you can achieve
3782           this result by sending the error output to a temporary file
3783           and then inserting the file into a buffer.
3784
3785      If DISPLAY is non-`nil', then `call-process' redisplays the buffer
3786      as output is inserted.  Otherwise the function does no redisplay,
3787      and the results become visible on the screen only when XEmacs
3788      redisplays that buffer in the normal course of events.
3789
3790      The remaining arguments, ARGS, are strings that specify command
3791      line arguments for the program.
3792
3793      The value returned by `call-process' (unless you told it not to
3794      wait) indicates the reason for process termination.  A number
3795      gives the exit status of the subprocess; 0 means success, and any
3796      other value means failure.  If the process terminated with a
3797      signal, `call-process' returns a string describing the signal.
3798
3799      In the examples below, the buffer `foo' is current.
3800
3801           (call-process "pwd" nil t)
3802                => nil
3803           
3804           ---------- Buffer: foo ----------
3805           /usr/user/lewis/manual
3806           ---------- Buffer: foo ----------
3807           
3808           (call-process "grep" nil "bar" nil "lewis" "/etc/passwd")
3809                => nil
3810           
3811           ---------- Buffer: bar ----------
3812           lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh
3813           
3814           ---------- Buffer: bar ----------
3815
3816      The `insert-directory' function contains a good example of the use
3817      of `call-process':
3818
3819           (call-process insert-directory-program nil t nil switches
3820                         (if full-directory-p
3821                             (concat (file-name-as-directory file) ".")
3822                           file))
3823
3824  - Function: call-process-region start end program &optional deletep
3825           destination displayp &rest args
3826      This function sends the text between START to END as standard
3827      input to a process running PROGRAM.  It deletes the text sent if
3828      DELETEP is non-`nil'; this is useful when BUFFER is `t', to insert
3829      the output in the current buffer.
3830
3831      The arguments DESTINATION and DISPLAYP control what to do with the
3832      output from the subprocess, and whether to update the display as
3833      it comes in.  For details, see the description of `call-process',
3834      above.  If DESTINATION is the integer 0, `call-process-region'
3835      discards the output and returns `nil' immediately, without waiting
3836      for the subprocess to finish.
3837
3838      The remaining arguments, ARGS, are strings that specify command
3839      line arguments for the program.
3840
3841      The return value of `call-process-region' is just like that of
3842      `call-process': `nil' if you told it to return without waiting;
3843      otherwise, a number or string which indicates how the subprocess
3844      terminated.
3845
3846      In the following example, we use `call-process-region' to run the
3847      `cat' utility, with standard input being the first five characters
3848      in buffer `foo' (the word `input').  `cat' copies its standard
3849      input into its standard output.  Since the argument DESTINATION is
3850      `t', this output is inserted in the current buffer.
3851
3852           ---------- Buffer: foo ----------
3853           input-!-
3854           ---------- Buffer: foo ----------
3855           
3856           (call-process-region 1 6 "cat" nil t)
3857                => nil
3858           
3859           ---------- Buffer: foo ----------
3860           inputinput-!-
3861           ---------- Buffer: foo ----------
3862
3863      The `shell-command-on-region' command uses `call-process-region'
3864      like this:
3865
3866           (call-process-region
3867            start end
3868            shell-file-name      ; Name of program.
3869            nil                  ; Do not delete region.
3870            buffer               ; Send output to `buffer'.
3871            nil                  ; No redisplay during output.
3872            "-c" command)        ; Arguments for the shell.
3873
3874 \1f
3875 File: lispref.info,  Node: MS-DOS Subprocesses,  Next: Asynchronous Processes,  Prev: Synchronous Processes,  Up: Processes
3876
3877 MS-DOS Subprocesses
3878 ===================
3879
3880 On MS-DOS, you must indicate whether the data going to and from a
3881 synchronous subprocess are text or binary.  Text data requires
3882 translation between the end-of-line convention used within Emacs (a
3883 single newline character) and the convention used outside Emacs (the
3884 two-character sequence, CRLF).
3885
3886    The variable `binary-process-input' applies to input sent to the
3887 subprocess, and `binary-process-output' applies to output received from
3888 it.  A non-`nil' value means the data is non-text; `nil' means the data
3889 is text, and calls for conversion.
3890
3891  - Variable: binary-process-input
3892      If this variable is `nil', convert newlines to CRLF sequences in
3893      the input to a synchronous subprocess.
3894
3895  - Variable: binary-process-output
3896      If this variable is `nil', convert CRLF sequences to newlines in
3897      the output from a synchronous subprocess.
3898
3899    *Note Files and MS-DOS::, for related information.
3900
3901 \1f
3902 File: lispref.info,  Node: Asynchronous Processes,  Next: Deleting Processes,  Prev: MS-DOS Subprocesses,  Up: Processes
3903
3904 Creating an Asynchronous Process
3905 ================================
3906
3907 After an "asynchronous process" is created, Emacs and the Lisp program
3908 both continue running immediately.  The process may thereafter run in
3909 parallel with Emacs, and the two may communicate with each other using
3910 the functions described in following sections.  Here we describe how to
3911 create an asynchronous process with `start-process'.
3912
3913  - Function: start-process name buffer-or-name program &rest args
3914      This function creates a new asynchronous subprocess and starts the
3915      program PROGRAM running in it.  It returns a process object that
3916      stands for the new subprocess in Lisp.  The argument NAME
3917      specifies the name for the process object; if a process with this
3918      name already exists, then NAME is modified (by adding `<1>', etc.)
3919      to be unique.  The buffer BUFFER-OR-NAME is the buffer to
3920      associate with the process.
3921
3922      The remaining arguments, ARGS, are strings that specify command
3923      line arguments for the program.
3924
3925      In the example below, the first process is started and runs
3926      (rather, sleeps) for 100 seconds.  Meanwhile, the second process
3927      is started, and given the name `my-process<1>' for the sake of
3928      uniqueness.  It inserts the directory listing at the end of the
3929      buffer `foo', before the first process finishes.  Then it
3930      finishes, and a message to that effect is inserted in the buffer.
3931      Much later, the first process finishes, and another message is
3932      inserted in the buffer for it.
3933
3934           (start-process "my-process" "foo" "sleep" "100")
3935                => #<process my-process>
3936           
3937           (start-process "my-process" "foo" "ls" "-l" "/user/lewis/bin")
3938                => #<process my-process<1>>
3939           
3940           ---------- Buffer: foo ----------
3941           total 2
3942           lrwxrwxrwx  1 lewis     14 Jul 22 10:12 gnuemacs --> /emacs
3943           -rwxrwxrwx  1 lewis     19 Jul 30 21:02 lemon
3944           
3945           Process my-process<1> finished
3946           
3947           Process my-process finished
3948           ---------- Buffer: foo ----------
3949
3950  - Function: start-process-shell-command name buffer-or-name command
3951           &rest command-args
3952      This function is like `start-process' except that it uses a shell
3953      to execute the specified command.  The argument COMMAND is a shell
3954      command name, and COMMAND-ARGS are the arguments for the shell
3955      command.
3956
3957  - Variable: process-connection-type
3958      This variable controls the type of device used to communicate with
3959      asynchronous subprocesses.  If it is non-`nil', then PTYs are
3960      used, when available.  Otherwise, pipes are used.
3961
3962      PTYs are usually preferable for processes visible to the user, as
3963      in Shell mode, because they allow job control (`C-c', `C-z', etc.)
3964      to work between the process and its children whereas pipes do not.
3965      For subprocesses used for internal purposes by programs, it is
3966      often better to use a pipe, because they are more efficient.  In
3967      addition, the total number of PTYs is limited on many systems and
3968      it is good not to waste them.  A rule of thumb is to use ptys for
3969      processes the user interacts with directly, and pipes for
3970      processes that are hidden from the user.
3971
3972      The value `process-connection-type' is used when `start-process'
3973      is called.  So you can specify how to communicate with one
3974      subprocess by binding the variable around the call to
3975      `start-process'.
3976
3977           (let ((process-connection-type nil))  ; Use a pipe.
3978             (start-process ...))
3979
3980      To determine whether a given subprocess actually got a pipe or a
3981      PTY, use the function `process-tty-name' (*note Process
3982      Information::).
3983
3984    Lisp functions that manipulate processes usually accept a PROCESS
3985 argument.  Besides using an actual process object for this argument, you
3986 can use a process name, a buffer object, the name of a buffer, or
3987 `nil'.  Specifying a buffer or buffer name for the PROCESS argument
3988 means use the process associated with the buffer (or the most recent
3989 one, if there is more than one).  `nil' means use the process
3990 associated with the current buffer.  *Note Process Information::.
3991 *Note Process Buffers::.
3992
3993 \1f
3994 File: lispref.info,  Node: Deleting Processes,  Next: Process Information,  Prev: Asynchronous Processes,  Up: Processes
3995
3996 Deleting Processes
3997 ==================
3998
3999 "Deleting a process" disconnects XEmacs immediately from the
4000 subprocess, and removes it from the list of active processes.  It sends
4001 a signal to the subprocess to make the subprocess terminate, but this is
4002 not guaranteed to happen immediately.  The process object itself
4003 continues to exist as long as other Lisp objects point to it.
4004
4005    You can delete a process explicitly at any time.  Processes are
4006 deleted automatically after they terminate, but not necessarily right
4007 away.  If you delete a terminated process explicitly before it is
4008 deleted automatically, no harm results.
4009
4010  - Variable: delete-exited-processes
4011      This variable controls automatic deletion of processes that have
4012      terminated (due to calling `exit' or to a signal).  If it is
4013      `nil', then they continue to exist until the user runs
4014      `list-processes'.  Otherwise, they are deleted immediately after
4015      they exit.
4016
4017  - Function: delete-process name
4018      This function deletes the process associated with NAME, killing it
4019      with a `SIGHUP' signal.  The argument NAME may be a process, the
4020      name of a process, a buffer, or the name of a buffer.
4021
4022           (delete-process "*shell*")
4023                => nil
4024
4025  - Function: process-kill-without-query process &optional
4026           require-query-p
4027      This function declares that XEmacs need not query the user if
4028      PROCESS is still running when XEmacs is exited.  The process will
4029      be deleted silently.  If REQUIRE-QUERY-P is non-`nil', then XEmacs
4030      _will_ query the user (this is the default).  The return value is
4031      `t' if a query was formerly required, and `nil' otherwise.
4032
4033           (process-kill-without-query (get-process "shell"))
4034                => t
4035
4036 \1f
4037 File: lispref.info,  Node: Process Information,  Next: Input to Processes,  Prev: Deleting Processes,  Up: Processes
4038
4039 Process Information
4040 ===================
4041
4042 Several functions return information about processes.  `list-processes'
4043 is provided for interactive use.
4044
4045  - Command: list-processes
4046      This command displays a listing of all living processes.  In
4047      addition, it finally deletes any process whose status was `Exited'
4048      or `Signaled'.  It returns `nil'.
4049
4050  - Function: process-list
4051      This function returns a list of all processes that have not been
4052      deleted.
4053
4054           (process-list)
4055                => (#<process display-time> #<process shell>)
4056
4057  - Function: get-process process-name
4058      This function returns the process named PROCESS-NAME.  If
4059      PROCESS-NAME is a string and there is no process with that name,
4060      the value is `nil'.  If PROCESS-NAME is actually a process, it is
4061      returned as given.  (That is not very useful, so the argument is
4062      usually a name.) For example:
4063
4064           (get-process "shell")
4065                => #<process shell>
4066
4067  - Function: process-command process
4068      This function returns the command that was executed to start
4069      PROCESS.  This is a list of strings, the first string being the
4070      program executed and the rest of the strings being the arguments
4071      that were given to the program.
4072
4073           (process-command (get-process "shell"))
4074                => ("/bin/csh" "-i")
4075
4076  - Function: process-id process
4077      This function returns the PID of PROCESS.  This is an integer that
4078      distinguishes the process PROCESS from all other processes running
4079      on the same computer at the current time.  The PID of a process is
4080      chosen by the operating system kernel when the process is started
4081      and remains constant as long as the process exists.
4082
4083  - Function: process-name process
4084      This function returns the name of PROCESS.
4085
4086  - Function: process-status process
4087      This function returns the status of PROCESS as a symbol.  The
4088      argument PROCESS must be a process, a buffer, a process name
4089      (string) or a buffer name (string).
4090
4091      The possible values for an actual subprocess are:
4092
4093     `run'
4094           for a process that is running.
4095
4096     `stop'
4097           for a process that is stopped but continuable.
4098
4099     `exit'
4100           for a process that has exited.
4101
4102     `signal'
4103           for a process that has received a fatal signal.
4104
4105     `open'
4106           for a network connection that is open.
4107
4108     `closed'
4109           for a network connection that is closed.  Once a connection
4110           is closed, you cannot reopen it, though you might be able to
4111           open a new connection to the same place.
4112
4113     `nil'
4114           if PROCESS does not identify an existing process.
4115
4116           (process-status "shell")
4117                => run
4118           (process-status (get-buffer "*shell*"))
4119                => run
4120           x
4121                => #<process xx<1>>
4122           (process-status x)
4123                => exit
4124
4125      For a network connection, `process-status' returns one of the
4126      symbols `open' or `closed'.  The latter means that the other side
4127      closed the connection, or XEmacs did `delete-process'.
4128
4129      In earlier Emacs versions (prior to version 19), the status of a
4130      network connection was `run' if open, and `exit' if closed.
4131
4132  - Function: process-kill-without-query-p process
4133      This function returns whether PROCESS will be killed without
4134      querying the user, if it is running when XEmacs is exited.  The
4135      default value is `nil'.
4136
4137  - Function: process-exit-status process
4138      This function returns the exit status of PROCESS or the signal
4139      number that killed it.  (Use the result of `process-status' to
4140      determine which of those it is.)  If PROCESS has not yet
4141      terminated, the value is 0.
4142
4143  - Function: process-tty-name process
4144      This function returns the terminal name that PROCESS is using for
4145      its communication with Emacs--or `nil' if it is using pipes
4146      instead of a terminal (see `process-connection-type' in *Note
4147      Asynchronous Processes::).
4148
4149 \1f
4150 File: lispref.info,  Node: Input to Processes,  Next: Signals to Processes,  Prev: Process Information,  Up: Processes
4151
4152 Sending Input to Processes
4153 ==========================
4154
4155 Asynchronous subprocesses receive input when it is sent to them by
4156 XEmacs, which is done with the functions in this section.  You must
4157 specify the process to send input to, and the input data to send.  The
4158 data appears on the "standard input" of the subprocess.
4159
4160    Some operating systems have limited space for buffered input in a
4161 PTY.  On these systems, XEmacs sends long input in chunks, with EOF
4162 characters added amidst the other characters, to force the operating
4163 system to periodically drain the input buffer.  For most programs,
4164 these EOFs do no harm.
4165
4166  - Function: process-send-string process string &optional start end
4167      This function sends PROCESS the contents of STRING as standard
4168      input.
4169
4170      The argument PROCESS may be a process or the name of a process, or
4171      a buffer or the name of a buffer, in which case the buffer's
4172      process is used.  If it is `nil', the current buffer's process is
4173      used.
4174
4175      Optional arguments START and END specify part of STRING; see
4176      `substring'.
4177
4178      The function returns `nil'.
4179
4180           (process-send-string "shell<1>" "ls\n")
4181                => nil
4182           
4183           
4184           ---------- Buffer: *shell* ----------
4185           ...
4186           introduction.texi               syntax-tables.texi~
4187           introduction.texi~              text.texi
4188           introduction.txt                text.texi~
4189           ...
4190           ---------- Buffer: *shell* ----------
4191
4192  - Function: process-send-region process start end &optional buffer
4193      This function sends the text in the region defined by START and
4194      END as standard input to PROCESS.
4195
4196      The argument PROCESS may be a process or the name of a process, or
4197      a buffer or the name of a buffer, in which case the buffer's
4198      process is used.  If it is `nil', the current buffer's process is
4199      used.
4200
4201      An error is signaled unless both START and END are integers or
4202      markers that indicate positions in the current buffer.  (It is
4203      unimportant which number is larger.)
4204
4205  - Function: process-send-eof &optional process
4206      This function makes PROCESS see an end-of-file in its input.  The
4207      EOF comes after any text already sent to it.
4208
4209      PROCESS may be a process, a buffer, the name of a process or
4210      buffer, or `nil', indicating the current buffer's process.  An
4211      error is signaled if PROCESS does not identify any process.
4212
4213      The function returns the process object identified by PROCESS.
4214
4215           (process-send-eof "shell")
4216                => "shell"
4217
4218 \1f
4219 File: lispref.info,  Node: Signals to Processes,  Next: Output from Processes,  Prev: Input to Processes,  Up: Processes
4220
4221 Sending Signals to Processes
4222 ============================
4223
4224 "Sending a signal" to a subprocess is a way of interrupting its
4225 activities.  There are several different signals, each with its own
4226 meaning.  The set of signals and their names is defined by the operating
4227 system.  For example, the signal `SIGINT' means that the user has typed
4228 `C-c', or that some analogous thing has happened.
4229
4230    Each signal has a standard effect on the subprocess.  Most signals
4231 kill the subprocess, but some stop or resume execution instead.  Most
4232 signals can optionally be handled by programs; if the program handles
4233 the signal, then we can say nothing in general about its effects.
4234
4235    The set of signals and their names is defined by the operating
4236 system; XEmacs has facilities for sending only a few of the signals
4237 that are defined.  XEmacs can send signals only to its own subprocesses.
4238
4239    You can send signals explicitly by calling the functions in this
4240 section.  XEmacs also sends signals automatically at certain times:
4241 killing a buffer sends a `SIGHUP' signal to all its associated
4242 processes; killing XEmacs sends a `SIGHUP' signal to all remaining
4243 processes.  (`SIGHUP' is a signal that indicates that the connection
4244 between the user and the process is broken, for example if a connection
4245 via a telephone line is hung up.)
4246
4247    Each of the signal-sending functions takes two optional arguments:
4248 PROCESS and CURRENT-GROUP.
4249
4250    The argument PROCESS must be either a process or a buffer, the name
4251 of one, or `nil'.  If it is `nil', the process defaults to the process
4252 associated with the current buffer.  An error is signaled if PROCESS
4253 does not identify a process.
4254
4255    The argument CURRENT-GROUP is a flag that makes a difference when
4256 you are running a job-control shell as an XEmacs subprocess.  If it is
4257 non-`nil', then the signal is sent to the current foreground process
4258 group of the terminal that XEmacs uses to communicate with the
4259 subprocess.  If the process is a job-control shell, this means the
4260 shell's current subjob.  If it is `nil', the signal is sent to the
4261 process group of the immediate subprocess of XEmacs.  If the subprocess
4262 is a job-control shell, this is the shell itself.
4263
4264    The flag CURRENT-GROUP has no effect when a pipe is used to
4265 communicate with the subprocess, because the operating system does not
4266 support the distinction in the case of pipes.  For the same reason,
4267 job-control shells won't work when a pipe is used.  See
4268 `process-connection-type' in *Note Asynchronous Processes::.
4269
4270    Some of the functions below take a SIGNAL argument, which identifies
4271 a signal to be sent.  It must be either an integer or a symbol which
4272 names the signal, like `SIGSEGV'.
4273
4274  - Function: process-send-signal signal &optional process current-group
4275      This function sends the signal SIGNAL to the process PROCESS.  The
4276      following functions can be implemented in terms of
4277      `process-send-signal'.
4278
4279  - Function: interrupt-process &optional process current-group
4280      This function interrupts the process PROCESS by sending the signal
4281      `SIGINT'.  Outside of XEmacs, typing the "interrupt character"
4282      (normally `C-c') sends this signal.  When the argument
4283      CURRENT-GROUP is non-`nil', you can think of this function as
4284      "typing `C-c'" on the terminal by which XEmacs talks to the
4285      subprocess.
4286
4287  - Function: kill-process &optional process current-group
4288      This function kills the process PROCESS by sending the signal
4289      `SIGKILL'.  This signal kills the subprocess immediately, and
4290      cannot be handled by the subprocess.
4291
4292  - Function: quit-process &optional process current-group
4293      This function sends the signal `SIGQUIT' to the process PROCESS.
4294      This signal is the one sent by the "quit character" (usually
4295      `C-\') when you are not inside XEmacs.
4296
4297  - Function: stop-process &optional process current-group
4298      This function stops the process PROCESS by sending the signal
4299      `SIGTSTP'.  Use `continue-process' to resume its execution.
4300
4301      On systems with job control, the "stop character" (usually `C-z')
4302      sends this signal (outside of XEmacs).  When CURRENT-GROUP is
4303      non-`nil', you can think of this function as "typing `C-z'" on the
4304      terminal XEmacs uses to communicate with the subprocess.
4305
4306  - Function: continue-process &optional process current-group
4307      This function resumes execution of the process PROCESS by sending
4308      it the signal `SIGCONT'.  This presumes that PROCESS was stopped
4309      previously.
4310
4311  - Command: signal-process pid signal
4312      This function sends a signal to the process with process id PID,
4313      which need not be a child of XEmacs.  The argument SIGNAL
4314      specifies which signal to send.
4315
4316 \1f
4317 File: lispref.info,  Node: Output from Processes,  Next: Sentinels,  Prev: Signals to Processes,  Up: Processes
4318
4319 Receiving Output from Processes
4320 ===============================
4321
4322 There are two ways to receive the output that a subprocess writes to
4323 its standard output stream.  The output can be inserted in a buffer,
4324 which is called the associated buffer of the process, or a function
4325 called the "filter function" can be called to act on the output.  If
4326 the process has no buffer and no filter function, its output is
4327 discarded.
4328
4329 * Menu:
4330
4331 * Process Buffers::       If no filter, output is put in a buffer.
4332 * Filter Functions::      Filter functions accept output from the process.
4333 * Accepting Output::      Explicitly permitting subprocess output.
4334                             Waiting for subprocess output.
4335
4336 \1f
4337 File: lispref.info,  Node: Process Buffers,  Next: Filter Functions,  Up: Output from Processes
4338
4339 Process Buffers
4340 ---------------
4341
4342 A process can (and usually does) have an "associated buffer", which is
4343 an ordinary Emacs buffer that is used for two purposes: storing the
4344 output from the process, and deciding when to kill the process.  You
4345 can also use the buffer to identify a process to operate on, since in
4346 normal practice only one process is associated with any given buffer.
4347 Many applications of processes also use the buffer for editing input to
4348 be sent to the process, but this is not built into XEmacs Lisp.
4349
4350    Unless the process has a filter function (*note Filter Functions::),
4351 its output is inserted in the associated buffer.  The position to insert
4352 the output is determined by the `process-mark', which is then updated
4353 to point to the end of the text just inserted.  Usually, but not
4354 always, the `process-mark' is at the end of the buffer.
4355
4356  - Function: process-buffer process
4357      This function returns the associated buffer of the process PROCESS.
4358
4359           (process-buffer (get-process "shell"))
4360                => #<buffer *shell*>
4361
4362  - Function: process-mark process
4363      This function returns the process marker for PROCESS, which is the
4364      marker that says where to insert output from the process.
4365
4366      If PROCESS does not have a buffer, `process-mark' returns a marker
4367      that points nowhere.
4368
4369      Insertion of process output in a buffer uses this marker to decide
4370      where to insert, and updates it to point after the inserted text.
4371      That is why successive batches of output are inserted
4372      consecutively.
4373
4374      Filter functions normally should use this marker in the same
4375      fashion as is done by direct insertion of output in the buffer.  A
4376      good example of a filter function that uses `process-mark' is
4377      found at the end of the following section.
4378
4379      When the user is expected to enter input in the process buffer for
4380      transmission to the process, the process marker is useful for
4381      distinguishing the new input from previous output.
4382
4383  - Function: set-process-buffer process buffer
4384      This function sets the buffer associated with PROCESS to BUFFER.
4385      If BUFFER is `nil', the process becomes associated with no buffer.
4386
4387  - Function: get-buffer-process buffer-or-name
4388      This function returns the process associated with BUFFER-OR-NAME.
4389      If there are several processes associated with BUFFER-OR-NAME,
4390      then one is chosen.  (Presently, the one chosen is the one most
4391      recently created.)  It is usually a bad idea to have more than one
4392      process associated with the same buffer.
4393
4394           (get-buffer-process "*shell*")
4395                => #<process shell>
4396
4397      Killing the process's buffer deletes the process, which kills the
4398      subprocess with a `SIGHUP' signal (*note Signals to Processes::).
4399
4400 \1f
4401 File: lispref.info,  Node: Filter Functions,  Next: Accepting Output,  Prev: Process Buffers,  Up: Output from Processes
4402
4403 Process Filter Functions
4404 ------------------------
4405
4406 A process "filter function" is a function that receives the standard
4407 output from the associated process.  If a process has a filter, then
4408 _all_ output from that process is passed to the filter.  The process
4409 buffer is used directly for output from the process only when there is
4410 no filter.
4411
4412    A filter function must accept two arguments: the associated process
4413 and a string, which is the output.  The function is then free to do
4414 whatever it chooses with the output.
4415
4416    A filter function runs only while XEmacs is waiting (e.g., for
4417 terminal input, or for time to elapse, or for process output).  This
4418 avoids the timing errors that could result from running filters at
4419 random places in the middle of other Lisp programs.  You may explicitly
4420 cause Emacs to wait, so that filter functions will run, by calling
4421 `sit-for' or `sleep-for' (*note Waiting::), or `accept-process-output'
4422 (*note Accepting Output::).  Emacs is also waiting when the command loop
4423 is reading input.
4424
4425    Quitting is normally inhibited within a filter function--otherwise,
4426 the effect of typing `C-g' at command level or to quit a user command
4427 would be unpredictable.  If you want to permit quitting inside a filter
4428 function, bind `inhibit-quit' to `nil'.  *Note Quitting::.
4429
4430    If an error happens during execution of a filter function, it is
4431 caught automatically, so that it doesn't stop the execution of whatever
4432 program was running when the filter function was started.  However, if
4433 `debug-on-error' is non-`nil', the error-catching is turned off.  This
4434 makes it possible to use the Lisp debugger to debug the filter
4435 function.  *Note Debugger::.
4436
4437    Many filter functions sometimes or always insert the text in the
4438 process's buffer, mimicking the actions of XEmacs when there is no
4439 filter.  Such filter functions need to use `set-buffer' in order to be
4440 sure to insert in that buffer.  To avoid setting the current buffer
4441 semipermanently, these filter functions must use `unwind-protect' to
4442 make sure to restore the previous current buffer.  They should also
4443 update the process marker, and in some cases update the value of point.
4444 Here is how to do these things:
4445
4446      (defun ordinary-insertion-filter (process string)
4447        (let ((old-buffer (current-buffer)))
4448          (unwind-protect
4449              (let (moving)
4450                (set-buffer (process-buffer process))
4451                (setq moving (= (point) (process-mark process)))
4452                (save-excursion
4453                  ;; Insert the text, moving the process-marker.
4454                  (goto-char (process-mark process))
4455                  (insert string)
4456                  (set-marker (process-mark process) (point)))
4457                (if moving (goto-char (process-mark process))))
4458            (set-buffer old-buffer))))
4459
4460 The reason to use an explicit `unwind-protect' rather than letting
4461 `save-excursion' restore the current buffer is so as to preserve the
4462 change in point made by `goto-char'.
4463
4464    To make the filter force the process buffer to be visible whenever
4465 new text arrives, insert the following line just before the
4466 `unwind-protect':
4467
4468      (display-buffer (process-buffer process))
4469
4470    To force point to move to the end of the new output no matter where
4471 it was previously, eliminate the variable `moving' and call `goto-char'
4472 unconditionally.
4473
4474    In earlier Emacs versions, every filter function that did regexp
4475 searching or matching had to explicitly save and restore the match data.
4476 Now Emacs does this automatically; filter functions never need to do it
4477 explicitly.  *Note Match Data::.
4478
4479    A filter function that writes the output into the buffer of the
4480 process should check whether the buffer is still alive.  If it tries to
4481 insert into a dead buffer, it will get an error.  If the buffer is dead,
4482 `(buffer-name (process-buffer PROCESS))' returns `nil'.
4483
4484    The output to the function may come in chunks of any size.  A program
4485 that produces the same output twice in a row may send it as one batch
4486 of 200 characters one time, and five batches of 40 characters the next.
4487
4488  - Function: set-process-filter process filter
4489      This function gives PROCESS the filter function FILTER.  If FILTER
4490      is `nil', then the process will have no filter.  If FILTER is `t',
4491      then no output from the process will be accepted until the filter
4492      is changed. (Output received during this time is not discarded,
4493      but is queued, and will be processed as soon as the filter is
4494      changed.)
4495
4496  - Function: process-filter process
4497      This function returns the filter function of PROCESS, or `nil' if
4498      it has none.  `t' means that output processing has been stopped.
4499
4500    Here is an example of use of a filter function:
4501
4502      (defun keep-output (process output)
4503         (setq kept (cons output kept)))
4504           => keep-output
4505      (setq kept nil)
4506           => nil
4507      (set-process-filter (get-process "shell") 'keep-output)
4508           => keep-output
4509      (process-send-string "shell" "ls ~/other\n")
4510           => nil
4511      kept
4512           => ("lewis@slug[8] % "
4513      "FINAL-W87-SHORT.MSS    backup.otl              kolstad.mss~
4514      address.txt             backup.psf              kolstad.psf
4515      backup.bib~             david.mss               resume-Dec-86.mss~
4516      backup.err              david.psf               resume-Dec.psf
4517      backup.mss              dland                   syllabus.mss
4518      "
4519      "#backups.mss#          backup.mss~             kolstad.mss
4520      ")
4521
4522 \1f
4523 File: lispref.info,  Node: Accepting Output,  Prev: Filter Functions,  Up: Output from Processes
4524
4525 Accepting Output from Processes
4526 -------------------------------
4527
4528 Output from asynchronous subprocesses normally arrives only while
4529 XEmacs is waiting for some sort of external event, such as elapsed time
4530 or terminal input.  Occasionally it is useful in a Lisp program to
4531 explicitly permit output to arrive at a specific point, or even to wait
4532 until output arrives from a process.
4533
4534  - Function: accept-process-output &optional process seconds millisec
4535      This function allows XEmacs to read pending output from processes.
4536      The output is inserted in the associated buffers or given to
4537      their filter functions.  If PROCESS is non-`nil' then this
4538      function does not return until some output has been received from
4539      PROCESS.
4540
4541      The arguments SECONDS and MILLISEC let you specify timeout
4542      periods.  The former specifies a period measured in seconds and the
4543      latter specifies one measured in milliseconds.  The two time
4544      periods thus specified are added together, and
4545      `accept-process-output' returns after that much time whether or
4546      not there has been any subprocess output.  Note that SECONDS is
4547      allowed to be a floating-point number; thus, there is no need to
4548      ever use MILLISEC. (It is retained for compatibility purposes.)
4549
4550      The function `accept-process-output' returns non-`nil' if it did
4551      get some output, or `nil' if the timeout expired before output
4552      arrived.
4553
4554 \1f
4555 File: lispref.info,  Node: Sentinels,  Next: Process Window Size,  Prev: Output from Processes,  Up: Processes
4556
4557 Sentinels: Detecting Process Status Changes
4558 ===========================================
4559
4560 A "process sentinel" is a function that is called whenever the
4561 associated process changes status for any reason, including signals
4562 (whether sent by XEmacs or caused by the process's own actions) that
4563 terminate, stop, or continue the process.  The process sentinel is also
4564 called if the process exits.  The sentinel receives two arguments: the
4565 process for which the event occurred, and a string describing the type
4566 of event.
4567
4568    The string describing the event looks like one of the following:
4569
4570    * `"finished\n"'.
4571
4572    * `"exited abnormally with code EXITCODE\n"'.
4573
4574    * `"NAME-OF-SIGNAL\n"'.
4575
4576    * `"NAME-OF-SIGNAL (core dumped)\n"'.
4577
4578    A sentinel runs only while XEmacs is waiting (e.g., for terminal
4579 input, or for time to elapse, or for process output).  This avoids the
4580 timing errors that could result from running them at random places in
4581 the middle of other Lisp programs.  A program can wait, so that
4582 sentinels will run, by calling `sit-for' or `sleep-for' (*note
4583 Waiting::), or `accept-process-output' (*note Accepting Output::).
4584 Emacs is also waiting when the command loop is reading input.
4585
4586    Quitting is normally inhibited within a sentinel--otherwise, the
4587 effect of typing `C-g' at command level or to quit a user command would
4588 be unpredictable.  If you want to permit quitting inside a sentinel,
4589 bind `inhibit-quit' to `nil'.  *Note Quitting::.
4590
4591    A sentinel that writes the output into the buffer of the process
4592 should check whether the buffer is still alive.  If it tries to insert
4593 into a dead buffer, it will get an error.  If the buffer is dead,
4594 `(buffer-name (process-buffer PROCESS))' returns `nil'.
4595
4596    If an error happens during execution of a sentinel, it is caught
4597 automatically, so that it doesn't stop the execution of whatever
4598 programs was running when the sentinel was started.  However, if
4599 `debug-on-error' is non-`nil', the error-catching is turned off.  This
4600 makes it possible to use the Lisp debugger to debug the sentinel.
4601 *Note Debugger::.
4602
4603    In earlier Emacs versions, every sentinel that did regexp searching
4604 or matching had to explicitly save and restore the match data.  Now
4605 Emacs does this automatically; sentinels never need to do it explicitly.
4606 *Note Match Data::.
4607
4608  - Function: set-process-sentinel process sentinel
4609      This function associates SENTINEL with PROCESS.  If SENTINEL is
4610      `nil', then the process will have no sentinel.  The default
4611      behavior when there is no sentinel is to insert a message in the
4612      process's buffer when the process status changes.
4613
4614           (defun msg-me (process event)
4615              (princ
4616                (format "Process: %s had the event `%s'" process event)))
4617           (set-process-sentinel (get-process "shell") 'msg-me)
4618                => msg-me
4619           (kill-process (get-process "shell"))
4620                -| Process: #<process shell> had the event `killed'
4621                => #<process shell>
4622
4623  - Function: process-sentinel process
4624      This function returns the sentinel of PROCESS, or `nil' if it has
4625      none.
4626
4627  - Function: waiting-for-user-input-p
4628      While a sentinel or filter function is running, this function
4629      returns non-`nil' if XEmacs was waiting for keyboard input from
4630      the user at the time the sentinel or filter function was called,
4631      `nil' if it was not.
4632
4633 \1f
4634 File: lispref.info,  Node: Process Window Size,  Next: Transaction Queues,  Prev: Sentinels,  Up: Processes
4635
4636 Process Window Size
4637 ===================
4638
4639  - Function: set-process-window-size process height width
4640      This function tells PROCESS that its logical window size is HEIGHT
4641      by WIDTH characters.  This is principally useful with pty's.
4642
4643 \1f
4644 File: lispref.info,  Node: Transaction Queues,  Next: Network,  Prev: Process Window Size,  Up: Processes
4645
4646 Transaction Queues
4647 ==================
4648
4649 You can use a "transaction queue" for more convenient communication
4650 with subprocesses using transactions.  First use `tq-create' to create
4651 a transaction queue communicating with a specified process.  Then you
4652 can call `tq-enqueue' to send a transaction.
4653
4654  - Function: tq-create process
4655      This function creates and returns a transaction queue
4656      communicating with PROCESS.  The argument PROCESS should be a
4657      subprocess capable of sending and receiving streams of bytes.  It
4658      may be a child process, or it may be a TCP connection to a server,
4659      possibly on another machine.
4660
4661  - Function: tq-enqueue queue question regexp closure fn
4662      This function sends a transaction to queue QUEUE.  Specifying the
4663      queue has the effect of specifying the subprocess to talk to.
4664
4665      The argument QUESTION is the outgoing message that starts the
4666      transaction.  The argument FN is the function to call when the
4667      corresponding answer comes back; it is called with two arguments:
4668      CLOSURE, and the answer received.
4669
4670      The argument REGEXP is a regular expression that should match the
4671      entire answer, but nothing less; that's how `tq-enqueue' determines
4672      where the answer ends.
4673
4674      The return value of `tq-enqueue' itself is not meaningful.
4675
4676  - Function: tq-close queue
4677      Shut down transaction queue QUEUE, waiting for all pending
4678      transactions to complete, and then terminate the connection or
4679      child process.
4680
4681    Transaction queues are implemented by means of a filter function.
4682 *Note Filter Functions::.
4683
4684 \1f
4685 File: lispref.info,  Node: Network,  Prev: Transaction Queues,  Up: Processes
4686
4687 Network Connections
4688 ===================
4689
4690 XEmacs Lisp programs can open TCP network connections to other
4691 processes on the same machine or other machines.  A network connection
4692 is handled by Lisp much like a subprocess, and is represented by a
4693 process object.  However, the process you are communicating with is not
4694 a child of the XEmacs process, so you can't kill it or send it signals.
4695 All you can do is send and receive data.  `delete-process' closes the
4696 connection, but does not kill the process at the other end; that
4697 process must decide what to do about closure of the connection.
4698
4699    You can distinguish process objects representing network connections
4700 from those representing subprocesses with the `process-status'
4701 function.  It always returns either `open' or `closed' for a network
4702 connection, and it never returns either of those values for a real
4703 subprocess.  *Note Process Information::.
4704
4705  - Function: open-network-stream name buffer-or-name host service
4706           &optional protocol
4707      This function opens a TCP connection for a service to a host.  It
4708      returns a process object to represent the connection.
4709
4710      Input and output work as for other process objects.
4711      `delete-process' closes the connection.
4712
4713      The NAME argument specifies the name for the process object.  It
4714      is modified as necessary to make it unique.
4715
4716      The BUFFER-OR-NAME argument is the buffer to associate with the
4717      connection.  It can be a buffer or the name of one.  Output from
4718      the connection is inserted in the buffer, unless you specify a
4719      filter function to handle the output.  If BUFFER-OR-NAME is `nil',
4720      it means that the connection is not associated with any buffer.
4721
4722      The arguments HOST and SERVICE specify where to connect to; HOST
4723      is the host name or IP address (a string), and SERVICE is the name
4724      of a defined network service (a string) or a port number (an
4725      integer).
4726
4727      Optional fifth arg PROTOCOL is the network protocol to use.
4728      Currently only `tcp' (Transmission Control Protocol) and `udp'
4729      (User Datagram Protocol) are supported.  When omitted, `tcp' is
4730      assumed.
4731
4732      Output via `process-send-string' and input via buffer or filter
4733      (see `set-process-filter') are stream-oriented.  That means UDP
4734      datagrams are not guaranteed to be sent and received in discrete
4735      packets. (But small datagrams around 500 bytes that are not
4736      truncated by `process-send-string' are usually fine.)  Note further
4737      that the UDP protocol does not guard against lost packets.
4738
4739 \1f
4740 File: lispref.info,  Node: System Interface,  Next: X-Windows,  Prev: Processes,  Up: Top
4741
4742 Operating System Interface
4743 **************************
4744
4745 This chapter is about starting and getting out of Emacs, access to
4746 values in the operating system environment, and terminal input, output,
4747 and flow control.
4748
4749    *Note Building XEmacs::, for related information.  See also *Note
4750 Display::, for additional operating system status information
4751 pertaining to the terminal and the screen.
4752
4753 * Menu:
4754
4755 * Starting Up::         Customizing XEmacs start-up processing.
4756 * Getting Out::         How exiting works (permanent or temporary).
4757 * System Environment::  Distinguish the name and kind of system.
4758 * User Identification:: Finding the name and user id of the user.
4759 * Time of Day::         Getting the current time.
4760 * Time Conversion::     Converting a time from numeric form to a string, or
4761                           to calendrical data (or vice versa).
4762 * Timers::              Setting a timer to call a function at a certain time.
4763 * Terminal Input::      Recording terminal input for debugging.
4764 * Terminal Output::     Recording terminal output for debugging.
4765 * Flow Control::        How to turn output flow control on or off.
4766 * Batch Mode::          Running XEmacs without terminal interaction.
4767
4768 \1f
4769 File: lispref.info,  Node: Starting Up,  Next: Getting Out,  Up: System Interface
4770
4771 Starting Up XEmacs
4772 ==================
4773
4774 This section describes what XEmacs does when it is started, and how you
4775 can customize these actions.
4776
4777 * Menu:
4778
4779 * Start-up Summary::        Sequence of actions XEmacs performs at start-up.
4780 * Init File::               Details on reading the init file (`.emacs').
4781 * Terminal-Specific::       How the terminal-specific Lisp file is read.
4782 * Command Line Arguments::  How command line arguments are processed,
4783                               and how you can customize them.
4784
4785 \1f
4786 File: lispref.info,  Node: Start-up Summary,  Next: Init File,  Up: Starting Up
4787
4788 Summary: Sequence of Actions at Start Up
4789 ----------------------------------------
4790
4791 The order of operations performed (in `startup.el') by XEmacs when it
4792 is started up is as follows:
4793
4794   1. It loads the initialization library for the window system, if you
4795      are using a window system.  This library's name is
4796      `term/WINDOWSYSTEM-win.el'.
4797
4798   2. It processes the initial options.  (Some of them are handled even
4799      earlier than this.)
4800
4801   3. It initializes the X window frame and faces, if appropriate.
4802
4803   4. It runs the normal hook `before-init-hook'.
4804
4805   5. It loads the library `site-start', unless the option
4806      `-no-site-file' was specified.  The library's file name is usually
4807      `site-start.el'.
4808
4809   6. It loads the file `~/.emacs' unless `-q' was specified on the
4810      command line.  (This is not done in `-batch' mode.)  The `-u'
4811      option can specify the user name whose home directory should be
4812      used instead of `~'.
4813
4814   7. It loads the library `default' unless `inhibit-default-init' is
4815      non-`nil'.  (This is not done in `-batch' mode or if `-q' was
4816      specified on the command line.)  The library's file name is
4817      usually `default.el'.
4818
4819   8. It runs the normal hook `after-init-hook'.
4820
4821   9. It sets the major mode according to `initial-major-mode', provided
4822      the buffer `*scratch*' is still current and still in Fundamental
4823      mode.
4824
4825  10. It loads the terminal-specific Lisp file, if any, except when in
4826      batch mode or using a window system.
4827
4828  11. It displays the initial echo area message, unless you have
4829      suppressed that with `inhibit-startup-echo-area-message'.
4830
4831  12. It processes the action arguments from the command line.
4832
4833  13. It runs `term-setup-hook'.
4834
4835  14. It calls `frame-notice-user-settings', which modifies the
4836      parameters of the selected frame according to whatever the init
4837      files specify.
4838
4839  15. It runs `window-setup-hook'.  *Note Terminal-Specific::.
4840
4841  16. It displays copyleft, nonwarranty, and basic use information,
4842      provided there were no remaining command line arguments (a few
4843      steps above) and the value of `inhibit-startup-message' is `nil'.
4844
4845  - User Option: inhibit-startup-message
4846      This variable inhibits the initial startup messages (the
4847      nonwarranty, etc.).  If it is non-`nil', then the messages are not
4848      printed.
4849
4850      This variable exists so you can set it in your personal init file,
4851      once you are familiar with the contents of the startup message.
4852      Do not set this variable in the init file of a new user, or in a
4853      way that affects more than one user, because that would prevent
4854      new users from receiving the information they are supposed to see.
4855
4856  - User Option: inhibit-startup-echo-area-message
4857      This variable controls the display of the startup echo area
4858      message.  You can suppress the startup echo area message by adding
4859      text with this form to your `.emacs' file:
4860
4861           (setq inhibit-startup-echo-area-message
4862                 "YOUR-LOGIN-NAME")
4863
4864      Simply setting `inhibit-startup-echo-area-message' to your login
4865      name is not sufficient to inhibit the message; Emacs explicitly
4866      checks whether `.emacs' contains an expression as shown above.
4867      Your login name must appear in the expression as a Lisp string
4868      constant.
4869
4870      This way, you can easily inhibit the message for yourself if you
4871      wish, but thoughtless copying of your `.emacs' file will not
4872      inhibit the message for someone else.
4873
4874 \1f
4875 File: lispref.info,  Node: Init File,  Next: Terminal-Specific,  Prev: Start-up Summary,  Up: Starting Up
4876
4877 The Init File: `.emacs'
4878 -----------------------
4879
4880 When you start XEmacs, it normally attempts to load the file `.emacs'
4881 from your home directory.  This file, if it exists, must contain Lisp
4882 code.  It is called your "init file".  The command line switches `-q'
4883 and `-u' affect the use of the init file; `-q' says not to load an init
4884 file, and `-u' says to load a specified user's init file instead of
4885 yours.  *Note Entering XEmacs: (xemacs)Entering XEmacs.
4886
4887    A site may have a "default init file", which is the library named
4888 `default.el'.  XEmacs finds the `default.el' file through the standard
4889 search path for libraries (*note How Programs Do Loading::).  The
4890 XEmacs distribution does not come with this file; sites may provide one
4891 for local customizations.  If the default init file exists, it is
4892 loaded whenever you start Emacs, except in batch mode or if `-q' is
4893 specified.  But your own personal init file, if any, is loaded first; if
4894 it sets `inhibit-default-init' to a non-`nil' value, then XEmacs does
4895 not subsequently load the `default.el' file.
4896
4897    Another file for site-customization is `site-start.el'.  Emacs loads
4898 this _before_ the user's init file.  You can inhibit the loading of
4899 this file with the option `-no-site-file'.
4900
4901  - Variable: site-run-file
4902      This variable specifies the site-customization file to load before
4903      the user's init file.  Its normal value is `"site-start"'.
4904
4905    If there is a great deal of code in your `.emacs' file, you should
4906 move it into another file named `SOMETHING.el', byte-compile it (*note
4907 Byte Compilation::), and make your `.emacs' file load the other file
4908 using `load' (*note Loading::).
4909
4910    *Note Init File Examples: (xemacs)Init File Examples, for examples
4911 of how to make various commonly desired customizations in your `.emacs'
4912 file.
4913
4914  - User Option: inhibit-default-init
4915      This variable prevents XEmacs from loading the default
4916      initialization library file for your session of XEmacs.  If its
4917      value is non-`nil', then the default library is not loaded.  The
4918      default value is `nil'.
4919
4920  - Variable: before-init-hook
4921  - Variable: after-init-hook
4922      These two normal hooks are run just before, and just after,
4923      loading of the user's init file, `default.el', and/or
4924      `site-start.el'.
4925
4926 \1f
4927 File: lispref.info,  Node: Terminal-Specific,  Next: Command Line Arguments,  Prev: Init File,  Up: Starting Up
4928
4929 Terminal-Specific Initialization
4930 --------------------------------
4931
4932 Each terminal type can have its own Lisp library that XEmacs loads when
4933 run on that type of terminal.  For a terminal type named TERMTYPE, the
4934 library is called `term/TERMTYPE'.  XEmacs finds the file by searching
4935 the `load-path' directories as it does for other files, and trying the
4936 `.elc' and `.el' suffixes.  Normally, terminal-specific Lisp library is
4937 located in `emacs/lisp/term', a subdirectory of the `emacs/lisp'
4938 directory in which most XEmacs Lisp libraries are kept.
4939
4940    The library's name is constructed by concatenating the value of the
4941 variable `term-file-prefix' and the terminal type.  Normally,
4942 `term-file-prefix' has the value `"term/"'; changing this is not
4943 recommended.
4944
4945    The usual function of a terminal-specific library is to enable
4946 special keys to send sequences that XEmacs can recognize.  It may also
4947 need to set or add to `function-key-map' if the Termcap entry does not
4948 specify all the terminal's function keys.  *Note Terminal Input::.
4949
4950    When the name of the terminal type contains a hyphen, only the part
4951 of the name before the first hyphen is significant in choosing the
4952 library name.  Thus, terminal types `aaa-48' and `aaa-30-rv' both use
4953 the `term/aaa' library.  If necessary, the library can evaluate
4954 `(getenv "TERM")' to find the full name of the terminal type.
4955
4956    Your `.emacs' file can prevent the loading of the terminal-specific
4957 library by setting the variable `term-file-prefix' to `nil'.  This
4958 feature is useful when experimenting with your own peculiar
4959 customizations.
4960
4961    You can also arrange to override some of the actions of the
4962 terminal-specific library by setting the variable `term-setup-hook'.
4963 This is a normal hook which XEmacs runs using `run-hooks' at the end of
4964 XEmacs initialization, after loading both your `.emacs' file and any
4965 terminal-specific libraries.  You can use this variable to define
4966 initializations for terminals that do not have their own libraries.
4967 *Note Hooks::.
4968
4969  - Variable: term-file-prefix
4970      If the `term-file-prefix' variable is non-`nil', XEmacs loads a
4971      terminal-specific initialization file as follows:
4972
4973           (load (concat term-file-prefix (getenv "TERM")))
4974
4975      You may set the `term-file-prefix' variable to `nil' in your
4976      `.emacs' file if you do not wish to load the
4977      terminal-initialization file.  To do this, put the following in
4978      your `.emacs' file: `(setq term-file-prefix nil)'.
4979
4980  - Variable: term-setup-hook
4981      This variable is a normal hook that XEmacs runs after loading your
4982      `.emacs' file, the default initialization file (if any) and the
4983      terminal-specific Lisp file.
4984
4985      You can use `term-setup-hook' to override the definitions made by a
4986      terminal-specific file.
4987
4988  - Variable: window-setup-hook
4989      This variable is a normal hook which XEmacs runs after loading your
4990      `.emacs' file and the default initialization file (if any), after
4991      loading terminal-specific Lisp code, and after running the hook
4992      `term-setup-hook'.
4993
4994 \1f
4995 File: lispref.info,  Node: Command Line Arguments,  Prev: Terminal-Specific,  Up: Starting Up
4996
4997 Command Line Arguments
4998 ----------------------
4999
5000 You can use command line arguments to request various actions when you
5001 start XEmacs.  Since you do not need to start XEmacs more than once per
5002 day, and will often leave your XEmacs session running longer than that,
5003 command line arguments are hardly ever used.  As a practical matter, it
5004 is best to avoid making the habit of using them, since this habit would
5005 encourage you to kill and restart XEmacs unnecessarily often.  These
5006 options exist for two reasons: to be compatible with other editors (for
5007 invocation by other programs) and to enable shell scripts to run
5008 specific Lisp programs.
5009
5010    This section describes how Emacs processes command line arguments,
5011 and how you can customize them.
5012
5013  - Function: command-line
5014      This function parses the command line that XEmacs was called with,
5015      processes it, loads the user's `.emacs' file and displays the
5016      startup messages.
5017
5018  - Variable: command-line-processed
5019      The value of this variable is `t' once the command line has been
5020      processed.
5021
5022      If you redump XEmacs by calling `dump-emacs', you may wish to set
5023      this variable to `nil' first in order to cause the new dumped
5024      XEmacs to process its new command line arguments.
5025
5026  - Variable: command-switch-alist
5027      The value of this variable is an alist of user-defined command-line
5028      options and associated handler functions.  This variable exists so
5029      you can add elements to it.
5030
5031      A "command line option" is an argument on the command line of the
5032      form:
5033
5034           -OPTION
5035
5036      The elements of the `command-switch-alist' look like this:
5037
5038           (OPTION . HANDLER-FUNCTION)
5039
5040      The HANDLER-FUNCTION is called to handle OPTION and receives the
5041      option name as its sole argument.
5042
5043      In some cases, the option is followed in the command line by an
5044      argument.  In these cases, the HANDLER-FUNCTION can find all the
5045      remaining command-line arguments in the variable
5046      `command-line-args-left'.  (The entire list of command-line
5047      arguments is in `command-line-args'.)
5048
5049      The command line arguments are parsed by the `command-line-1'
5050      function in the `startup.el' file.  See also *Note Command Line
5051      Switches and Arguments: (xemacs)Command Switches.
5052
5053  - Variable: command-line-args
5054      The value of this variable is the list of command line arguments
5055      passed to XEmacs.
5056
5057  - Variable: command-line-functions
5058      This variable's value is a list of functions for handling an
5059      unrecognized command-line argument.  Each time the next argument
5060      to be processed has no special meaning, the functions in this list
5061      are called, in order of appearance, until one of them returns a
5062      non-`nil' value.
5063
5064      These functions are called with no arguments.  They can access the
5065      command-line argument under consideration through the variable
5066      `argi'.  The remaining arguments (not including the current one)
5067      are in the variable `command-line-args-left'.
5068
5069      When a function recognizes and processes the argument in `argi', it
5070      should return a non-`nil' value to say it has dealt with that
5071      argument.  If it has also dealt with some of the following
5072      arguments, it can indicate that by deleting them from
5073      `command-line-args-left'.
5074
5075      If all of these functions return `nil', then the argument is used
5076      as a file name to visit.
5077
5078 \1f
5079 File: lispref.info,  Node: Getting Out,  Next: System Environment,  Prev: Starting Up,  Up: System Interface
5080
5081 Getting out of XEmacs
5082 =====================
5083
5084 There are two ways to get out of XEmacs: you can kill the XEmacs job,
5085 which exits permanently, or you can suspend it, which permits you to
5086 reenter the XEmacs process later.  As a practical matter, you seldom
5087 kill XEmacs--only when you are about to log out.  Suspending is much
5088 more common.
5089
5090 * Menu:
5091
5092 * Killing XEmacs::        Exiting XEmacs irreversibly.
5093 * Suspending XEmacs::     Exiting XEmacs reversibly.
5094
5095 \1f
5096 File: lispref.info,  Node: Killing XEmacs,  Next: Suspending XEmacs,  Up: Getting Out
5097
5098 Killing XEmacs
5099 --------------
5100
5101 Killing XEmacs means ending the execution of the XEmacs process.  The
5102 parent process normally resumes control.  The low-level primitive for
5103 killing XEmacs is `kill-emacs'.
5104
5105  - Command: kill-emacs &optional exit-data
5106      This function exits the XEmacs process and kills it.
5107
5108      If EXIT-DATA is an integer, then it is used as the exit status of
5109      the XEmacs process.  (This is useful primarily in batch operation;
5110      see *Note Batch Mode::.)
5111
5112      If EXIT-DATA is a string, its contents are stuffed into the
5113      terminal input buffer so that the shell (or whatever program next
5114      reads input) can read them.
5115
5116    All the information in the XEmacs process, aside from files that have
5117 been saved, is lost when the XEmacs is killed.  Because killing XEmacs
5118 inadvertently can lose a lot of work, XEmacs queries for confirmation
5119 before actually terminating if you have buffers that need saving or
5120 subprocesses that are running.  This is done in the function
5121 `save-buffers-kill-emacs'.
5122
5123  - Variable: kill-emacs-query-functions
5124      After asking the standard questions, `save-buffers-kill-emacs'
5125      calls the functions in the list `kill-buffer-query-functions', in
5126      order of appearance, with no arguments.  These functions can ask
5127      for additional confirmation from the user.  If any of them returns
5128      non-`nil', XEmacs is not killed.
5129
5130  - Variable: kill-emacs-hook
5131      This variable is a normal hook; once `save-buffers-kill-emacs' is
5132      finished with all file saving and confirmation, it runs the
5133      functions in this hook.
5134
5135 \1f
5136 File: lispref.info,  Node: Suspending XEmacs,  Prev: Killing XEmacs,  Up: Getting Out
5137
5138 Suspending XEmacs
5139 -----------------
5140
5141 "Suspending XEmacs" means stopping XEmacs temporarily and returning
5142 control to its superior process, which is usually the shell.  This
5143 allows you to resume editing later in the same XEmacs process, with the
5144 same buffers, the same kill ring, the same undo history, and so on.  To
5145 resume XEmacs, use the appropriate command in the parent shell--most
5146 likely `fg'.
5147
5148    Some operating systems do not support suspension of jobs; on these
5149 systems, "suspension" actually creates a new shell temporarily as a
5150 subprocess of XEmacs.  Then you would exit the shell to return to
5151 XEmacs.
5152
5153    Suspension is not useful with window systems such as X, because the
5154 XEmacs job may not have a parent that can resume it again, and in any
5155 case you can give input to some other job such as a shell merely by
5156 moving to a different window.  Therefore, suspending is not allowed
5157 when XEmacs is an X client.
5158
5159  - Command: suspend-emacs &optional stuffstring
5160      This function stops XEmacs and returns control to the superior
5161      process.  If and when the superior process resumes XEmacs,
5162      `suspend-emacs' returns `nil' to its caller in Lisp.
5163
5164      If optional arg STUFFSTRING is non-`nil', its characters are sent
5165      to be read as terminal input by XEmacs's superior shell.  The
5166      characters in STUFFSTRING are not echoed by the superior shell;
5167      only the results appear.
5168
5169      Before suspending, `suspend-emacs' runs the normal hook
5170      `suspend-hook'.  In Emacs version 18, `suspend-hook' was not a
5171      normal hook; its value was a single function, and if its value was
5172      non-`nil', then `suspend-emacs' returned immediately without
5173      actually suspending anything.
5174
5175      After the user resumes XEmacs, `suspend-emacs' runs the normal hook
5176      `suspend-resume-hook'.  *Note Hooks::.
5177
5178      The next redisplay after resumption will redraw the entire screen,
5179      unless the variable `no-redraw-on-reenter' is non-`nil' (*note
5180      Refresh Screen::).
5181
5182      In the following example, note that `pwd' is not echoed after
5183      XEmacs is suspended.  But it is read and executed by the shell.
5184
5185           (suspend-emacs)
5186                => nil
5187           
5188           (add-hook 'suspend-hook
5189                     (function (lambda ()
5190                                 (or (y-or-n-p
5191                                       "Really suspend? ")
5192                                     (error "Suspend cancelled")))))
5193                => (lambda nil
5194                     (or (y-or-n-p "Really suspend? ")
5195                         (error "Suspend cancelled")))
5196           (add-hook 'suspend-resume-hook
5197                     (function (lambda () (message "Resumed!"))))
5198                => (lambda nil (message "Resumed!"))
5199           (suspend-emacs "pwd")
5200                => nil
5201           ---------- Buffer: Minibuffer ----------
5202           Really suspend? y
5203           ---------- Buffer: Minibuffer ----------
5204           
5205           ---------- Parent Shell ----------
5206           lewis@slug[23] % /user/lewis/manual
5207           lewis@slug[24] % fg
5208           
5209           ---------- Echo Area ----------
5210           Resumed!
5211
5212  - Variable: suspend-hook
5213      This variable is a normal hook run before suspending.
5214
5215  - Variable: suspend-resume-hook
5216      This variable is a normal hook run after suspending.
5217
5218 \1f
5219 File: lispref.info,  Node: System Environment,  Next: User Identification,  Prev: Getting Out,  Up: System Interface
5220
5221 Operating System Environment
5222 ============================
5223
5224 XEmacs provides access to variables in the operating system environment
5225 through various functions.  These variables include the name of the
5226 system, the user's UID, and so on.
5227
5228  - Variable: system-type
5229      The value of this variable is a symbol indicating the type of
5230      operating system XEmacs is operating on.  Here is a table of the
5231      possible values:
5232
5233     `aix-v3'
5234           AIX.
5235
5236     `berkeley-unix'
5237           Berkeley BSD.
5238
5239     `dgux'
5240           Data General DGUX operating system.
5241
5242     `gnu'
5243           A GNU system using the GNU HURD and Mach.
5244
5245     `hpux'
5246           Hewlett-Packard HPUX operating system.
5247
5248     `irix'
5249           Silicon Graphics Irix system.
5250
5251     `linux'
5252           A GNU system using the Linux kernel.
5253
5254     `ms-dos'
5255           Microsoft MS-DOS "operating system."
5256
5257     `next-mach'
5258           NeXT Mach-based system.
5259
5260     `rtu'
5261           Masscomp RTU, UCB universe.
5262
5263     `unisoft-unix'
5264           UniSoft UniPlus.
5265
5266     `usg-unix-v'
5267           AT&T System V.
5268
5269     `windows-nt'
5270           Microsoft windows NT.
5271
5272     `xenix'
5273           SCO Xenix 386.
5274
5275      We do not wish to add new symbols to make finer distinctions
5276      unless it is absolutely necessary!  In fact, we hope to eliminate
5277      some of these alternatives in the future.  We recommend using
5278      `system-configuration' to distinguish between different operating
5279      systems.
5280
5281  - Variable: system-configuration
5282      This variable holds the three-part configuration name for the
5283      hardware/software configuration of your system, as a string.  The
5284      convenient way to test parts of this string is with `string-match'.
5285
5286  - Function: system-name
5287      This function returns the name of the machine you are running on.
5288           (system-name)
5289                => "prep.ai.mit.edu"
5290
5291    The symbol `system-name' is a variable as well as a function.  In
5292 fact, the function returns whatever value the variable `system-name'
5293 currently holds.  Thus, you can set the variable `system-name' in case
5294 Emacs is confused about the name of your system.  The variable is also
5295 useful for constructing frame titles (*note Frame Titles::).
5296
5297  - Variable: mail-host-address
5298      If this variable is non-`nil', it is used instead of `system-name'
5299      for purposes of generating email addresses.  For example, it is
5300      used when constructing the default value of `user-mail-address'.
5301      *Note User Identification::.  (Since this is done when XEmacs
5302      starts up, the value actually used is the one saved when XEmacs
5303      was dumped.  *Note Building XEmacs::.)
5304
5305  - Command: getenv var &optional interactivep
5306      This function returns the value of the environment variable VAR,
5307      as a string.  Within XEmacs, the environment variable values are
5308      kept in the Lisp variable `process-environment'.
5309
5310      When invoked interactively, `getenv' prints the value in the echo
5311      area.
5312
5313           (getenv "USER")
5314                => "lewis"
5315           
5316           lewis@slug[10] % printenv
5317           PATH=.:/user/lewis/bin:/usr/bin:/usr/local/bin
5318           USER=lewis
5319           TERM=ibmapa16
5320           SHELL=/bin/csh
5321           HOME=/user/lewis
5322
5323  - Command: setenv variable &optional value unset
5324      This command sets the value of the environment variable named
5325      VARIABLE to VALUE.  Both arguments should be strings.  This
5326      function works by modifying `process-environment'; binding that
5327      variable with `let' is also reasonable practice.
5328
5329  - Variable: process-environment
5330      This variable is a list of strings, each describing one environment
5331      variable.  The functions `getenv' and `setenv' work by
5332      manipulating this variable.
5333
5334           process-environment
5335           => ("l=/usr/stanford/lib/gnuemacs/lisp"
5336               "PATH=.:/user/lewis/bin:/usr/class:/nfsusr/local/bin"
5337               "USER=lewis"
5338               "TERM=ibmapa16"
5339               "SHELL=/bin/csh"
5340               "HOME=/user/lewis")
5341
5342  - Variable: path-separator
5343      This variable holds a string which says which character separates
5344      directories in a search path (as found in an environment
5345      variable).  Its value is `":"' for Unix and GNU systems, and `";"'
5346      for MS-DOS and Windows NT.
5347
5348  - Variable: invocation-name
5349      This variable holds the program name under which Emacs was
5350      invoked.  The value is a string, and does not include a directory
5351      name.
5352
5353  - Variable: invocation-directory
5354      This variable holds the directory from which the Emacs executable
5355      was invoked, or perhaps `nil' if that directory cannot be
5356      determined.
5357
5358  - Variable: installation-directory
5359      If non-`nil', this is a directory within which to look for the
5360      `lib-src' and `etc' subdirectories.  This is non-`nil' when Emacs
5361      can't find those directories in their standard installed
5362      locations, but can find them in a directory related somehow to the
5363      one containing the Emacs executable.
5364
5365  - Function: load-average &optional use-floats
5366      This function returns a list of the current 1-minute, 5-minute and
5367      15-minute load averages.  The values are integers that are 100
5368      times the system load averages.  (The load averages indicate the
5369      number of processes trying to run.)
5370
5371      When USE-FLOATS is non-`nil', floats will be returned instead of
5372      integers.  These floats are not multiplied by 100.
5373
5374           (load-average)
5375                => (169 158 164)
5376           (load-average t)
5377                => (1.69921875 1.58984375 1.640625)
5378           
5379           lewis@rocky[5] % uptime
5380             8:06pm  up 16 day(s), 21:57,  40 users,
5381            load average: 1.68, 1.59, 1.64
5382
5383      If the 5-minute or 15-minute load averages are not available,
5384      return a shortened list, containing only those averages which are
5385      available.
5386
5387      On some systems, this function may require special privileges to
5388      run, or it may be unimplemented for the particular system type.
5389      In that case, the function will signal an error.
5390
5391  - Function: emacs-pid
5392      This function returns the process ID of the Emacs process.
5393
5394 \1f
5395 File: lispref.info,  Node: User Identification,  Next: Time of Day,  Prev: System Environment,  Up: System Interface
5396
5397 User Identification
5398 ===================
5399
5400  - Variable: user-mail-address
5401      This holds the nominal email address of the user who is using
5402      Emacs.  When Emacs starts up, it computes a default value that is
5403      usually right, but users often set this themselves when the
5404      default value is not right.
5405
5406  - Function: user-login-name &optional uid
5407      If you don't specify UID, this function returns the name under
5408      which the user is logged in.  If the environment variable `LOGNAME'
5409      is set, that value is used.  Otherwise, if the environment variable
5410      `USER' is set, that value is used.  Otherwise, the value is based
5411      on the effective UID, not the real UID.
5412
5413      If you specify UID, the value is the user name that corresponds to
5414      UID (which should be an integer).
5415
5416           (user-login-name)
5417                => "lewis"
5418
5419  - Function: user-real-login-name
5420      This function returns the user name corresponding to Emacs's real
5421      UID.  This ignores the effective UID and ignores the environment
5422      variables `LOGNAME' and `USER'.
5423
5424  - Variable: user-full-name
5425      This variable holds the name of the user running this Emacs.  It is
5426      initialized at startup time from the value of `NAME' environment
5427      variable.  You can change the value of this variable to alter the
5428      result of the `user-full-name' function.
5429
5430  - Function: user-full-name &optional user
5431      This function returns the full name of USER.  If USER is `nil', it
5432      defaults to the user running this Emacs.  In that case, the value
5433      of `user-full-name' variable, if non-`nil', will be used.
5434
5435      If USER is specified explicitly, `user-full-name' variable is
5436      ignored.
5437
5438           (user-full-name)
5439                => "Hrvoje Niksic"
5440           (setq user-full-name "Hrvoje \"Niksa\" Niksic")
5441           (user-full-name)
5442                => "Hrvoje \"Niksa\" Niksic"
5443           (user-full-name "hniksic")
5444                => "Hrvoje Niksic"
5445
5446    The symbols `user-login-name', `user-real-login-name' and
5447 `user-full-name' are variables as well as functions.  The functions
5448 return the same values that the variables hold.  These variables allow
5449 you to "fake out" Emacs by telling the functions what to return.  The
5450 variables are also useful for constructing frame titles (*note Frame
5451 Titles::).
5452
5453  - Function: user-real-uid
5454      This function returns the real UID of the user.
5455
5456           (user-real-uid)
5457                => 19
5458
5459  - Function: user-uid
5460      This function returns the effective UID of the user.
5461
5462  - Function: user-home-directory
5463      This function returns the "`HOME'" directory of the user, and is
5464      intended to replace occurrences of "`(getenv "HOME")'".  Under
5465      Unix systems, the following is done:
5466
5467        1. Return the value of "`(getenv "HOME")'", if set.
5468
5469        2. Return "/", as a fallback, but issue a warning.  (Future
5470           versions of XEmacs will also attempt to lookup the `HOME'
5471           directory via `getpwent()', but this has not yet been
5472           implemented.)
5473
5474      Under MS Windows, this is done:
5475
5476        1. Return the value of "`(getenv "HOME")'", if set.
5477
5478        2. If the environment variables `HOMEDRIVE' and `HOMEDIR' are
5479           both set, return the concatenation (the following description
5480           uses MS Windows environment variable substitution syntax):
5481           `%HOMEDRIVE%%HOMEDIR%'.
5482
5483        3. Return "C:\", as a fallback, but issue a warning.
5484
5485 \1f
5486 File: lispref.info,  Node: Time of Day,  Next: Time Conversion,  Prev: User Identification,  Up: System Interface
5487
5488 Time of Day
5489 ===========
5490
5491 This section explains how to determine the current time and the time
5492 zone.
5493
5494  - Function: current-time-string &optional time-value
5495      This function returns the current time and date as a
5496      humanly-readable string.  The format of the string is unvarying;
5497      the number of characters used for each part is always the same, so
5498      you can reliably use `substring' to extract pieces of it.  It is
5499      wise to count the characters from the beginning of the string
5500      rather than from the end, as additional information may be added
5501      at the end.
5502
5503      The argument TIME-VALUE, if given, specifies a time to format
5504      instead of the current time.  The argument should be a list whose
5505      first two elements are integers.  Thus, you can use times obtained
5506      from `current-time' (see below) and from `file-attributes' (*note
5507      File Attributes::).
5508
5509           (current-time-string)
5510                => "Wed Oct 14 22:21:05 1987"
5511
5512  - Function: current-time
5513      This function returns the system's time value as a list of three
5514      integers: `(HIGH LOW MICROSEC)'.  The integers HIGH and LOW
5515      combine to give the number of seconds since 0:00 January 1, 1970,
5516      which is HIGH * 2**16 + LOW.
5517
5518      The third element, MICROSEC, gives the microseconds since the
5519      start of the current second (or 0 for systems that return time
5520      only on the resolution of a second).
5521
5522      The first two elements can be compared with file time values such
5523      as you get with the function `file-attributes'.  *Note File
5524      Attributes::.
5525
5526  - Function: current-time-zone &optional time-value
5527      This function returns a list describing the time zone that the
5528      user is in.
5529
5530      The value has the form `(OFFSET NAME)'.  Here OFFSET is an integer
5531      giving the number of seconds ahead of UTC (east of Greenwich).  A
5532      negative value means west of Greenwich.  The second element, NAME
5533      is a string giving the name of the time zone.  Both elements
5534      change when daylight savings time begins or ends; if the user has
5535      specified a time zone that does not use a seasonal time
5536      adjustment, then the value is constant through time.
5537
5538      If the operating system doesn't supply all the information
5539      necessary to compute the value, both elements of the list are
5540      `nil'.
5541
5542      The argument TIME-VALUE, if given, specifies a time to analyze
5543      instead of the current time.  The argument should be a cons cell
5544      containing two integers, or a list whose first two elements are
5545      integers.  Thus, you can use times obtained from `current-time'
5546      (see above) and from `file-attributes' (*note File Attributes::).
5547
5548 \1f
5549 File: lispref.info,  Node: Time Conversion,  Next: Timers,  Prev: Time of Day,  Up: System Interface
5550
5551 Time Conversion
5552 ===============
5553
5554 These functions convert time values (lists of two or three integers) to
5555 strings or to calendrical information.  There is also a function to
5556 convert calendrical information to a time value.  You can get time
5557 values from the functions `current-time' (*note Time of Day::) and
5558 `file-attributes' (*note File Attributes::).
5559
5560  - Function: format-time-string format-string &optional time
5561      This function converts TIME to a string according to
5562      FORMAT-STRING.  If TIME is omitted, it defaults to the current
5563      time.  The argument FORMAT-STRING may contain `%'-sequences which
5564      say to substitute parts of the time.  Here is a table of what the
5565      `%'-sequences mean:
5566
5567     `%a'
5568           This stands for the abbreviated name of the day of week.
5569
5570     `%A'
5571           This stands for the full name of the day of week.
5572
5573     `%b'
5574           This stands for the abbreviated name of the month.
5575
5576     `%B'
5577           This stands for the full name of the month.
5578
5579     `%c'
5580           This is a synonym for `%x %X'.
5581
5582     `%C'
5583           This has a locale-specific meaning.  In the default locale
5584           (named C), it is equivalent to `%A, %B %e, %Y'.
5585
5586     `%d'
5587           This stands for the day of month, zero-padded.
5588
5589     `%D'
5590           This is a synonym for `%m/%d/%y'.
5591
5592     `%e'
5593           This stands for the day of month, blank-padded.
5594
5595     `%h'
5596           This is a synonym for `%b'.
5597
5598     `%H'
5599           This stands for the hour (00-23).
5600
5601     `%I'
5602           This stands for the hour (00-12).
5603
5604     `%j'
5605           This stands for the day of the year (001-366).
5606
5607     `%k'
5608           This stands for the hour (0-23), blank padded.
5609
5610     `%l'
5611           This stands for the hour (1-12), blank padded.
5612
5613     `%m'
5614           This stands for the month (01-12).
5615
5616     `%M'
5617           This stands for the minute (00-59).
5618
5619     `%n'
5620           This stands for a newline.
5621
5622     `%p'
5623           This stands for `AM' or `PM', as appropriate.
5624
5625     `%r'
5626           This is a synonym for `%I:%M:%S %p'.
5627
5628     `%R'
5629           This is a synonym for `%H:%M'.
5630
5631     `%S'
5632           This stands for the seconds (00-60).
5633
5634     `%t'
5635           This stands for a tab character.
5636
5637     `%T'
5638           This is a synonym for `%H:%M:%S'.
5639
5640     `%U'
5641           This stands for the week of the year (01-52), assuming that
5642           weeks start on Sunday.
5643
5644     `%w'
5645           This stands for the numeric day of week (0-6).  Sunday is day
5646           0.
5647
5648     `%W'
5649           This stands for the week of the year (01-52), assuming that
5650           weeks start on Monday.
5651
5652     `%x'
5653           This has a locale-specific meaning.  In the default locale
5654           (named C), it is equivalent to `%D'.
5655
5656     `%X'
5657           This has a locale-specific meaning.  In the default locale
5658           (named C), it is equivalent to `%T'.
5659
5660     `%y'
5661           This stands for the year without century (00-99).
5662
5663     `%Y'
5664           This stands for the year with century.
5665
5666     `%Z'
5667           This stands for the time zone abbreviation.
5668
5669  - Function: decode-time &optional specified-time
5670      This function converts a time value into calendrical information.
5671      The optional SPECIFIED-TIME should be a list of (HIGH LOW .
5672      IGNORED) or (HIGH . LOW), as from `current-time' and
5673      `file-attributes', or `nil' to use the current time.
5674
5675      The return value is a list of nine elements, as follows:
5676
5677           (SECONDS MINUTES HOUR DAY MONTH YEAR DOW DST ZONE)
5678
5679      Here is what the elements mean:
5680
5681     SEC
5682           The number of seconds past the minute, as an integer between
5683           0 and 59.
5684
5685     MINUTE
5686           The number of minutes past the hour, as an integer between 0
5687           and 59.
5688
5689     HOUR
5690           The hour of the day, as an integer between 0 and 23.
5691
5692     DAY
5693           The day of the month, as an integer between 1 and 31.
5694
5695     MONTH
5696           The month of the year, as an integer between 1 and 12.
5697
5698     YEAR
5699           The year, an integer typically greater than 1900.
5700
5701     DOW
5702           The day of week, as an integer between 0 and 6, where 0
5703           stands for Sunday.
5704
5705     DST
5706           `t' if daylight savings time is effect, otherwise `nil'.
5707
5708     ZONE
5709           An integer indicating the time zone, as the number of seconds
5710           east of Greenwich.
5711
5712      Note that Common Lisp has different meanings for DOW and ZONE.
5713
5714  - Function: encode-time seconds minutes hour day month year &optional
5715           zone
5716      This function is the inverse of `decode-time'.  It converts seven
5717      items of calendrical data into a time value.  For the meanings of
5718      the arguments, see the table above under `decode-time'.
5719
5720      Year numbers less than 100 are treated just like other year
5721      numbers.  If you want them to stand for years above 1900, you must
5722      alter them yourself before you call `encode-time'.
5723
5724      The optional argument ZONE defaults to the current time zone and
5725      its daylight savings time rules.  If specified, it can be either a
5726      list (as you would get from `current-time-zone') or an integer (as
5727      you would get from `decode-time').  The specified zone is used
5728      without any further alteration for daylight savings time.
5729
5730 \1f
5731 File: lispref.info,  Node: Timers,  Next: Terminal Input,  Prev: Time Conversion,  Up: System Interface
5732
5733 Timers for Delayed Execution
5734 ============================
5735
5736 You can set up a timer to call a function at a specified future time.
5737
5738  - Function: add-timeout secs function object &optional resignal
5739      This function adds a timeout, to be signaled after the timeout
5740      period has elapsed.  SECS is a number of seconds, expressed as an
5741      integer or a float.  FUNCTION will be called after that many
5742      seconds have elapsed, with one argument, the given OBJECT.  If the
5743      optional RESIGNAL argument is provided, then after this timeout
5744      expires, `add-timeout' will automatically be called again with
5745      RESIGNAL as the first argument.
5746
5747      This function returns an object which is the "id" of this
5748      particular timeout.  You can pass that object to `disable-timeout'
5749      to turn off the timeout before it has been signalled.
5750
5751      The number of seconds may be expressed as a floating-point number,
5752      in which case some fractional part of a second will be used.
5753      Caveat: the usable timeout granularity will vary from system to
5754      system.
5755
5756      Adding a timeout causes a timeout event to be returned by
5757      `next-event', and the function will be invoked by
5758      `dispatch-event', so if XEmacs is in a tight loop, the function
5759      will not be invoked until the next call to sit-for or until the
5760      return to top-level (the same is true of process filters).
5761
5762      WARNING: if you are thinking of calling add-timeout from inside of
5763      a callback function as a way of resignalling a timeout, think
5764      again.  There is a race condition.  That's why the RESIGNAL
5765      argument exists.
5766
5767      (NOTE: In FSF Emacs, this function is called `run-at-time' and has
5768      different semantics.)
5769
5770  - Function: disable-timeout id
5771      Cancel the requested action for ID, which should be a value
5772      previously returned by `add-timeout'.  This cancels the effect of
5773      that call to `add-timeout'; the arrival of the specified time will
5774      not cause anything special to happen.  (NOTE: In FSF Emacs, this
5775      function is called `cancel-timer'.)
5776
5777 \1f
5778 File: lispref.info,  Node: Terminal Input,  Next: Terminal Output,  Prev: Timers,  Up: System Interface
5779
5780 Terminal Input
5781 ==============
5782
5783 This section describes functions and variables for recording or
5784 manipulating terminal input.  See *Note Display::, for related
5785 functions.
5786
5787 * Menu:
5788
5789 * Input Modes::         Options for how input is processed.
5790 * Translating Input::   Low level conversion of some characters or events
5791                           into others.
5792 * Recording Input::     Saving histories of recent or all input events.
5793
5794 \1f
5795 File: lispref.info,  Node: Input Modes,  Next: Translating Input,  Up: Terminal Input
5796
5797 Input Modes
5798 -----------
5799
5800  - Function: set-input-mode interrupt flow meta &optional quit-char
5801           console
5802      This function sets the mode for reading keyboard input.  If
5803      INTERRUPT is non-null, then XEmacs uses input interrupts.  If it is
5804      `nil', then it uses CBREAK mode.  When XEmacs communicates
5805      directly with X, it ignores this argument and uses interrupts if
5806      that is the way it knows how to communicate.
5807
5808      If FLOW is non-`nil', then XEmacs uses XON/XOFF (`C-q', `C-s')
5809      flow control for output to the terminal.  This has no effect except
5810      in CBREAK mode.  *Note Flow Control::.
5811
5812      The default setting is system dependent.  Some systems always use
5813      CBREAK mode regardless of what is specified.
5814
5815      The argument META controls support for input character codes above
5816      127.  If META is `t', XEmacs converts characters with the 8th bit
5817      set into Meta characters.  If META is `nil', XEmacs disregards the
5818      8th bit; this is necessary when the terminal uses it as a parity
5819      bit.  If META is neither `t' nor `nil', XEmacs uses all 8 bits of
5820      input unchanged.  This is good for terminals using European 8-bit
5821      character sets.
5822
5823      If QUIT-CHAR is non-`nil', it specifies the character to use for
5824      quitting.  Normally this character is `C-g'.  *Note Quitting::.
5825
5826    The `current-input-mode' function returns the input mode settings
5827 XEmacs is currently using.
5828
5829  - Function: current-input-mode &optional console
5830      This function returns current mode for reading keyboard input.  It
5831      returns a list, corresponding to the arguments of `set-input-mode',
5832      of the form `(INTERRUPT FLOW META QUIT)' in which:
5833     INTERRUPT
5834           is non-`nil' when XEmacs is using interrupt-driven input.  If
5835           `nil', Emacs is using CBREAK mode.
5836
5837     FLOW
5838           is non-`nil' if XEmacs uses XON/XOFF (`C-q', `C-s') flow
5839           control for output to the terminal.  This value has no effect
5840           unless INTERRUPT is non-`nil'.
5841
5842     META
5843           is `t' if XEmacs treats the eighth bit of input characters as
5844           the meta bit; `nil' means XEmacs clears the eighth bit of
5845           every input character; any other value means XEmacs uses all
5846           eight bits as the basic character code.
5847
5848     QUIT
5849           is the character XEmacs currently uses for quitting, usually
5850           `C-g'.
5851
5852 \1f
5853 File: lispref.info,  Node: Translating Input,  Next: Recording Input,  Prev: Input Modes,  Up: Terminal Input
5854
5855 Translating Input Events
5856 ------------------------
5857
5858 This section describes features for translating input events into other
5859 input events before they become part of key sequences.
5860
5861  - Variable: function-key-map
5862      This variable holds a keymap that describes the character sequences
5863      sent by function keys on an ordinary character terminal.  This
5864      keymap uses the same data structure as other keymaps, but is used
5865      differently: it specifies translations to make while reading
5866      events.
5867
5868      If `function-key-map' "binds" a key sequence K to a vector V, then
5869      when K appears as a subsequence _anywhere_ in a key sequence, it
5870      is replaced with the events in V.
5871
5872      For example, VT100 terminals send `<ESC> O P' when the keypad PF1
5873      key is pressed.  Therefore, we want XEmacs to translate that
5874      sequence of events into the single event `pf1'.  We accomplish
5875      this by "binding" `<ESC> O P' to `[pf1]' in `function-key-map',
5876      when using a VT100.
5877
5878      Thus, typing `C-c <PF1>' sends the character sequence `C-c <ESC> O
5879      P'; later the function `read-key-sequence' translates this back
5880      into `C-c <PF1>', which it returns as the vector `[?\C-c pf1]'.
5881
5882      Entries in `function-key-map' are ignored if they conflict with
5883      bindings made in the minor mode, local, or global keymaps.  The
5884      intent is that the character sequences that function keys send
5885      should not have command bindings in their own right.
5886
5887      The value of `function-key-map' is usually set up automatically
5888      according to the terminal's Terminfo or Termcap entry, but
5889      sometimes those need help from terminal-specific Lisp files.
5890      XEmacs comes with terminal-specific files for many common
5891      terminals; their main purpose is to make entries in
5892      `function-key-map' beyond those that can be deduced from Termcap
5893      and Terminfo.  *Note Terminal-Specific::.
5894
5895      Emacs versions 18 and earlier used totally different means of
5896      detecting the character sequences that represent function keys.
5897
5898  - Variable: key-translation-map
5899      This variable is another keymap used just like `function-key-map'
5900      to translate input events into other events.  It differs from
5901      `function-key-map' in two ways:
5902
5903         * `key-translation-map' goes to work after `function-key-map' is
5904           finished; it receives the results of translation by
5905           `function-key-map'.
5906
5907         * `key-translation-map' overrides actual key bindings.
5908
5909      The intent of `key-translation-map' is for users to map one
5910      character set to another, including ordinary characters normally
5911      bound to `self-insert-command'.
5912
5913    You can use `function-key-map' or `key-translation-map' for more
5914 than simple aliases, by using a function, instead of a key sequence, as
5915 the "translation" of a key.  Then this function is called to compute
5916 the translation of that key.
5917
5918    The key translation function receives one argument, which is the
5919 prompt that was specified in `read-key-sequence'--or `nil' if the key
5920 sequence is being read by the editor command loop.  In most cases you
5921 can ignore the prompt value.
5922
5923    If the function reads input itself, it can have the effect of
5924 altering the event that follows.  For example, here's how to define
5925 `C-c h' to turn the character that follows into a Hyper character:
5926
5927      (defun hyperify (prompt)
5928        (let ((e (read-event)))
5929          (vector (if (numberp e)
5930                      (logior (lsh 1 20) e)
5931                    (if (memq 'hyper (event-modifiers e))
5932                        e
5933                      (add-event-modifier "H-" e))))))
5934      
5935      (defun add-event-modifier (string e)
5936        (let ((symbol (if (symbolp e) e (car e))))
5937          (setq symbol (intern (concat string
5938                                       (symbol-name symbol))))
5939          (if (symbolp e)
5940              symbol
5941            (cons symbol (cdr e)))))
5942      
5943      (define-key function-key-map "\C-ch" 'hyperify)
5944
5945    The `iso-transl' library uses this feature to provide a way of
5946 inputting non-ASCII Latin-1 characters.
5947
5948 \1f
5949 File: lispref.info,  Node: Recording Input,  Prev: Translating Input,  Up: Terminal Input
5950
5951 Recording Input
5952 ---------------
5953
5954  - Function: recent-keys &optional number
5955      This function returns a vector containing recent input events from
5956      the keyboard or mouse.  By default, 100 events are recorded, which
5957      is how many `recent-keys' returns.
5958
5959      All input events are included, whether or not they were used as
5960      parts of key sequences.  Thus, you always get the last 100 inputs,
5961      not counting keyboard macros.  (Events from keyboard macros are
5962      excluded because they are less interesting for debugging; it
5963      should be enough to see the events that invoked the macros.)
5964
5965      If NUMBER is specified, not more than NUMBER events will be
5966      returned.  You may change the number of stored events using
5967      `set-recent-keys-ring-size'.
5968
5969  - Function: recent-keys-ring-size
5970      This function returns the number of recent events stored
5971      internally.  This is also the maximum number of events
5972      `recent-keys' can return.  By default, 100 events are stored.
5973
5974  - Function: set-recent-keys-ring-size size
5975      This function changes the number of events stored by XEmacs and
5976      returned by `recent-keys'.
5977
5978      For example, `(set-recent-keys-ring-size 250)' will make XEmacs
5979      remember last 250 events and will make `recent-keys' return last
5980      250 events by default.
5981
5982  - Command: open-dribble-file filename
5983      This function opens a "dribble file" named FILENAME.  When a
5984      dribble file is open, each input event from the keyboard or mouse
5985      (but not those from keyboard macros) is written in that file.  A
5986      non-character event is expressed using its printed representation
5987      surrounded by `<...>'.
5988
5989      You close the dribble file by calling this function with an
5990      argument of `nil'.
5991
5992      This function is normally used to record the input necessary to
5993      trigger an XEmacs bug, for the sake of a bug report.
5994
5995           (open-dribble-file "~/dribble")
5996                => nil
5997
5998    See also the `open-termscript' function (*note Terminal Output::).
5999
6000 \1f
6001 File: lispref.info,  Node: Terminal Output,  Next: Flow Control,  Prev: Terminal Input,  Up: System Interface
6002
6003 Terminal Output
6004 ===============
6005
6006 The terminal output functions send output to the terminal or keep track
6007 of output sent to the terminal.  The function `device-baud-rate' tells
6008 you what XEmacs thinks is the output speed of the terminal.
6009
6010  - Function: device-baud-rate &optional device
6011      This function's value is the output speed of the terminal
6012      associated with DEVICE, as far as XEmacs knows.  DEVICE defaults
6013      to the selected device (usually the only device) if omitted.
6014      Changing this value does not change the speed of actual data
6015      transmission, but the value is used for calculations such as
6016      padding.  This value has no effect for window-system devices.
6017      (This is different in FSF Emacs, where the baud rate also affects
6018      decisions about whether to scroll part of the screen or repaint,
6019      even when using a window system.)
6020
6021      The value is measured in bits per second.
6022
6023    XEmacs attempts to automatically initialize the baud rate by querying
6024 the terminal.  If you are running across a network, however, and
6025 different parts of the network work are at different baud rates, the
6026 value returned by XEmacs may be different from the value used by your
6027 local terminal.  Some network protocols communicate the local terminal
6028 speed to the remote machine, so that XEmacs and other programs can get
6029 the proper value, but others do not.  If XEmacs has the wrong value, it
6030 makes decisions that are less than optimal.  To fix the problem, use
6031 `set-device-baud-rate'.
6032
6033  - Function: set-device-baud-rate device baud-rate
6034      This function sets the output speed of DEVICE.  See
6035      `device-baud-rate'.  DEVICE defaults to the selected device
6036      (usually the only device) if `nil'.
6037
6038  - Function: send-string-to-terminal char-or-string &optional stdout-p
6039           device
6040      This function sends CHAR-OR-STRING to the terminal without
6041      alteration.  Control characters in CHAR-OR-STRING have
6042      terminal-dependent effects.
6043
6044      If DEVICE is `nil', this function writes to XEmacs's stderr, or to
6045      stdout if STDOUT-P is non-`nil'.  Otherwise, DEVICE should be a
6046      tty or stream device, and the function writes to the device's
6047      normal or error output, according to STDOUT-P.
6048
6049      One use of this function is to define function keys on terminals
6050      that have downloadable function key definitions.  For example,
6051      this is how on certain terminals to define function key 4 to move
6052      forward four characters (by transmitting the characters `C-u C-f'
6053      to the computer):
6054
6055           (send-string-to-terminal "\eF4\^U\^F")
6056                => nil
6057
6058  - Command: open-termscript filename
6059      This function is used to open a "termscript file" that will record
6060      all the characters sent by XEmacs to the terminal. (If there are
6061      multiple tty or stream devices, all characters sent to all such
6062      devices are recorded.) The function returns `nil'.  Termscript
6063      files are useful for investigating problems where XEmacs garbles
6064      the screen, problems that are due to incorrect Termcap entries or
6065      to undesirable settings of terminal options more often than to
6066      actual XEmacs bugs.  Once you are certain which characters were
6067      actually output, you can determine reliably whether they
6068      correspond to the Termcap specifications in use.
6069
6070      A `nil' value for FILENAME stops recording terminal output.
6071
6072      See also `open-dribble-file' in *Note Terminal Input::.
6073
6074           (open-termscript "../junk/termscript")
6075                => nil
6076
6077 \1f
6078 File: lispref.info,  Node: Flow Control,  Next: Batch Mode,  Prev: Terminal Output,  Up: System Interface
6079
6080 Flow Control
6081 ============
6082
6083 This section attempts to answer the question "Why does XEmacs choose to
6084 use flow-control characters in its command character set?"  For a
6085 second view on this issue, read the comments on flow control in the
6086 `emacs/INSTALL' file from the distribution; for help with Termcap
6087 entries and DEC terminal concentrators, see `emacs/etc/TERMS'.
6088
6089    At one time, most terminals did not need flow control, and none used
6090 `C-s' and `C-q' for flow control.  Therefore, the choice of `C-s' and
6091 `C-q' as command characters was uncontroversial.  XEmacs, for economy
6092 of keystrokes and portability, used nearly all the ASCII control
6093 characters, with mnemonic meanings when possible; thus, `C-s' for
6094 search and `C-q' for quote.
6095
6096    Later, some terminals were introduced which required these characters
6097 for flow control.  They were not very good terminals for full-screen
6098 editing, so XEmacs maintainers did not pay attention.  In later years,
6099 flow control with `C-s' and `C-q' became widespread among terminals,
6100 but by this time it was usually an option.  And the majority of users,
6101 who can turn flow control off, were unwilling to switch to less
6102 mnemonic key bindings for the sake of flow control.
6103
6104    So which usage is "right", XEmacs's or that of some terminal and
6105 concentrator manufacturers?  This question has no simple answer.
6106
6107    One reason why we are reluctant to cater to the problems caused by
6108 `C-s' and `C-q' is that they are gratuitous.  There are other
6109 techniques (albeit less common in practice) for flow control that
6110 preserve transparency of the character stream.  Note also that their use
6111 for flow control is not an official standard.  Interestingly, on the
6112 model 33 teletype with a paper tape punch (which is very old), `C-s'
6113 and `C-q' were sent by the computer to turn the punch on and off!
6114
6115    As X servers and other window systems replace character-only
6116 terminals, this problem is gradually being cured.  For the mean time,
6117 XEmacs provides a convenient way of enabling flow control if you want
6118 it: call the function `enable-flow-control'.
6119
6120  - Command: enable-flow-control &optional argument
6121      This function enables use of `C-s' and `C-q' for output flow
6122      control, and provides the characters `C-\' and `C-^' as aliases
6123      for them using `keyboard-translate-table' (*note Translating
6124      Input::).
6125
6126      With optional argument ARGUMENT (interactively the prefix
6127      argument), enable flow control mode if ARGUMENT is positive; else
6128      disable it.
6129
6130    You can use the function `enable-flow-control-on' in your `.emacs'
6131 file to enable flow control automatically on certain terminal types.
6132
6133  - Function: enable-flow-control-on &rest termtypes
6134      This function enables flow control, and the aliases `C-\' and
6135      `C-^', if the terminal type is one of TERMTYPES.  For example:
6136
6137           (enable-flow-control-on "vt200" "vt300" "vt101" "vt131")
6138
6139    Here is how `enable-flow-control' does its job:
6140
6141   1. It sets CBREAK mode for terminal input, and tells the operating
6142      system to handle flow control, with `(set-input-mode nil t)'.
6143
6144   2. It sets up `keyboard-translate-table' to translate `C-\' and `C-^'
6145      into `C-s' and `C-q'.  Except at its very lowest level, XEmacs
6146      never knows that the characters typed were anything but `C-s' and
6147      `C-q', so you can in effect type them as `C-\' and `C-^' even when
6148      they are input for other commands.  *Note Translating Input::.
6149
6150    If the terminal is the source of the flow control characters, then
6151 once you enable kernel flow control handling, you probably can make do
6152 with less padding than normal for that terminal.  You can reduce the
6153 amount of padding by customizing the Termcap entry.  You can also
6154 reduce it by setting `baud-rate' to a smaller value so that XEmacs uses
6155 a smaller speed when calculating the padding needed.  *Note Terminal
6156 Output::.
6157
6158 \1f
6159 File: lispref.info,  Node: Batch Mode,  Prev: Flow Control,  Up: System Interface
6160
6161 Batch Mode
6162 ==========
6163
6164 The command line option `-batch' causes XEmacs to run noninteractively.
6165 In this mode, XEmacs does not read commands from the terminal, it does
6166 not alter the terminal modes, and it does not expect to be outputting
6167 to an erasable screen.  The idea is that you specify Lisp programs to
6168 run; when they are finished, XEmacs should exit.  The way to specify
6169 the programs to run is with `-l FILE', which loads the library named
6170 FILE, and `-f FUNCTION', which calls FUNCTION with no arguments.
6171
6172    Any Lisp program output that would normally go to the echo area,
6173 either using `message' or using `prin1', etc., with `t' as the stream,
6174 goes instead to XEmacs's standard error descriptor when in batch mode.
6175 Thus, XEmacs behaves much like a noninteractive application program.
6176 (The echo area output that XEmacs itself normally generates, such as
6177 command echoing, is suppressed entirely.)
6178
6179  - Function: noninteractive
6180      This function returns non-`nil' when XEmacs is running in batch
6181      mode.
6182
6183  - Variable: noninteractive
6184      This variable is non-`nil' when XEmacs is running in batch mode.
6185      Setting this variable to `nil', however, will not change whether
6186      XEmacs is running in batch mode, and will not change the return
6187      value of the `noninteractive' function.
6188
6189 \1f
6190 File: lispref.info,  Node: X-Windows,  Next: ToolTalk Support,  Prev: System Interface,  Up: Top
6191
6192 Functions Specific to the X Window System
6193 *****************************************
6194
6195 XEmacs provides the concept of "devices", which generalizes connections
6196 to an X server, a TTY device, etc.  Most information about an X server
6197 that XEmacs is connected to can be determined through general console
6198 and device functions.  *Note Consoles and Devices::.  However, there
6199 are some features of the X Window System that do not generalize well,
6200 and they are covered specially here.
6201
6202 * Menu:
6203
6204 * X Selections::                Transferring text to and from other X clients.
6205 * X Server::                    Information about the X server connected to
6206                                   a particular device.
6207 * X Miscellaneous::             Other X-specific functions and variables.
6208
6209 \1f
6210 File: lispref.info,  Node: X Selections,  Next: X Server,  Up: X-Windows
6211
6212 X Selections
6213 ============
6214
6215 The X server records a set of "selections" which permit transfer of
6216 data between application programs.  The various selections are
6217 distinguished by "selection types", represented in XEmacs by symbols.
6218 X clients including XEmacs can read or set the selection for any given
6219 type.
6220
6221  - Function: x-own-selection data &optional type
6222      This function sets a "selection" in the X server.  It takes two
6223      arguments: a value, DATA, and the selection type TYPE to assign it
6224      to.  DATA may be a string, a cons of two markers, or an extent.
6225      In the latter cases, the selection is considered to be the text
6226      between the markers, or between the extent's endpoints.
6227
6228      Each possible TYPE has its own selection value, which changes
6229      independently.  The usual values of TYPE are `PRIMARY' and
6230      `SECONDARY'; these are symbols with upper-case names, in accord
6231      with X Windows conventions.  The default is `PRIMARY'.
6232
6233      (In FSF Emacs, this function is called `x-set-selection' and takes
6234      different arguments.)
6235
6236  - Function: x-get-selection
6237      This function accesses selections set up by XEmacs or by other X
6238      clients.  It returns the value of the current primary selection.
6239
6240  - Function: x-disown-selection &optional secondary-p
6241      Assuming we own the selection, this function disowns it.  If
6242      SECONDARY-P is non-`nil', the secondary selection instead of the
6243      primary selection is discarded.
6244
6245    The X server also has a set of numbered "cut buffers" which can
6246 store text or other data being moved between applications.  Cut buffers
6247 are considered obsolete, but XEmacs supports them for the sake of X
6248 clients that still use them.
6249
6250  - Function: x-get-cutbuffer &optional n
6251      This function returns the contents of cut buffer number N. (This
6252      function is called `x-get-cut-buffer' in FSF Emacs.)
6253
6254  - Function: x-store-cutbuffer string &optional push
6255      This function stores STRING into the first cut buffer (cut buffer
6256      0).
6257
6258      Normally, the contents of the first cut buffer are simply replaced
6259      by STRING.  However, if optional argument PUSH is non-`nil', the
6260      cut buffers are rotated.  This means that the previous value of
6261      the first cut buffer moves to the second cut buffer, and the
6262      second to the third, and so on, moving the other values down
6263      through the series of cut buffers, kill-ring-style.  There are 8
6264      cut buffers altogether.
6265
6266      Cut buffers are considered obsolete; you should use selections
6267      instead.
6268
6269      This function has no effect if support for cut buffers was not
6270      compiled in.
6271
6272      This function is called `x-set-cut-buffer' in FSF Emacs.
6273
6274 \1f
6275 File: lispref.info,  Node: X Server,  Next: X Miscellaneous,  Prev: X Selections,  Up: X-Windows
6276
6277 X Server
6278 ========
6279
6280 This section describes how to access and change the overall status of
6281 the X server XEmacs is using.
6282
6283 * Menu:
6284
6285 * Resources::                   Getting resource values from the server.
6286 * Server Data::                 Getting info about the X server.
6287 * Grabs::                       Restricting access to the server by other apps.
6288
6289 \1f
6290 File: lispref.info,  Node: Resources,  Next: Server Data,  Up: X Server
6291
6292 Resources
6293 ---------
6294
6295  - Function: default-x-device
6296      This function return the default X device for resourcing.  This is
6297      the first-created X device that still exists.
6298
6299  - Function: x-get-resource name class type &optional locale device
6300           noerror
6301      This function retrieves a resource value from the X resource
6302      manager.
6303
6304         * The first arg is the name of the resource to retrieve, such as
6305           `"font"'.
6306
6307         * The second arg is the class of the resource to retrieve, like
6308           `"Font"'.
6309
6310         * The third arg should be one of the symbols `string',
6311           `integer', `natnum', or `boolean', specifying the type of
6312           object that the database is searched for.
6313
6314         * The fourth arg is the locale to search for the resources on,
6315           and can currently be a buffer, a frame, a device, or the
6316           symbol `global'.  If omitted, it defaults to `global'.
6317
6318         * The fifth arg is the device to search for the resources on.
6319           (The resource database for a particular device is constructed
6320           by combining non-device- specific resources such any
6321           command-line resources specified and any app-defaults files
6322           found [or the fallback resources supplied by XEmacs, if no
6323           app-defaults file is found] with device-specific resources
6324           such as those supplied using `xrdb'.) If omitted, it defaults
6325           to the device of LOCALE, if a device can be derived (i.e. if
6326           LOCALE is a frame or device), and otherwise defaults to the
6327           value of `default-x-device'.
6328
6329         * The sixth arg NOERROR, if non-`nil', means do not signal an
6330           error if a bogus resource specification was retrieved (e.g.
6331           if a non-integer was given when an integer was requested).
6332           In this case, a warning is issued instead.
6333
6334      The resource names passed to this function are looked up relative
6335      to the locale.
6336
6337      If you want to search for a subresource, you just need to specify
6338      the resource levels in NAME and CLASS.  For example, NAME could be
6339      `"modeline.attributeFont"', and CLASS `"Face.AttributeFont"'.
6340
6341      Specifically,
6342
6343        1. If LOCALE is a buffer, a call
6344
6345                    `(x-get-resource "foreground" "Foreground" 'string SOME-BUFFER)'
6346
6347           is an interface to a C call something like
6348
6349                    `XrmGetResource (db, "xemacs.buffer.BUFFER-NAME.foreground",
6350                                        "Emacs.EmacsLocaleType.EmacsBuffer.Foreground",
6351                                        "String");'
6352
6353        2. If LOCALE is a frame, a call
6354
6355                    `(x-get-resource "foreground" "Foreground" 'string SOME-FRAME)'
6356
6357           is an interface to a C call something like
6358
6359                    `XrmGetResource (db, "xemacs.frame.FRAME-NAME.foreground",
6360                                        "Emacs.EmacsLocaleType.EmacsFrame.Foreground",
6361                                        "String");'
6362
6363        3. If LOCALE is a device, a call
6364
6365                    `(x-get-resource "foreground" "Foreground" 'string SOME-DEVICE)'
6366
6367           is an interface to a C call something like
6368
6369                    `XrmGetResource (db, "xemacs.device.DEVICE-NAME.foreground",
6370                                        "Emacs.EmacsLocaleType.EmacsDevice.Foreground",
6371                                        "String");'
6372
6373        4. If LOCALE is the symbol `global', a call
6374
6375                    `(x-get-resource "foreground" "Foreground" 'string 'global)'
6376
6377           is an interface to a C call something like
6378
6379                    `XrmGetResource (db, "xemacs.foreground",
6380                                        "Emacs.Foreground",
6381                                        "String");'
6382
6383      Note that for `global', no prefix is added other than that of the
6384      application itself; thus, you can use this locale to retrieve
6385      arbitrary application resources, if you really want to.
6386
6387      The returned value of this function is `nil' if the queried
6388      resource is not found.  If TYPE is `string', a string is returned,
6389      and if it is `integer', an integer is returned.  If TYPE is
6390      `boolean', then the returned value is the list `(t)' for true,
6391      `(nil)' for false, and is `nil' to mean "unspecified".
6392
6393  - Function: x-put-resource resource-line &optional device
6394      This function adds a resource to the resource database for DEVICE.
6395      RESOURCE-LINE specifies the resource to add and should be a
6396      standard resource specification.
6397
6398  - Variable: x-emacs-application-class
6399      This variable holds The X application class of the XEmacs process.
6400      This controls, among other things, the name of the "app-defaults"
6401      file that XEmacs will use.  For changes to this variable to take
6402      effect, they must be made before the connection to the X server is
6403      initialized, that is, this variable may only be changed before
6404      XEmacs is dumped, or by setting it in the file
6405      `lisp/term/x-win.el'.
6406
6407      By default, this variable is `nil' at startup.  When the connection
6408      to the X server is first initialized, the X resource database will
6409      be consulted and the value will be set according to whether any
6410      resources are found for the application class "XEmacs".
6411
6412 \1f
6413 File: lispref.info,  Node: Server Data,  Next: Grabs,  Prev: Resources,  Up: X Server
6414
6415 Data about the X Server
6416 -----------------------
6417
6418 This section describes functions and a variable that you can use to get
6419 information about the capabilities and origin of the X server
6420 corresponding to a particular device.  The device argument is generally
6421 optional and defaults to the selected device.
6422
6423  - Function: x-server-version &optional device
6424      This function returns the list of version numbers of the X server
6425      DEVICE is on.  The returned value is a list of three integers: the
6426      major and minor version numbers of the X protocol in use, and the
6427      vendor-specific release number.
6428
6429  - Function: x-server-vendor &optional device
6430      This function returns the vendor supporting the X server DEVICE is
6431      on.
6432
6433  - Function: x-display-visual-class &optional device
6434      This function returns the visual class of the display DEVICE is
6435      on.  The value is one of the symbols `static-gray', `gray-scale',
6436      `static-color', `pseudo-color', `true-color', and `direct-color'.
6437      (Note that this is different from previous versions of XEmacs,
6438      which returned `StaticGray', `GrayScale', etc.)
6439
6440 \1f
6441 File: lispref.info,  Node: Grabs,  Prev: Server Data,  Up: X Server
6442
6443 Restricting Access to the Server by Other Apps
6444 ----------------------------------------------
6445
6446  - Function: x-grab-keyboard &optional device
6447      This function grabs the keyboard on the given device (defaulting
6448      to the selected one).  So long as the keyboard is grabbed, all
6449      keyboard events will be delivered to XEmacs--it is not possible
6450      for other X clients to eavesdrop on them.  Ungrab the keyboard
6451      with `x-ungrab-keyboard' (use an `unwind-protect').  Returns `t'
6452      if the grab was successful; `nil' otherwise.
6453
6454  - Function: x-ungrab-keyboard &optional device
6455      This function releases a keyboard grab made with `x-grab-keyboard'.
6456
6457  - Function: x-grab-pointer &optional device cursor ignore-keyboard
6458      This function grabs the pointer and restricts it to its current
6459      window.  If optional DEVICE argument is `nil', the selected device
6460      will be used.  If optional CURSOR argument is non-`nil', change
6461      the pointer shape to that until `x-ungrab-pointer' is called (it
6462      should be an object returned by the `make-cursor' function).  If
6463      the second optional argument IGNORE-KEYBOARD is non-`nil', ignore
6464      all keyboard events during the grab.  Returns `t' if the grab is
6465      successful, `nil' otherwise.
6466
6467  - Function: x-ungrab-pointer &optional device
6468      This function releases a pointer grab made with `x-grab-pointer'.
6469      If optional first arg DEVICE is `nil' the selected device is used.
6470      If it is `t' the pointer will be released on all X devices.
6471
6472 \1f
6473 File: lispref.info,  Node: X Miscellaneous,  Prev: X Server,  Up: X-Windows
6474
6475 Miscellaneous X Functions and Variables
6476 =======================================
6477
6478  - Variable: x-bitmap-file-path
6479      This variable holds a list of the directories in which X bitmap
6480      files may be found.  If `nil', this is initialized from the
6481      `"*bitmapFilePath"' resource.  This is used by the
6482      `make-image-instance' function (however, note that if the
6483      environment variable `XBMLANGPATH' is set, it is consulted first).
6484
6485  - Variable: x-library-search-path
6486      This variable holds the search path used by `read-color' to find
6487      `rgb.txt'.
6488
6489  - Function: x-valid-keysym-name-p keysym
6490      This function returns true if KEYSYM names a keysym that the X
6491      library knows about.  Valid keysyms are listed in the files
6492      `/usr/include/X11/keysymdef.h' and in `/usr/lib/X11/XKeysymDB', or
6493      whatever the equivalents are on your system.
6494
6495  - Function: x-window-id &optional frame
6496      This function returns the ID of the X11 window.  This gives us a
6497      chance to manipulate the Emacs window from within a different
6498      program.  Since the ID is an unsigned long, we return it as a
6499      string.
6500
6501  - Variable: x-allow-sendevents
6502      If non-`nil', synthetic events are allowed.  `nil' means they are
6503      ignored.  Beware: allowing XEmacs to process SendEvents opens a
6504      big security hole.
6505
6506  - Function: x-debug-mode arg &optional device
6507      With a true arg, make the connection to the X server synchronous.
6508      With false, make it asynchronous.  Synchronous connections are
6509      much slower, but are useful for debugging. (If you get X errors,
6510      make the connection synchronous, and use a debugger to set a
6511      breakpoint on `x_error_handler'.  Your backtrace of the C stack
6512      will now be useful.  In asynchronous mode, the stack above
6513      `x_error_handler' isn't helpful because of buffering.)  If DEVICE
6514      is not specified, the selected device is assumed.
6515
6516      Calling this function is the same as calling the C function
6517      `XSynchronize', or starting the program with the `-sync' command
6518      line argument.
6519
6520  - Variable: x-debug-events
6521      If non-zero, debug information about events that XEmacs sees is
6522      displayed.  Information is displayed on stderr.  Currently defined
6523      values are:
6524
6525         * 1 == non-verbose output
6526
6527         * 2 == verbose output
6528
6529 \1f
6530 File: lispref.info,  Node: ToolTalk Support,  Next: LDAP Support,  Prev: X-Windows,  Up: Top
6531
6532 ToolTalk Support
6533 ****************
6534
6535 * Menu:
6536
6537 * XEmacs ToolTalk API Summary::
6538 * Sending Messages::
6539 * Receiving Messages::
6540
6541 \1f
6542 File: lispref.info,  Node: XEmacs ToolTalk API Summary,  Next: Sending Messages,  Up: ToolTalk Support
6543
6544 XEmacs ToolTalk API Summary
6545 ===========================
6546
6547 The XEmacs Lisp interface to ToolTalk is similar, at least in spirit,
6548 to the standard C ToolTalk API.  Only the message and pattern parts of
6549 the API are supported at present; more of the API could be added if
6550 needed.  The Lisp interface departs from the C API in a few ways:
6551
6552    * ToolTalk is initialized automatically at XEmacs startup-time.
6553      Messages can only be sent other ToolTalk applications connected to
6554      the same X11 server that XEmacs is running on.
6555
6556    * There are fewer entry points; polymorphic functions with keyword
6557      arguments are used instead.
6558
6559    * The callback interface is simpler and marginally less functional.
6560      A single callback may be associated with a message or a pattern;
6561      the callback is specified with a Lisp symbol (the symbol should
6562      have a function binding).
6563
6564    * The session attribute for messages and patterns is always
6565      initialized to the default session.
6566
6567    * Anywhere a ToolTalk enum constant, e.g. `TT_SESSION', is valid, one
6568      can substitute the corresponding symbol, e.g. `'TT_SESSION'.  This
6569      simplifies building lists that represent messages and patterns.
6570
6571 \1f
6572 File: lispref.info,  Node: Sending Messages,  Next: Receiving Messages,  Prev: XEmacs ToolTalk API Summary,  Up: ToolTalk Support
6573
6574 Sending Messages
6575 ================
6576
6577 * Menu:
6578
6579 * Example of Sending Messages::
6580 * Elisp Interface for Sending Messages::
6581
6582 \1f
6583 File: lispref.info,  Node: Example of Sending Messages,  Next: Elisp Interface for Sending Messages,  Up: Sending Messages
6584
6585 Example of Sending Messages
6586 ---------------------------
6587
6588 Here's a simple example that sends a query to another application and
6589 then displays its reply.  Both the query and the reply are stored in
6590 the first argument of the message.
6591
6592      (defun tooltalk-random-query-handler (msg)
6593        (let ((state (get-tooltalk-message-attribute msg 'state)))
6594          (cond
6595            ((eq state 'TT_HANDLED)
6596             (message (get-tooltalk-message-attribute msg arg_val 0)))
6597            ((memq state '(TT_FAILED TT_REJECTED))
6598             (message "Random query turns up nothing")))))
6599      
6600      (defvar random-query-message
6601        '(   class TT_REQUEST
6602             scope TT_SESSION
6603           address TT_PROCEDURE
6604                op "random-query"
6605              args '((TT_INOUT "?" "string"))
6606          callback tooltalk-random-query-handler))
6607      
6608      (let ((m (make-tooltalk-message random-query-message)))
6609        (send-tooltalk-message m))
6610
6611 \1f
6612 File: lispref.info,  Node: Elisp Interface for Sending Messages,  Prev: Example of Sending Messages,  Up: Sending Messages
6613
6614 Elisp Interface for Sending Messages
6615 ------------------------------------
6616
6617  - Function: make-tooltalk-message attributes
6618      Create a ToolTalk message and initialize its attributes.  The
6619      value of ATTRIBUTES must be a list of alternating keyword/values,
6620      where keywords are symbols that name valid message attributes.
6621      For example:
6622
6623             (make-tooltalk-message
6624               '(class TT_NOTICE
6625                 scope TT_SESSION
6626                 address TT_PROCEDURE
6627                 op "do-something"
6628                 args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
6629
6630      Values must always be strings, integers, or symbols that represent
6631      ToolTalk constants.  Attribute names are the same as those
6632      supported by `set-tooltalk-message-attribute', plus `args'.
6633
6634      The value of `args' should be a list of message arguments where
6635      each message argument has the following form:
6636
6637              `(mode [value [type]])' or just `value'
6638
6639      Where MODE is one of `TT_IN', `TT_OUT', or `TT_INOUT' and TYPE is
6640      a string.  If TYPE isn't specified then `int' is used if VALUE is
6641      a number; otherwise `string' is used.  If TYPE is `string' then
6642      VALUE is converted to a string (if it isn't a string already) with
6643      `prin1-to-string'.  If only a value is specified then MODE
6644      defaults to `TT_IN'.  If MODE is `TT_OUT' then VALUE and TYPE
6645      don't need to be specified.  You can find out more about the
6646      semantics and uses of ToolTalk message arguments in chapter 4 of
6647      the `ToolTalk Programmer's Guide'.
6648
6649
6650  - Function: send-tooltalk-message msg
6651      Send the message on its way.  Once the message has been sent it's
6652      almost always a good idea to get rid of it with
6653      `destroy-tooltalk-message'.
6654
6655
6656  - Function: return-tooltalk-message msg &optional mode
6657      Send a reply to this message.  The second argument can be `reply',
6658      `reject' or `fail'; the default is `reply'.  Before sending a
6659      reply, all message arguments whose mode is `TT_INOUT' or `TT_OUT'
6660      should have been filled in--see `set-tooltalk-message-attribute'.
6661
6662
6663  - Function: get-tooltalk-message-attribute msg attribute &optional argn
6664      Returns the indicated ToolTalk message attribute.  Attributes are
6665      identified by symbols with the same name (underscores and all) as
6666      the suffix of the ToolTalk `tt_message_<attribute>' function that
6667      extracts the value.  String attribute values are copied and
6668      enumerated type values (except disposition) are converted to
6669      symbols; e.g. `TT_HANDLER' is `'TT_HANDLER', `uid' and `gid' are
6670      represented by fixnums (small integers), `opnum' is converted to a
6671      string, and `disposition' is converted to a fixnum.  We convert
6672      `opnum' (a C int) to a string (e.g. `123' => `"123"') because
6673      there's no guarantee that opnums will fit within the range of
6674      XEmacs Lisp integers.
6675
6676      [TBD] Use the `plist' attribute instead of C API `user' attribute
6677      for user-defined message data.  To retrieve the value of a message
6678      property, specify the indicator for ARGN.  For example, to get the
6679      value of a property called `rflag', use
6680
6681              (get-tooltalk-message-attribute msg 'plist 'rflag)
6682
6683      To get the value of a message argument use one of the `arg_val'
6684      (strings), `arg_ival' (integers), or `arg_bval' (strings with
6685      embedded nulls), attributes.  For example, to get the integer
6686      value of the third argument:
6687
6688              (get-tooltalk-message-attribute msg 'arg_ival 2)
6689
6690      As you can see, argument numbers are zero-based.  The type of each
6691      arguments can be retrieved with the `arg_type' attribute; however
6692      ToolTalk doesn't define any semantics for the string value of
6693      `arg_type'.  Conventionally `string' is used for strings and `int'
6694      for 32 bit integers.  Note that XEmacs Lisp stores the lengths of
6695      strings explicitly (unlike C) so treating the value returned by
6696      `arg_bval' like a string is fine.
6697
6698
6699  - Function: set-tooltalk-message-attribute value msg attribute
6700           &optional argn
6701      Initialize one ToolTalk message attribute.
6702
6703      Attribute names and values are the same as for
6704      `get-tooltalk-message-attribute'.  A property list is provided for
6705      user data (instead of the `user' message attribute); see
6706      `get-tooltalk-message-attribute'.
6707
6708      Callbacks are handled slightly differently than in the C ToolTalk
6709      API.  The value of CALLBACK should be the name of a function of one
6710      argument.  It will be called each time the state of the message
6711      changes.  This is usually used to notice when the message's state
6712      has changed to `TT_HANDLED' (or `TT_FAILED'), so that reply
6713      argument values can be used.
6714
6715      If one of the argument attributes is specified as `arg_val',
6716      `arg_ival', or `arg_bval', then ARGN must be the number of an
6717      already created argument.  Arguments can be added to a message
6718      with `add-tooltalk-message-arg'.
6719
6720
6721  - Function: add-tooltalk-message-arg msg mode type &optional value
6722      Append one new argument to the message.  MODE must be one of
6723      `TT_IN', `TT_INOUT', or `TT_OUT', TYPE must be a string, and VALUE
6724      can be a string or an integer.  ToolTalk doesn't define any
6725      semantics for TYPE, so only the participants in the protocol
6726      you're using need to agree what types mean (if anything).
6727      Conventionally `string' is used for strings and `int' for 32 bit
6728      integers.  Arguments can initialized by providing a value or with
6729      `set-tooltalk-message-attribute'; the latter is necessary if you
6730      want to initialize the argument with a string that can contain
6731      embedded nulls (use `arg_bval').
6732
6733
6734  - Function: create-tooltalk-message &optional no-callback
6735      Create a new ToolTalk message.  The message's session attribute is
6736      initialized to the default session.  Other attributes can be
6737      initialized with `set-tooltalk-message-attribute'.
6738      `make-tooltalk-message' is the preferred way to create and
6739      initialize a message.
6740
6741      Optional arg NO-CALLBACK says don't add a C-level callback at all.
6742      Normally don't do that; just don't specify the Lisp callback when
6743      calling `make-tooltalk-message'.
6744
6745
6746  - Function: destroy-tooltalk-message msg
6747      Apply `tt_message_destroy' to the message.  It's not necessary to
6748      destroy messages after they've been processed by a message or
6749      pattern callback, the Lisp/ToolTalk callback machinery does this
6750      for you.
6751
6752 \1f
6753 File: lispref.info,  Node: Receiving Messages,  Prev: Sending Messages,  Up: ToolTalk Support
6754
6755 Receiving Messages
6756 ==================
6757
6758 * Menu:
6759
6760 * Example of Receiving Messages::
6761 * Elisp Interface for Receiving Messages::
6762
6763 \1f
6764 File: lispref.info,  Node: Example of Receiving Messages,  Next: Elisp Interface for Receiving Messages,  Up: Receiving Messages
6765
6766 Example of Receiving Messages
6767 -----------------------------
6768
6769 Here's a simple example of a handler for a message that tells XEmacs to
6770 display a string in the mini-buffer area.  The message operation is
6771 called `emacs-display-string'.  Its first (0th) argument is the string
6772 to display.
6773
6774      (defun tooltalk-display-string-handler (msg)
6775        (message (get-tooltalk-message-attribute msg 'arg_val 0)))
6776      
6777      (defvar display-string-pattern
6778        '(category TT_HANDLE
6779             scope TT_SESSION
6780                op "emacs-display-string"
6781          callback tooltalk-display-string-handler))
6782      
6783      (let ((p (make-tooltalk-pattern display-string-pattern)))
6784        (register-tooltalk-pattern p))
6785
6786 \1f
6787 File: lispref.info,  Node: Elisp Interface for Receiving Messages,  Prev: Example of Receiving Messages,  Up: Receiving Messages
6788
6789 Elisp Interface for Receiving Messages
6790 --------------------------------------
6791
6792  - Function: make-tooltalk-pattern attributes
6793      Create a ToolTalk pattern and initialize its attributes.  The
6794      value of attributes must be a list of alternating keyword/values,
6795      where keywords are symbols that name valid pattern attributes or
6796      lists of valid attributes.  For example:
6797
6798             (make-tooltalk-pattern
6799               '(category TT_OBSERVE
6800                    scope TT_SESSION
6801                       op ("operation1" "operation2")
6802                     args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
6803
6804      Attribute names are the same as those supported by
6805      `add-tooltalk-pattern-attribute', plus `'args'.
6806
6807      Values must always be strings, integers, or symbols that represent
6808      ToolTalk constants or lists of same.  When a list of values is
6809      provided all of the list elements are added to the attribute.  In
6810      the example above, messages whose `op' attribute is `"operation1"'
6811      or `"operation2"' would match the pattern.
6812
6813      The value of ARGS should be a list of pattern arguments where each
6814      pattern argument has the following form:
6815
6816              `(mode [value [type]])' or just `value'
6817
6818      Where MODE is one of `TT_IN', `TT_OUT', or `TT_INOUT' and TYPE is
6819      a string.  If TYPE isn't specified then `int' is used if VALUE is
6820      a number; otherwise `string' is used.  If TYPE is `string' then
6821      VALUE is converted to a string (if it isn't a string already) with
6822      `prin1-to-string'.  If only a value is specified then MODE
6823      defaults to `TT_IN'.  If MODE is `TT_OUT' then VALUE and TYPE
6824      don't need to be specified.  You can find out more about the
6825      semantics and uses of ToolTalk pattern arguments in chapter 3 of
6826      the `ToolTalk Programmer's Guide'.
6827
6828
6829  - Function: register-tooltalk-pattern pattern
6830      XEmacs will begin receiving messages that match this pattern.
6831
6832  - Function: unregister-tooltalk-pattern pattern
6833      XEmacs will stop receiving messages that match this pattern.
6834
6835  - Function: add-tooltalk-pattern-attribute value pattern indicator
6836      Add one value to the indicated pattern attribute. The names of
6837      attributes are the same as the ToolTalk accessors used to set them
6838      less the `tooltalk_pattern_' prefix and the `_add' suffix.  For
6839      example, the name of the attribute for the
6840      `tt_pattern_disposition_add' attribute is `disposition'.  The
6841      `category' attribute is handled specially, since a pattern can only
6842      be a member of one category (`TT_OBSERVE' or `TT_HANDLE').
6843
6844      Callbacks are handled slightly differently than in the C ToolTalk
6845      API.  The value of CALLBACK should be the name of a function of one
6846      argument.  It will be called each time the pattern matches an
6847      incoming message.
6848
6849  - Function: add-tooltalk-pattern-arg pattern mode vtype &optional value
6850      Add one fully-specified argument to a ToolTalk pattern.  MODE must
6851      be one of `TT_IN', `TT_INOUT', or `TT_OUT'.  VTYPE must be a
6852      string.  VALUE can be an integer, string or `nil'.  If VALUE is an
6853      integer then an integer argument (`tt_pattern_iarg_add') is added;
6854      otherwise a string argument is added.  At present there's no way
6855      to add a binary data argument.
6856
6857
6858  - Function: create-tooltalk-pattern
6859      Create a new ToolTalk pattern and initialize its session attribute
6860      to be the default session.
6861
6862  - Function: destroy-tooltalk-pattern pattern
6863      Apply `tt_pattern_destroy' to the pattern.  This effectively
6864      unregisters the pattern.
6865
6866  - Function: describe-tooltalk-message msg &optional stream
6867      Print the message's attributes and arguments to STREAM.  This is
6868      often useful for debugging.
6869
6870 \1f
6871 File: lispref.info,  Node: LDAP Support,  Next: PostgreSQL Support,  Prev: ToolTalk Support,  Up: Top
6872
6873 LDAP Support
6874 ************
6875
6876 XEmacs can be linked with a LDAP client library to provide Elisp
6877 primitives to access directory servers using the Lightweight Directory
6878 Access Protocol.
6879
6880 * Menu:
6881
6882 * Building XEmacs with LDAP support::  How to add LDAP support to XEmacs
6883 * XEmacs LDAP API::             Lisp access to LDAP functions
6884 * Syntax of Search Filters::    A brief summary of RFC 1558
6885
6886 \1f
6887 File: lispref.info,  Node: Building XEmacs with LDAP support,  Next: XEmacs LDAP API,  Prev: LDAP Support,  Up: LDAP Support
6888
6889 Building XEmacs with LDAP support
6890 =================================
6891
6892 LDAP support must be added to XEmacs at build time since it requires
6893 linking to an external LDAP client library.  As of 21.2, XEmacs has been
6894 successfully built and tested with
6895
6896    * OpenLDAP 1.2 (<http://www.openldap.org/>)
6897
6898    * University of Michigan's LDAP 3.3
6899      (<http://www.umich.edu/~dirsvcs/ldap/>)
6900
6901    * LDAP SDK 1.0 from Netscape Corp. (<http://developer.netscape.com/>)
6902
6903    Other libraries conforming to RFC 1823 will probably work also but
6904 may require some minor tweaking at C level.
6905
6906    The standard XEmacs configure script auto-detects an installed LDAP
6907 library provided the library itself and the corresponding header files
6908 can be found in the library and include paths.  A successful detection
6909 will be signalled in the final output of the configure script.
6910
6911 \1f
6912 File: lispref.info,  Node: XEmacs LDAP API,  Next: Syntax of Search Filters,  Prev: Building XEmacs with LDAP support,  Up: LDAP Support
6913
6914 XEmacs LDAP API
6915 ===============
6916
6917 XEmacs LDAP API consists of two layers:  a low-level layer which tries
6918 to stay as close as possible to the C API (where practical) and a
6919 higher-level layer which provides more convenient primitives to
6920 effectively use LDAP.
6921
6922    The low-level API should be used directly for very specific purposes
6923 (such as multiple operations on a connection) only.  The higher-level
6924 functions provide a more convenient way to access LDAP directories
6925 hiding the subtleties of handling the connection, translating arguments
6926 and ensuring compliance with LDAP internationalization rules and formats
6927 (currently partly implemented only).
6928
6929 * Menu:
6930
6931 * LDAP Variables::              Lisp variables related to LDAP
6932 * The High-Level LDAP API::     High-level LDAP lisp functions
6933 * The Low-Level LDAP API::      Low-level LDAP lisp primitives
6934 * LDAP Internationalization::   I18n variables and functions
6935
6936 \1f
6937 File: lispref.info,  Node: LDAP Variables,  Next: The High-Level LDAP API,  Prev: XEmacs LDAP API,  Up: XEmacs LDAP API
6938
6939 LDAP Variables
6940 --------------
6941
6942  - Variable: ldap-default-host
6943      The default LDAP server hostname.  A TCP port number can be
6944      appended to that name using a colon as a separator.
6945
6946  - Variable: ldap-default-port
6947      Default TCP port for LDAP connections.  Initialized from the LDAP
6948      library. Default value is 389.
6949
6950  - Variable: ldap-default-base
6951      Default base for LDAP searches.  This is a string using the syntax
6952      of RFC 1779.  For instance, "o=ACME, c=US" limits the search to the
6953      Acme organization in the United States.
6954
6955  - Variable: ldap-host-parameters-alist
6956      An alist of per host options for LDAP transactions.  The list
6957      elements look like `(HOST PROP1 VAL1 PROP2 VAL2 ...)' HOST is the
6958      name of an LDAP server. A TCP port number can be appended to that
6959      name using a colon as a separator.  PROPN and VALN are
6960      property/value pairs describing parameters for the server.  Valid
6961      properties:
6962     `binddn'
6963           The distinguished name of the user to bind as.  This may look
6964           like `cn=Babs Jensen,o=ACME,c=US', see RFC 1779 for details.
6965
6966     `passwd'
6967           The password to use for authentication.
6968
6969     `auth'
6970           The authentication method to use, possible values depend on
6971           the LDAP library XEmacs was compiled with, they may include
6972           `simple', `krbv41' and `krbv42'.
6973
6974     `base'
6975           The base for the search. This may look like `cÿ, o¬me', see
6976           RFC 1779 for syntax details.
6977
6978     `scope'
6979           One of the symbols `base', `onelevel' or `subtree' indicating
6980           the scope of the search limited to a base object, to a single
6981           level or to the whole subtree.
6982
6983     `deref'
6984           The dereference policy is one of the symbols `never',
6985           `always', `search' or `find' and defines how aliases are
6986           dereferenced.
6987          `never'
6988                Aliases are never dereferenced
6989
6990          `always'
6991                Aliases are always dereferenced
6992
6993          `search'
6994                Aliases are dereferenced when searching
6995
6996          `find'
6997                Aliases are dereferenced when locating the base object
6998                for the search
6999
7000     `timelimit'
7001           The timeout limit for the connection in seconds.
7002
7003     `sizelimit'
7004           The maximum number of matches to return for searches
7005           performed on this connection.
7006
7007  - Variable: ldap-verbose
7008      If non-`nil', LDAP operations will echo progress messages.
7009      Defaults to `nil'.
7010
7011 \1f
7012 File: lispref.info,  Node: The High-Level LDAP API,  Next: The Low-Level LDAP API,  Prev: LDAP Variables,  Up: XEmacs LDAP API
7013
7014 The High-Level LDAP API
7015 -----------------------
7016
7017 The following functions provide the most convenient interface to perform
7018 LDAP operations.  All of them open a connection to a host, perform an
7019 operation (add/search/modify/delete) on one or several entries and
7020 cleanly close the connection thus insulating the user from all the
7021 details of the low-level interface such as LDAP Lisp objects *note The
7022 Low-Level LDAP API::.
7023
7024    Note that `ldap-search' which used to be the name of the high-level
7025 search function in XEmacs 21.1 is now obsolete.  For consistency  in the
7026 naming as well as backward compatibility, that function now acts as a
7027 wrapper that calls either `ldap-search-basic' (low-level search
7028 function) or `ldap-search-entries' (high-level search function)
7029 according to the actual parameters.  A direct call to one of these two
7030 functions is preferred since it is faster and unambiguous.
7031
7032  - Command: ldap-search-entries filter &optional host attributes
7033           attrsonly withdn
7034      Perform an LDAP search.  FILTER is the search filter *note Syntax
7035      of Search Filters:: HOST is the LDAP host on which to perform the
7036      search.  ATTRIBUTES is the specific attributes to retrieve, `nil'
7037      means retrieve all.  ATTRSONLY if non-`nil' retrieves the
7038      attributes only without their associated values.  If WITHDN is
7039      non-`nil' each entry in the result will be prepended with its
7040      distinguished name DN.  Additional search parameters can be
7041      specified through `ldap-host-parameters-alist'.  The function
7042      returns a list of matching entries.  Each entry is itself an alist
7043      of attribute/value pairs optionally preceded by the DN of the
7044      entry according to the value of WITHDN.
7045
7046  - Function: ldap-add-entries entries &optional host binddn passwd
7047      Add entries to an LDAP directory.  ENTRIES is a list of entry
7048      specifications of the form `(DN (ATTR . VALUE) (ATTR . VALUE) ...)'
7049      where DN the distinguished name of an entry to add, the following
7050      are cons cells containing attribute/value string pairs.  HOST is
7051      the LDAP host, defaulting to `ldap-default-host'.  BINDDN is the
7052      DN to bind as to the server.  PASSWD is the corresponding password.
7053
7054  - Function: ldap-modify-entries entry-mods &optional host binddn passwd
7055      Modify entries of an LDAP directory.  ENTRY_MODS is a list of
7056      entry modifications of the form `(DN MOD-SPEC1 MOD-SPEC2 ...)'
7057      where DN is the distinguished name of the entry to modify, the
7058      following are modification specifications.  A modification
7059      specification is itself a list of the form `(MOD-OP ATTR VALUE1
7060      VALUE2 ...)' MOD-OP and ATTR are mandatory, VALUES are optional
7061      depending on MOD-OP.  MOD-OP is the type of modification, one of
7062      the symbols `add', `delete' or `replace'. ATTR is the LDAP
7063      attribute type to modify.  HOST is the LDAP host, defaulting to
7064      `ldap-default-host'.  BINDDN is the DN to bind as to the server.
7065      PASSWD is the corresponding password.
7066
7067  - Function: ldap-delete-entries dn &optional host binddn passwd
7068      Delete an entry from an LDAP directory.  DN is the distinguished
7069      name of an entry to delete or a list of those.  HOST is the LDAP
7070      host, defaulting to `ldap-default-host'.  BINDDN is the DN to bind
7071      as to the server.  PASSWD is the corresponding password.
7072
7073 \1f
7074 File: lispref.info,  Node: The Low-Level LDAP API,  Next: LDAP Internationalization,  Prev: The High-Level LDAP API,  Up: XEmacs LDAP API
7075
7076 The Low-Level LDAP API
7077 ----------------------
7078
7079 The low-level API should be used directly for very specific purposes
7080 (such as multiple operations on a connection) only.  The higher-level
7081 functions provide a more convenient way to access LDAP directories
7082 hiding the subtleties of handling the connection, translating arguments
7083 and ensuring compliance with LDAP internationalization rules and formats
7084 (currently partly implemented only). See *note The High-Level LDAP API::
7085
7086    Note that the former functions `ldap-*-internal' functions have been
7087 renamed in XEmacs 21.2
7088
7089 * Menu:
7090
7091 * The LDAP Lisp Object::
7092 * Opening and Closing a LDAP Connection::
7093 * Low-level Operations on a LDAP Server::
7094