home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
new
/
util
/
edit
/
jade
/
man
/
jade.info-8
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-10-16
|
50KB
|
977 lines
This is Info file jade.info, produced by Makeinfo-1.55 from the input
file jade.texi.
START-INFO-DIR-ENTRY
* Jade: (jade). An editor for X11 and AmigaDOS
END-INFO-DIR-ENTRY
This is Edition 1.3, last updated 7 October 1994, of `The Jade
Manual', for Jade, Version 3.2.
Jade is a text editor for X11 (on Unix) and the Amiga.
Copyright 1993, 1994 John Harper.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
File: jade.info, Node: Keymaps, Next: Event Loop, Prev: Input Events, Up: Programming Jade
Keymaps
=======
A "keymap" is a Lisp object defining a mapping between input events
(*note Input Events::.) and commands to be executed when the event loop
(*note Event Loop::.) receives the input event.
- Function: keymapp OBJECT
Returns `t' when OBJECT is a keymap.
* Menu:
* Types of Keymap:: Two different formats of keymap
* Creating Keymaps:: Allocating new keymaps
* Binding Keys:: Inserting and removing key bindings
* Key Lookup:: How a key press is resolved into a command
* Prefix Keys:: Chaining events into multiple-event
bindings
* Standard Keymaps:: Predefined keymaps you can modify
File: jade.info, Node: Types of Keymap, Next: Creating Keymaps, Up: Keymaps
Types of Keymap
---------------
There are two different types of keymap; one for keymaps which
contain only a few bindings, the other providing a more efficient
method of storing larger numbers of bindings.
"Key lists"
These are used for keymaps which only contain a few bindings; they
are lists whose first element is the symbol `keymap'. All
subsequent elements define bindings, they are represented by
three-element vectors. The first two are the contents of the cons
cell representing the input event, the other element is the
command to be invoked.
For example,
(keymap [120 9 some-command])
Since the event `(120 . 9)' is the key press `Ctrl-x', this keymap
binds the command `some-command' to the key press `Ctrl-x'.
"Key tables"
Key tables are used for keymaps which contain a larger number of
bindings. They are vectors of 127 elements, a hash function is
used to hash each event contained in the keymap into one of the
127 buckets. Each bucket is a list of key bindings in the same
form as a key list (but without the `keymap' symbol).
File: jade.info, Node: Creating Keymaps, Next: Binding Keys, Prev: Types of Keymap, Up: Keymaps
Creating Keymaps
----------------
Since there are two different types of keymap (lists and tables)
there are two different functions for creating them with.
- Function: make-keylist
Creates and returns a new key list containing no bindings.
(make-keylist)
=> (keymap)
- Function: make-keytab
This function returns a new key table; it will be totally empty.
(make-keytab)
=> [nil nil ... nil]
If you want to produce a new copy of a keymap use the `copy-sequence'
function (*note Sequence Functions::.) to duplicate the source keymap.
File: jade.info, Node: Binding Keys, Next: Key Lookup, Prev: Creating Keymaps, Up: Keymaps
Binding Keys
------------
The `bind-keys' function is used to install new key bindings into a
keymap (either a key list or table).
- Function: bind-keys KEYMAP &rest BINDINGS
This function installs zero or more key bindings into the keymap
KEYMAP.
Each binding is defined by two elements in the list of BINDINGS,
the first defines the name of the input event (or the event itself)
and the second defines the command to be associated with the event.
For example to bind two keys in the keymap KEYMAP; the event
`Ctrl-f' to the command `goto-next-char' and the event `Ctrl-b' to
the command `goto-prev-command' the following form would be used,
(bind-keys KEYMAP
"Ctrl-f" 'goto-next-char
"Ctrl-b" 'goto-prev-char)
- Function: unbind-keys KEYMAP &rest KEYS
This function removes the bindings of the events KEYS (these may
be the names of the events or the event objects themselves) from
the keymap KEYMAP.
(unbind-keys KEYMAP
"Ctrl-f"
"Ctrl-b")
File: jade.info, Node: Key Lookup, Next: Prefix Keys, Prev: Binding Keys, Up: Keymaps
Key Lookup
----------
Each time the event loop (*note Event Loop::.) receives an input
event from the window system it searches for a binding of that event.
The variables `keymap-path' and `next-keymap-path' are used to
determine the "keymap environment", this is the list of keymaps which
are searched when looking for the binding.
- Function: lookup-event-binding EVENT &optional RESET-PATH
This function examines the current keymap environment for a
binding of the event EVENT (*note Input Events::.). If such a
binding is found its command is returned, otherwise `nil' is
returned.
If the optional RESET-PATH argument is non-`nil' the
`next-keymap-path' variable will be set to `nil', otherwise it
will be left with its original value.
- Variable: keymap-path
A buffer-local variable providing the list of keymaps (or
variables whose values are keymaps) which will be searched for a
binding when the value of the `next-keymap-path' variable is `nil'.
keymap-path
=> (minor-mode-keymap texinfo-keymap global-keymap)
- Variable: next-keymap-path
This variable is used to create multi-event key bindings. When it
has a non-`nil' value it overrides the `keymap-path' variable when
a key binding is being searched for.
After the value of this variable is used to search for a key
binding it is set to `nil'. This means that, unless another prefix
key occurred, the next input event received will be resolved
through the `keymap-path' variable.
When this variable is set the value of the `prefix-arg' variable is
set to the current value of the `current-prefix-arg' variable.
This is so a prefix argument given to a multi-event command is
transmitted through to the command.
For more details on multi-event bindings see *Note Prefix Keys::.
File: jade.info, Node: Prefix Keys, Next: Standard Keymaps, Prev: Key Lookup, Up: Keymaps
Prefix Keys
-----------
As briefly noted in the previous section it is possible to create
multi-event key bindings. The `next-keymap-path' variable is used to
link key presses (known as "prefix keys" since they prefix the actual,
command-invoking, binding) to a new keymap environment which will be
used to resolve the next key press. This method allows key sequences of
an arbitrary length to be used.
The best way to explain this is probably with an example. Consider
the following,
(setq entry-keymap (make-keylist))
(bind-keys entry-keymap
"Ctrl-x" '(setq next-keymap-path '(second-keymap)))
(setq second-keymap (make-keylist))
(bind-keys second-keymap
"Ctrl-j" 'some-command)
Two keymaps are created, the first of which, `entry-keymap', would be
placed in the `keymap-path' list. When `Ctrl-x' is typed the associated
command would be invoked, installing the next piece of the chain, the
`second-keymap' into the `next-keymap-path' variable.
So, after `Ctrl-x' is typed the keymap environment will be the list
of keymaps `(second-keymap)', subsequently typing `Ctrl-j' would then
invoke the command `some-command'.
File: jade.info, Node: Standard Keymaps, Prev: Prefix Keys, Up: Keymaps
Standard Keymaps
----------------
Several keymaps are predefined by Jade.
`global-keymap'
This keymap is the root of the global keymap structure; all buffers
which allow themselves to be edited have th