1 This is ../info/lispref.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION XEmacs Editor
6 * Lispref: (lispref). XEmacs Lisp Reference Manual.
11 GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
12 Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
13 Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
14 XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
15 GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
16 Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
17 Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
18 Reference Manual (for 19.15 and 20.1, 20.2, 20.3) v3.2, April, May,
19 November 1997 XEmacs Lisp Reference Manual (for 21.0) v3.3, April 1998
21 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
22 Foundation, Inc. Copyright (C) 1994, 1995 Sun Microsystems, Inc.
23 Copyright (C) 1995, 1996 Ben Wing.
25 Permission is granted to make and distribute verbatim copies of this
26 manual provided the copyright notice and this permission notice are
27 preserved on all copies.
29 Permission is granted to copy and distribute modified versions of
30 this manual under the conditions for verbatim copying, provided that the
31 entire resulting derived work is distributed under the terms of a
32 permission notice identical to this one.
34 Permission is granted to copy and distribute translations of this
35 manual into another language, under the above conditions for modified
36 versions, except that this permission notice may be stated in a
37 translation approved by the Foundation.
39 Permission is granted to copy and distribute modified versions of
40 this manual under the conditions for verbatim copying, provided also
41 that the section entitled "GNU General Public License" is included
42 exactly as in the original, and provided that the entire resulting
43 derived work is distributed under the terms of a permission notice
44 identical to this one.
46 Permission is granted to copy and distribute translations of this
47 manual into another language, under the above conditions for modified
48 versions, except that the section entitled "GNU General Public License"
49 may be included in a translation approved by the Free Software
50 Foundation instead of in the original English.
53 File: lispref.info, Node: Input Modes, Next: Translating Input, Up: Terminal Input
58 - Function: set-input-mode interrupt flow meta quit-char
59 This function sets the mode for reading keyboard input. If
60 INTERRUPT is non-null, then XEmacs uses input interrupts. If it is
61 `nil', then it uses CBREAK mode. When XEmacs communicates
62 directly with X, it ignores this argument and uses interrupts if
63 that is the way it knows how to communicate.
65 If FLOW is non-`nil', then XEmacs uses XON/XOFF (`C-q', `C-s')
66 flow control for output to the terminal. This has no effect except
67 in CBREAK mode. *Note Flow Control::.
69 The default setting is system dependent. Some systems always use
70 CBREAK mode regardless of what is specified.
72 The argument META controls support for input character codes above
73 127. If META is `t', XEmacs converts characters with the 8th bit
74 set into Meta characters. If META is `nil', XEmacs disregards the
75 8th bit; this is necessary when the terminal uses it as a parity
76 bit. If META is neither `t' nor `nil', XEmacs uses all 8 bits of
77 input unchanged. This is good for terminals using European 8-bit
80 If QUIT-CHAR is non-`nil', it specifies the character to use for
81 quitting. Normally this character is `C-g'. *Note Quitting::.
83 The `current-input-mode' function returns the input mode settings
84 XEmacs is currently using.
86 - Function: current-input-mode
87 This function returns current mode for reading keyboard input. It
88 returns a list, corresponding to the arguments of `set-input-mode',
89 of the form `(INTERRUPT FLOW META QUIT)' in which:
91 is non-`nil' when XEmacs is using interrupt-driven input. If
92 `nil', Emacs is using CBREAK mode.
95 is non-`nil' if XEmacs uses XON/XOFF (`C-q', `C-s') flow
96 control for output to the terminal. This value has no effect
97 unless INTERRUPT is non-`nil'.
100 is `t' if XEmacs treats the eighth bit of input characters as
101 the meta bit; `nil' means XEmacs clears the eighth bit of
102 every input character; any other value means XEmacs uses all
103 eight bits as the basic character code.
106 is the character XEmacs currently uses for quitting, usually
110 File: lispref.info, Node: Translating Input, Next: Recording Input, Prev: Input Modes, Up: Terminal Input
112 Translating Input Events
113 ------------------------
115 This section describes features for translating input events into
116 other input events before they become part of key sequences.
118 - Variable: function-key-map
119 This variable holds a keymap that describes the character sequences
120 sent by function keys on an ordinary character terminal. This
121 keymap uses the same data structure as other keymaps, but is used
122 differently: it specifies translations to make while reading
125 If `function-key-map' "binds" a key sequence K to a vector V, then
126 when K appears as a subsequence _anywhere_ in a key sequence, it
127 is replaced with the events in V.
129 For example, VT100 terminals send `<ESC> O P' when the keypad PF1
130 key is pressed. Therefore, we want XEmacs to translate that
131 sequence of events into the single event `pf1'. We accomplish
132 this by "binding" `<ESC> O P' to `[pf1]' in `function-key-map',
135 Thus, typing `C-c <PF1>' sends the character sequence `C-c <ESC> O
136 P'; later the function `read-key-sequence' translates this back
137 into `C-c <PF1>', which it returns as the vector `[?\C-c pf1]'.
139 Entries in `function-key-map' are ignored if they conflict with
140 bindings made in the minor mode, local, or global keymaps. The
141 intent is that the character sequences that function keys send
142 should not have command bindings in their own right.
144 The value of `function-key-map' is usually set up automatically
145 according to the terminal's Terminfo or Termcap entry, but
146 sometimes those need help from terminal-specific Lisp files.
147 XEmacs comes with terminal-specific files for many common
148 terminals; their main purpose is to make entries in
149 `function-key-map' beyond those that can be deduced from Termcap
150 and Terminfo. *Note Terminal-Specific::.
152 Emacs versions 18 and earlier used totally different means of
153 detecting the character sequences that represent function keys.
155 - Variable: key-translation-map
156 This variable is another keymap used just like `function-key-map'
157 to translate input events into other events. It differs from
158 `function-key-map' in two ways:
160 * `key-translation-map' goes to work after `function-key-map' is
161 finished; it receives the results of translation by
164 * `key-translation-map' overrides actual key bindings.
166 The intent of `key-translation-map' is for users to map one
167 character set to another, including ordinary characters normally
168 bound to `self-insert-command'.
170 You can use `function-key-map' or `key-translation-map' for more
171 than simple aliases, by using a function, instead of a key sequence, as
172 the "translation" of a key. Then this function is called to compute
173 the translation of that key.
175 The key translation function receives one argument, which is the
176 prompt that was specified in `read-key-sequence'--or `nil' if the key
177 sequence is being read by the editor command loop. In most cases you
178 can ignore the prompt value.
180 If the function reads input itself, it can have the effect of
181 altering the event that follows. For example, here's how to define
182 `C-c h' to turn the character that follows into a Hyper character:
184 (defun hyperify (prompt)
185 (let ((e (read-event)))
186 (vector (if (numberp e)
187 (logior (lsh 1 20) e)
188 (if (memq 'hyper (event-modifiers e))
190 (add-event-modifier "H-" e))))))
192 (defun add-event-modifier (string e)
193 (let ((symbol (if (symbolp e) e (car e))))
194 (setq symbol (intern (concat string
195 (symbol-name symbol))))
198 (cons symbol (cdr e)))))
200 (define-key function-key-map "\C-ch" 'hyperify)
202 The `iso-transl' library uses this feature to provide a way of
203 inputting non-ASCII Latin-1 characters.
206 File: lispref.info, Node: Recording Input, Prev: Translating Input, Up: Terminal Input
211 - Function: recent-keys &optional number
212 This function returns a vector containing recent input events from
213 the keyboard or mouse. By default, 100 events are recorded, which
214 is how many `recent-keys' returns.
216 All input events are included, whether or not they were used as
217 parts of key sequences. Thus, you always get the last 100 inputs,
218 not counting keyboard macros. (Events from keyboard macros are
219 excluded because they are less interesting for debugging; it
220 should be enough to see the events that invoked the macros.)
222 If NUMBER is specified, not more than NUMBER events will be
223 returned. You may change the number of stored events using
224 `set-recent-keys-ring-size'.
226 - Function: recent-keys-ring-size
227 This function returns the number of recent events stored
228 internally. This is also the maximum number of events
229 `recent-keys' can return. By default, 100 events are stored.
231 - Function: set-recent-keys-ring-size size
232 This function changes the number of events stored by XEmacs and
233 returned by `recent-keys'.
235 For example, `(set-recent-keys-ring-size 250)' will make XEmacs
236 remember last 250 events and will make `recent-keys' return last
237 250 events by default.
239 - Command: open-dribble-file filename
240 This function opens a "dribble file" named FILENAME. When a
241 dribble file is open, each input event from the keyboard or mouse
242 (but not those from keyboard macros) is written in that file. A
243 non-character event is expressed using its printed representation
244 surrounded by `<...>'.
246 You close the dribble file by calling this function with an
249 This function is normally used to record the input necessary to
250 trigger an XEmacs bug, for the sake of a bug report.
252 (open-dribble-file "~/dribble")
255 See also the `open-termscript' function (*note Terminal Output::).
258 File: lispref.info, Node: Terminal Output, Next: Flow Control, Prev: Terminal Input, Up: System Interface
263 The terminal output functions send output to the terminal or keep
264 track of output sent to the terminal. The function `device-baud-rate'
265 tells you what XEmacs thinks is the output speed of the terminal.
267 - Function: device-baud-rate &optional device
268 This function's value is the output speed of the terminal
269 associated with DEVICE, as far as XEmacs knows. DEVICE defaults
270 to the selected device (usually the only device) if omitted.
271 Changing this value does not change the speed of actual data
272 transmission, but the value is used for calculations such as
273 padding. This value has no effect for window-system devices.
274 (This is different in FSF Emacs, where the baud rate also affects
275 decisions about whether to scroll part of the screen or repaint,
276 even when using a window system.)
278 The value is measured in bits per second.
280 XEmacs attempts to automatically initialize the baud rate by querying
281 the terminal. If you are running across a network, however, and
282 different parts of the network work are at different baud rates, the
283 value returned by XEmacs may be different from the value used by your
284 local terminal. Some network protocols communicate the local terminal
285 speed to the remote machine, so that XEmacs and other programs can get
286 the proper value, but others do not. If XEmacs has the wrong value, it
287 makes decisions that are less than optimal. To fix the problem, use
288 `set-device-baud-rate'.
290 - Function: set-device-baud-rate &optional device
291 This function sets the output speed of DEVICE. See
292 `device-baud-rate'. DEVICE defaults to the selected device
293 (usually the only device) if omitted.
295 - Function: send-string-to-terminal char-or-string &optional stdout-p
297 This function sends CHAR-OR-STRING to the terminal without
298 alteration. Control characters in CHAR-OR-STRING have
299 terminal-dependent effects.
301 If DEVICE is `nil', this function writes to XEmacs's stderr, or to
302 stdout if STDOUT-P is non-`nil'. Otherwise, DEVICE should be a
303 tty or stream device, and the function writes to the device's
304 normal or error output, according to STDOUT-P.
306 One use of this function is to define function keys on terminals
307 that have downloadable function key definitions. For example,
308 this is how on certain terminals to define function key 4 to move
309 forward four characters (by transmitting the characters `C-u C-f'
312 (send-string-to-terminal "\eF4\^U\^F")
315 - Command: open-termscript filename
316 This function is used to open a "termscript file" that will record
317 all the characters sent by XEmacs to the terminal. (If there are
318 multiple tty or stream devices, all characters sent to all such
319 devices are recorded.) The function returns `nil'. Termscript
320 files are useful for investigating problems where XEmacs garbles
321 the screen, problems that are due to incorrect Termcap entries or
322 to undesirable settings of terminal options more often than to
323 actual XEmacs bugs. Once you are certain which characters were
324 actually output, you can determine reliably whether they
325 correspond to the Termcap specifications in use.
327 A `nil' value for FILENAME stops recording terminal output.
329 See also `open-dribble-file' in *Note Terminal Input::.
331 (open-termscript "../junk/termscript")
335 File: lispref.info, Node: Flow Control, Next: Batch Mode, Prev: Terminal Output, Up: System Interface
340 This section attempts to answer the question "Why does XEmacs choose
341 to use flow-control characters in its command character set?" For a
342 second view on this issue, read the comments on flow control in the
343 `emacs/INSTALL' file from the distribution; for help with Termcap
344 entries and DEC terminal concentrators, see `emacs/etc/TERMS'.
346 At one time, most terminals did not need flow control, and none used
347 `C-s' and `C-q' for flow control. Therefore, the choice of `C-s' and
348 `C-q' as command characters was uncontroversial. XEmacs, for economy
349 of keystrokes and portability, used nearly all the ASCII control
350 characters, with mnemonic meanings when possible; thus, `C-s' for
351 search and `C-q' for quote.
353 Later, some terminals were introduced which required these characters
354 for flow control. They were not very good terminals for full-screen
355 editing, so XEmacs maintainers did not pay attention. In later years,
356 flow control with `C-s' and `C-q' became widespread among terminals,
357 but by this time it was usually an option. And the majority of users,
358 who can turn flow control off, were unwilling to switch to less
359 mnemonic key bindings for the sake of flow control.
361 So which usage is "right", XEmacs's or that of some terminal and
362 concentrator manufacturers? This question has no simple answer.
364 One reason why we are reluctant to cater to the problems caused by
365 `C-s' and `C-q' is that they are gratuitous. There are other
366 techniques (albeit less common in practice) for flow control that
367 preserve transparency of the character stream. Note also that their use
368 for flow control is not an official standard. Interestingly, on the
369 model 33 teletype with a paper tape punch (which is very old), `C-s'
370 and `C-q' were sent by the computer to turn the punch on and off!
372 As X servers and other window systems replace character-only
373 terminals, this problem is gradually being cured. For the mean time,
374 XEmacs provides a convenient way of enabling flow control if you want
375 it: call the function `enable-flow-control'.
377 - Function: enable-flow-control
378 This function enables use of `C-s' and `C-q' for output flow
379 control, and provides the characters `C-\' and `C-^' as aliases
380 for them using `keyboard-translate-table' (*note Translating
383 You can use the function `enable-flow-control-on' in your `.emacs'
384 file to enable flow control automatically on certain terminal types.
386 - Function: enable-flow-control-on &rest termtypes
387 This function enables flow control, and the aliases `C-\' and
388 `C-^', if the terminal type is one of TERMTYPES. For example:
390 (enable-flow-control-on "vt200" "vt300" "vt101" "vt131")
392 Here is how `enable-flow-control' does its job:
394 1. It sets CBREAK mode for terminal input, and tells the operating
395 system to handle flow control, with `(set-input-mode nil t)'.
397 2. It sets up `keyboard-translate-table' to translate `C-\' and `C-^'
398 into `C-s' and `C-q'. Except at its very lowest level, XEmacs
399 never knows that the characters typed were anything but `C-s' and
400 `C-q', so you can in effect type them as `C-\' and `C-^' even when
401 they are input for other commands. *Note Translating Input::.
403 If the terminal is the source of the flow control characters, then
404 once you enable kernel flow control handling, you probably can make do
405 with less padding than normal for that terminal. You can reduce the
406 amount of padding by customizing the Termcap entry. You can also
407 reduce it by setting `baud-rate' to a smaller value so that XEmacs uses
408 a smaller speed when calculating the padding needed. *Note Terminal
412 File: lispref.info, Node: Batch Mode, Prev: Flow Control, Up: System Interface
417 The command line option `-batch' causes XEmacs to run
418 noninteractively. In this mode, XEmacs does not read commands from the
419 terminal, it does not alter the terminal modes, and it does not expect
420 to be outputting to an erasable screen. The idea is that you specify
421 Lisp programs to run; when they are finished, XEmacs should exit. The
422 way to specify the programs to run is with `-l FILE', which loads the
423 library named FILE, and `-f FUNCTION', which calls FUNCTION with no
426 Any Lisp program output that would normally go to the echo area,
427 either using `message' or using `prin1', etc., with `t' as the stream,
428 goes instead to XEmacs's standard error descriptor when in batch mode.
429 Thus, XEmacs behaves much like a noninteractive application program.
430 (The echo area output that XEmacs itself normally generates, such as
431 command echoing, is suppressed entirely.)
433 - Function: noninteractive
434 This function returns non-`nil' when XEmacs is running in batch
437 - Variable: noninteractive
438 This variable is non-`nil' when XEmacs is running in batch mode.
439 Setting this variable to `nil', however, will not change whether
440 XEmacs is running in batch mode, and will not change the return
441 value of the `noninteractive' function.
444 File: lispref.info, Node: X-Windows, Next: ToolTalk Support, Prev: System Interface, Up: Top
446 Functions Specific to the X Window System
447 *****************************************
449 XEmacs provides the concept of "devices", which generalizes
450 connections to an X server, a TTY device, etc. Most information about
451 an X server that XEmacs is connected to can be determined through
452 general console and device functions. *Note Consoles and Devices::.
453 However, there are some features of the X Window System that do not
454 generalize well, and they are covered specially here.
458 * X Selections:: Transferring text to and from other X clients.
459 * X Server:: Information about the X server connected to
461 * X Miscellaneous:: Other X-specific functions and variables.
464 File: lispref.info, Node: X Selections, Next: X Server, Up: X-Windows
469 The X server records a set of "selections" which permit transfer of
470 data between application programs. The various selections are
471 distinguished by "selection types", represented in XEmacs by symbols.
472 X clients including XEmacs can read or set the selection for any given
475 - Function: x-own-selection data &optional type
476 This function sets a "selection" in the X server. It takes two
477 arguments: a value, DATA, and the selection type TYPE to assign it
478 to. DATA may be a string, a cons of two markers, or an extent.
479 In the latter cases, the selection is considered to be the text
480 between the markers, or between the extent's endpoints.
482 Each possible TYPE has its own selection value, which changes
483 independently. The usual values of TYPE are `PRIMARY' and
484 `SECONDARY'; these are symbols with upper-case names, in accord
485 with X Windows conventions. The default is `PRIMARY'.
487 (In FSF Emacs, this function is called `x-set-selection' and takes
488 different arguments.)
490 - Function: x-get-selection
491 This function accesses selections set up by XEmacs or by other X
492 clients. It returns the value of the current primary selection.
494 - Function: x-disown-selection &optional secondary-p
495 Assuming we own the selection, this function disowns it. If
496 SECONDARY-P is non-`nil', the secondary selection instead of the
497 primary selection is discarded.
499 The X server also has a set of numbered "cut buffers" which can
500 store text or other data being moved between applications. Cut buffers
501 are considered obsolete, but XEmacs supports them for the sake of X
502 clients that still use them.
504 - Function: x-get-cutbuffer &optional n
505 This function returns the contents of cut buffer number N. (This
506 function is called `x-get-cut-buffer' in FSF Emacs.)
508 - Function: x-store-cutbuffer string
509 This function stores STRING into the first cut buffer (cut buffer
510 0), moving the other values down through the series of cut buffers,
511 kill-ring-style. (This function is called `x-set-cut-buffer' in FSF
515 File: lispref.info, Node: X Server, Next: X Miscellaneous, Prev: X Selections, Up: X-Windows
520 This section describes how to access and change the overall status of
521 the X server XEmacs is using.
525 * Resources:: Getting resource values from the server.
526 * Server Data:: Getting info about the X server.
527 * Grabs:: Restricting access to the server by other apps.
530 File: lispref.info, Node: Resources, Next: Server Data, Up: X Server
535 - Function: default-x-device
536 This function return the default X device for resourcing. This is
537 the first-created X device that still exists.
539 - Function: x-get-resource name class type &optional locale device
541 This function retrieves a resource value from the X resource
544 * The first arg is the name of the resource to retrieve, such as
547 * The second arg is the class of the resource to retrieve, like
550 * The third arg should be one of the symbols `string',
551 `integer', `natnum', or `boolean', specifying the type of
552 object that the database is searched for.
554 * The fourth arg is the locale to search for the resources on,
555 and can currently be a a buffer, a frame, a device, or the
556 symbol `global'. If omitted, it defaults to `global'.
558 * The fifth arg is the device to search for the resources on.
559 (The resource database for a particular device is constructed
560 by combining non-device- specific resources such any
561 command-line resources specified and any app-defaults files
562 found [or the fallback resources supplied by XEmacs, if no
563 app-defaults file is found] with device-specific resources
564 such as those supplied using `xrdb'.) If omitted, it defaults
565 to the device of LOCALE, if a device can be derived (i.e. if
566 LOCALE is a frame or device), and otherwise defaults to the
567 value of `default-x-device'.
569 * The sixth arg NOERROR, if non-`nil', means do not signal an
570 error if a bogus resource specification was retrieved (e.g.
571 if a non-integer was given when an integer was requested).
572 In this case, a warning is issued instead.
574 The resource names passed to this function are looked up relative
577 If you want to search for a subresource, you just need to specify
578 the resource levels in NAME and CLASS. For example, NAME could be
579 `"modeline.attributeFont"', and CLASS `"Face.AttributeFont"'.
583 1. If LOCALE is a buffer, a call
585 `(x-get-resource "foreground" "Foreground" 'string SOME-BUFFER)'
587 is an interface to a C call something like
589 `XrmGetResource (db, "xemacs.buffer.BUFFER-NAME.foreground",
590 "Emacs.EmacsLocaleType.EmacsBuffer.Foreground",
593 2. If LOCALE is a frame, a call
595 `(x-get-resource "foreground" "Foreground" 'string SOME-FRAME)'
597 is an interface to a C call something like
599 `XrmGetResource (db, "xemacs.frame.FRAME-NAME.foreground",
600 "Emacs.EmacsLocaleType.EmacsFrame.Foreground",
603 3. If LOCALE is a device, a call
605 `(x-get-resource "foreground" "Foreground" 'string SOME-DEVICE)'
607 is an interface to a C call something like
609 `XrmGetResource (db, "xemacs.device.DEVICE-NAME.foreground",
610 "Emacs.EmacsLocaleType.EmacsDevice.Foreground",
613 4. If LOCALE is the symbol `global', a call
615 `(x-get-resource "foreground" "Foreground" 'string 'global)'
617 is an interface to a C call something like
619 `XrmGetResource (db, "xemacs.foreground",
623 Note that for `global', no prefix is added other than that of the
624 application itself; thus, you can use this locale to retrieve
625 arbitrary application resources, if you really want to.
627 The returned value of this function is `nil' if the queried
628 resource is not found. If TYPE is `string', a string is returned,
629 and if it is `integer', an integer is returned. If TYPE is
630 `boolean', then the returned value is the list `(t)' for true,
631 `(nil)' for false, and is `nil' to mean "unspecified".
633 - Function: x-put-resource resource-line &optional device
634 This function adds a resource to the resource database for DEVICE.
635 RESOURCE-LINE specifies the resource to add and should be a
636 standard resource specification.
638 - Variable: x-emacs-application-class
639 This variable holds The X application class of the XEmacs process.
640 This controls, among other things, the name of the "app-defaults"
641 file that XEmacs will use. For changes to this variable to take
642 effect, they must be made before the connection to the X server is
643 initialized, that is, this variable may only be changed before
644 XEmacs is dumped, or by setting it in the file
645 `lisp/term/x-win.el'.
647 By default, this variable is nil at startup. When the connection
648 to the X server is first initialized, the X resource database will
649 be consulted and the value will be set according to whether any
650 resources are found for the application class "XEmacs".
653 File: lispref.info, Node: Server Data, Next: Grabs, Prev: Resources, Up: X Server
655 Data about the X Server
656 -----------------------
658 This section describes functions and a variable that you can use to
659 get information about the capabilities and origin of the X server
660 corresponding to a particular device. The device argument is generally
661 optional and defaults to the selected device.
663 - Function: x-server-version &optional device
664 This function returns the list of version numbers of the X server
665 DEVICE is on. The returned value is a list of three integers: the
666 major and minor version numbers of the X protocol in use, and the
667 vendor-specific release number.
669 - Function: x-server-vendor &optional device
670 This function returns the vendor supporting the X server DEVICE is
673 - Function: x-display-visual-class &optional device
674 This function returns the visual class of the display DEVICE is
675 on. The value is one of the symbols `static-gray', `gray-scale',
676 `static-color', `pseudo-color', `true-color', and `direct-color'.
677 (Note that this is different from previous versions of XEmacs,
678 which returned `StaticGray', `GrayScale', etc.)
681 File: lispref.info, Node: Grabs, Prev: Server Data, Up: X Server
683 Restricting Access to the Server by Other Apps
684 ----------------------------------------------
686 - Function: x-grab-keyboard &optional device
687 This function grabs the keyboard on the given device (defaulting
688 to the selected one). So long as the keyboard is grabbed, all
689 keyboard events will be delivered to XEmacs--it is not possible
690 for other X clients to eavesdrop on them. Ungrab the keyboard
691 with `x-ungrab-keyboard' (use an `unwind-protect'). Returns `t'
692 if the grab was successful; `nil' otherwise.
694 - Function: x-ungrab-keyboard &optional device
695 This function releases a keyboard grab made with `x-grab-keyboard'.
697 - Function: x-grab-pointer &optional device cursor ignore-keyboard
698 This function grabs the pointer and restricts it to its current
699 window. If optional DEVICE argument is `nil', the selected device
700 will be used. If optional CURSOR argument is non-`nil', change
701 the pointer shape to that until `x-ungrab-pointer' is called (it
702 should be an object returned by the `make-cursor' function). If
703 the second optional argument IGNORE-KEYBOARD is non-`nil', ignore
704 all keyboard events during the grab. Returns `t' if the grab is
705 successful, `nil' otherwise.
707 - Function: x-ungrab-pointer &optional device
708 This function releases a pointer grab made with `x-grab-pointer'.
709 If optional first arg DEVICE is `nil' the selected device is used.
710 If it is `t' the pointer will be released on all X devices.
713 File: lispref.info, Node: X Miscellaneous, Prev: X Server, Up: X-Windows
715 Miscellaneous X Functions and Variables
716 =======================================
718 - Variable: x-bitmap-file-path
719 This variable holds a list of the directories in which X bitmap
720 files may be found. If `nil', this is initialized from the
721 `"*bitmapFilePath"' resource. This is used by the
722 `make-image-instance' function (however, note that if the
723 environment variable `XBMLANGPATH' is set, it is consulted first).
725 - Variable: x-library-search-path
726 This variable holds the search path used by `read-color' to find
729 - Function: x-valid-keysym-name-p keysym
730 This function returns true if KEYSYM names a keysym that the X
731 library knows about. Valid keysyms are listed in the files
732 `/usr/include/X11/keysymdef.h' and in `/usr/lib/X11/XKeysymDB', or
733 whatever the equivalents are on your system.
735 - Function: x-window-id &optional frame
736 This function returns the ID of the X11 window. This gives us a
737 chance to manipulate the Emacs window from within a different
738 program. Since the ID is an unsigned long, we return it as a
741 - Variable: x-allow-sendevents
742 If non-`nil', synthetic events are allowed. `nil' means they are
743 ignored. Beware: allowing XEmacs to process SendEvents opens a
746 - Function: x-debug-mode arg &optional device
747 With a true arg, make the connection to the X server synchronous.
748 With false, make it asynchronous. Synchronous connections are
749 much slower, but are useful for debugging. (If you get X errors,
750 make the connection synchronous, and use a debugger to set a
751 breakpoint on `x_error_handler'. Your backtrace of the C stack
752 will now be useful. In asynchronous mode, the stack above
753 `x_error_handler' isn't helpful because of buffering.) If DEVICE
754 is not specified, the selected device is assumed.
756 Calling this function is the same as calling the C function
757 `XSynchronize', or starting the program with the `-sync' command
760 - Variable: x-debug-events
761 If non-zero, debug information about events that XEmacs sees is
762 displayed. Information is displayed on stderr. Currently defined
765 * 1 == non-verbose output
767 * 2 == verbose output
770 File: lispref.info, Node: ToolTalk Support, Next: LDAP Support, Prev: X-Windows, Up: Top
777 * XEmacs ToolTalk API Summary::
779 * Receiving Messages::
782 File: lispref.info, Node: XEmacs ToolTalk API Summary, Next: Sending Messages, Up: ToolTalk Support
784 XEmacs ToolTalk API Summary
785 ===========================
787 The XEmacs Lisp interface to ToolTalk is similar, at least in spirit,
788 to the standard C ToolTalk API. Only the message and pattern parts of
789 the API are supported at present; more of the API could be added if
790 needed. The Lisp interface departs from the C API in a few ways:
792 * ToolTalk is initialized automatically at XEmacs startup-time.
793 Messages can only be sent other ToolTalk applications connected to
794 the same X11 server that XEmacs is running on.
796 * There are fewer entry points; polymorphic functions with keyword
797 arguments are used instead.
799 * The callback interface is simpler and marginally less functional.
800 A single callback may be associated with a message or a pattern;
801 the callback is specified with a Lisp symbol (the symbol should
802 have a function binding).
804 * The session attribute for messages and patterns is always
805 initialized to the default session.
807 * Anywhere a ToolTalk enum constant, e.g. `TT_SESSION', is valid, one
808 can substitute the corresponding symbol, e.g. `'TT_SESSION'. This
809 simplifies building lists that represent messages and patterns.
812 File: lispref.info, Node: Sending Messages, Next: Receiving Messages, Prev: XEmacs ToolTalk API Summary, Up: ToolTalk Support
819 * Example of Sending Messages::
820 * Elisp Interface for Sending Messages::
823 File: lispref.info, Node: Example of Sending Messages, Next: Elisp Interface for Sending Messages, Up: Sending Messages
825 Example of Sending Messages
826 ---------------------------
828 Here's a simple example that sends a query to another application
829 and then displays its reply. Both the query and the reply are stored
830 in the first argument of the message.
832 (defun tooltalk-random-query-handler (msg)
833 (let ((state (get-tooltalk-message-attribute msg 'state)))
835 ((eq state 'TT_HANDLED)
836 (message (get-tooltalk-message-attribute msg arg_val 0)))
837 ((memq state '(TT_FAILED TT_REJECTED))
838 (message "Random query turns up nothing")))))
840 (defvar random-query-message
845 args '((TT_INOUT "?" "string"))
846 callback tooltalk-random-query-handler))
848 (let ((m (make-tooltalk-message random-query-message)))
849 (send-tooltalk-message m))
852 File: lispref.info, Node: Elisp Interface for Sending Messages, Prev: Example of Sending Messages, Up: Sending Messages
854 Elisp Interface for Sending Messages
855 ------------------------------------
857 - Function: make-tooltalk-message attributes
858 Create a ToolTalk message and initialize its attributes. The
859 value of ATTRIBUTES must be a list of alternating keyword/values,
860 where keywords are symbols that name valid message attributes.
863 (make-tooltalk-message
868 args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
870 Values must always be strings, integers, or symbols that represent
871 ToolTalk constants. Attribute names are the same as those
872 supported by `set-tooltalk-message-attribute', plus `args'.
874 The value of `args' should be a list of message arguments where
875 each message argument has the following form:
877 `(mode [value [type]])' or just `value'
879 Where MODE is one of `TT_IN', `TT_OUT', or `TT_INOUT' and TYPE is
880 a string. If TYPE isn't specified then `int' is used if VALUE is
881 a number; otherwise `string' is used. If TYPE is `string' then
882 VALUE is converted to a string (if it isn't a string already) with
883 `prin1-to-string'. If only a value is specified then MODE
884 defaults to `TT_IN'. If MODE is `TT_OUT' then VALUE and TYPE
885 don't need to be specified. You can find out more about the
886 semantics and uses of ToolTalk message arguments in chapter 4 of
887 the `ToolTalk Programmer's Guide'.
890 - Function: send-tooltalk-message msg
891 Send the message on its way. Once the message has been sent it's
892 almost always a good idea to get rid of it with
893 `destroy-tooltalk-message'.
896 - Function: return-tooltalk-message msg &optional mode
897 Send a reply to this message. The second argument can be `reply',
898 `reject' or `fail'; the default is `reply'. Before sending a
899 reply, all message arguments whose mode is `TT_INOUT' or `TT_OUT'
900 should have been filled in--see `set-tooltalk-message-attribute'.
903 - Function: get-tooltalk-message-attribute msg attribute &optional argn
904 Returns the indicated ToolTalk message attribute. Attributes are
905 identified by symbols with the same name (underscores and all) as
906 the suffix of the ToolTalk `tt_message_<attribute>' function that
907 extracts the value. String attribute values are copied and
908 enumerated type values (except disposition) are converted to
909 symbols; e.g. `TT_HANDLER' is `'TT_HANDLER', `uid' and `gid' are
910 represented by fixnums (small integers), `opnum' is converted to a
911 string, and `disposition' is converted to a fixnum. We convert
912 `opnum' (a C int) to a string (e.g. `123' => `"123"') because
913 there's no guarantee that opnums will fit within the range of
914 XEmacs Lisp integers.
916 [TBD] Use the `plist' attribute instead of C API `user' attribute
917 for user-defined message data. To retrieve the value of a message
918 property, specify the indicator for ARGN. For example, to get the
919 value of a property called `rflag', use
921 (get-tooltalk-message-attribute msg 'plist 'rflag)
923 To get the value of a message argument use one of the `arg_val'
924 (strings), `arg_ival' (integers), or `arg_bval' (strings with
925 embedded nulls), attributes. For example, to get the integer
926 value of the third argument:
928 (get-tooltalk-message-attribute msg 'arg_ival 2)
930 As you can see, argument numbers are zero-based. The type of each
931 arguments can be retrieved with the `arg_type' attribute; however
932 ToolTalk doesn't define any semantics for the string value of
933 `arg_type'. Conventionally `string' is used for strings and `int'
934 for 32 bit integers. Note that XEmacs Lisp stores the lengths of
935 strings explicitly (unlike C) so treating the value returned by
936 `arg_bval' like a string is fine.
939 - Function: set-tooltalk-message-attribute value msg attribute
941 Initialize one ToolTalk message attribute.
943 Attribute names and values are the same as for
944 `get-tooltalk-message-attribute'. A property list is provided for
945 user data (instead of the `user' message attribute); see
946 `get-tooltalk-message-attribute'.
948 Callbacks are handled slightly differently than in the C ToolTalk
949 API. The value of CALLBACK should be the name of a function of one
950 argument. It will be called each time the state of the message
951 changes. This is usually used to notice when the message's state
952 has changed to `TT_HANDLED' (or `TT_FAILED'), so that reply
953 argument values can be used.
955 If one of the argument attributes is specified as `arg_val',
956 `arg_ival', or `arg_bval', then ARGN must be the number of an
957 already created argument. Arguments can be added to a message
958 with `add-tooltalk-message-arg'.
961 - Function: add-tooltalk-message-arg msg mode type &optional value
962 Append one new argument to the message. MODE must be one of
963 `TT_IN', `TT_INOUT', or `TT_OUT', TYPE must be a string, and VALUE
964 can be a string or an integer. ToolTalk doesn't define any
965 semantics for TYPE, so only the participants in the protocol
966 you're using need to agree what types mean (if anything).
967 Conventionally `string' is used for strings and `int' for 32 bit
968 integers. Arguments can initialized by providing a value or with
969 `set-tooltalk-message-attribute'; the latter is necessary if you
970 want to initialize the argument with a string that can contain
971 embedded nulls (use `arg_bval').
974 - Function: create-tooltalk-message
975 Create a new ToolTalk message. The message's session attribute is
976 initialized to the default session. Other attributes can be
977 initialized with `set-tooltalk-message-attribute'.
978 `make-tooltalk-message' is the preferred way to create and
979 initialize a message.
982 - Function: destroy-tooltalk-message msg
983 Apply `tt_message_destroy' to the message. It's not necessary to
984 destroy messages after they've been processed by a message or
985 pattern callback, the Lisp/ToolTalk callback machinery does this
989 File: lispref.info, Node: Receiving Messages, Prev: Sending Messages, Up: ToolTalk Support
996 * Example of Receiving Messages::
997 * Elisp Interface for Receiving Messages::
1000 File: lispref.info, Node: Example of Receiving Messages, Next: Elisp Interface for Receiving Messages, Up: Receiving Messages
1002 Example of Receiving Messages
1003 -----------------------------
1005 Here's a simple example of a handler for a message that tells XEmacs
1006 to display a string in the mini-buffer area. The message operation is
1007 called `emacs-display-string'. Its first (0th) argument is the string
1010 (defun tooltalk-display-string-handler (msg)
1011 (message (get-tooltalk-message-attribute msg 'arg_val 0)))
1013 (defvar display-string-pattern
1014 '(category TT_HANDLE
1016 op "emacs-display-string"
1017 callback tooltalk-display-string-handler))
1019 (let ((p (make-tooltalk-pattern display-string-pattern)))
1020 (register-tooltalk-pattern p))
1023 File: lispref.info, Node: Elisp Interface for Receiving Messages, Prev: Example of Receiving Messages, Up: Receiving Messages
1025 Elisp Interface for Receiving Messages
1026 --------------------------------------
1028 - Function: make-tooltalk-pattern attributes
1029 Create a ToolTalk pattern and initialize its attributes. The
1030 value of attributes must be a list of alternating keyword/values,
1031 where keywords are symbols that name valid pattern attributes or
1032 lists of valid attributes. For example:
1034 (make-tooltalk-pattern
1035 '(category TT_OBSERVE
1037 op ("operation1" "operation2")
1038 args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
1040 Attribute names are the same as those supported by
1041 `add-tooltalk-pattern-attribute', plus `'args'.
1043 Values must always be strings, integers, or symbols that represent
1044 ToolTalk constants or lists of same. When a list of values is
1045 provided all of the list elements are added to the attribute. In
1046 the example above, messages whose `op' attribute is `"operation1"'
1047 or `"operation2"' would match the pattern.
1049 The value of ARGS should be a list of pattern arguments where each
1050 pattern argument has the following form:
1052 `(mode [value [type]])' or just `value'
1054 Where MODE is one of `TT_IN', `TT_OUT', or `TT_INOUT' and TYPE is
1055 a string. If TYPE isn't specified then `int' is used if VALUE is
1056 a number; otherwise `string' is used. If TYPE is `string' then
1057 VALUE is converted to a string (if it isn't a string already) with
1058 `prin1-to-string'. If only a value is specified then MODE
1059 defaults to `TT_IN'. If MODE is `TT_OUT' then VALUE and TYPE
1060 don't need to be specified. You can find out more about the
1061 semantics and uses of ToolTalk pattern arguments in chapter 3 of
1062 the `ToolTalk Programmer's Guide'.
1065 - Function: register-tooltalk-pattern pat
1066 XEmacs will begin receiving messages that match this pattern.
1068 - Function: unregister-tooltalk-pattern pat
1069 XEmacs will stop receiving messages that match this pattern.
1071 - Function: add-tooltalk-pattern-attribute value pat indicator
1072 Add one value to the indicated pattern attribute. The names of
1073 attributes are the same as the ToolTalk accessors used to set them
1074 less the `tooltalk_pattern_' prefix and the `_add' suffix. For
1075 example, the name of the attribute for the
1076 `tt_pattern_disposition_add' attribute is `disposition'. The
1077 `category' attribute is handled specially, since a pattern can only
1078 be a member of one category (`TT_OBSERVE' or `TT_HANDLE').
1080 Callbacks are handled slightly differently than in the C ToolTalk
1081 API. The value of CALLBACK should be the name of a function of one
1082 argument. It will be called each time the pattern matches an
1085 - Function: add-tooltalk-pattern-arg pat mode type value
1086 Add one fully-specified argument to a ToolTalk pattern. MODE must
1087 be one of `TT_IN', `TT_INOUT', or `TT_OUT'. TYPE must be a
1088 string. VALUE can be an integer, string or `nil'. If VALUE is an
1089 integer then an integer argument (`tt_pattern_iarg_add') is added;
1090 otherwise a string argument is added. At present there's no way
1091 to add a binary data argument.
1094 - Function: create-tooltalk-pattern
1095 Create a new ToolTalk pattern and initialize its session attribute
1096 to be the default session.
1098 - Function: destroy-tooltalk-pattern pat
1099 Apply `tt_pattern_destroy' to the pattern. This effectively
1100 unregisters the pattern.
1102 - Function: describe-tooltalk-message msg &optional stream
1103 Print the message's attributes and arguments to STREAM. This is
1104 often useful for debugging.
1107 File: lispref.info, Node: LDAP Support, Next: PostgreSQL Support, Prev: ToolTalk Support, Up: Top
1112 XEmacs can be linked with a LDAP client library to provide Elisp
1113 primitives to access directory servers using the Lightweight Directory
1118 * Building XEmacs with LDAP support:: How to add LDAP support to XEmacs
1119 * XEmacs LDAP API:: Lisp access to LDAP functions
1120 * Syntax of Search Filters:: A brief summary of RFC 1558
1123 File: lispref.info, Node: Building XEmacs with LDAP support, Next: XEmacs LDAP API, Prev: LDAP Support, Up: LDAP Support
1125 Building XEmacs with LDAP support
1126 =================================
1128 LDAP support must be added to XEmacs at build time since it requires
1129 linking to an external LDAP client library. As of 21.2, XEmacs has been
1130 successfully built and tested with
1132 * OpenLDAP 1.2 (<http://www.openldap.org/>)
1134 * University of Michigan's LDAP 3.3
1135 (<http://www.umich.edu/~dirsvcs/ldap/>)
1137 * LDAP SDK 1.0 from Netscape Corp. (<http://developer.netscape.com/>)
1139 Other libraries conforming to RFC 1823 will probably work also but
1140 may require some minor tweaking at C level.
1142 The standard XEmacs configure script auto-detects an installed LDAP
1143 library provided the library itself and the corresponding header files
1144 can be found in the library and include paths. A successful detection
1145 will be signalled in the final output of the configure script.
1148 File: lispref.info, Node: XEmacs LDAP API, Next: Syntax of Search Filters, Prev: Building XEmacs with LDAP support, Up: LDAP Support
1153 XEmacs LDAP API consists of two layers: a low-level layer which
1154 tries to stay as close as possible to the C API (where practical) and a
1155 higher-level layer which provides more convenient primitives to
1156 effectively use LDAP.
1158 The low-level API should be used directly for very specific purposes
1159 (such as multiple operations on a connection) only. The higher-level
1160 functions provide a more convenient way to access LDAP directories
1161 hiding the subtleties of handling the connection, translating arguments
1162 and ensuring compliance with LDAP internationalization rules and formats
1163 (currently partly implemented only).
1167 * LDAP Variables:: Lisp variables related to LDAP
1168 * The High-Level LDAP API:: High-level LDAP lisp functions
1169 * The Low-Level LDAP API:: Low-level LDAP lisp primitives
1170 * LDAP Internationalization:: I18n variables and functions