aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c55
-rw-r--r--src/xterm.c19
2 files changed, 39 insertions, 35 deletions
diff --git a/src/keymap.c b/src/keymap.c
index ec45512837..5fde6b20a7 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -24,6 +24,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "lisp.h"
#include "commands.h"
#include "buffer.h"
+#include "keyboard.h"
#define min(a, b) ((a) < (b) ? (a) : (b))
@@ -67,6 +68,11 @@ Lisp_Object Vminibuffer_local_must_match_map;
/* Alist of minor mode variables and keymaps. */
Lisp_Object Vminor_mode_map_alist;
+/* Keymap mapping ASCII function key sequences onto their preferred forms.
+ Initialized by the terminal-specific lisp files. See DEFVAR for more
+ documentation. */
+Lisp_Object Vfunction_key_map;
+
Lisp_Object Qkeymapp, Qkeymap;
/* A char over 0200 in a key sequence
@@ -220,8 +226,8 @@ access_keymap (map, idx)
/* If idx is a list (some sort of mouse click, perhaps?),
the index we want to use is the car of the list, which
ought to be a symbol. */
- if (XTYPE (idx) == Lisp_Cons)
- idx = XCONS (idx)->car;
+ if (EVENT_HAS_PARAMETERS (idx))
+ idx = EVENT_HEAD (idx);
if (XTYPE (idx) == Lisp_Int
&& (XINT (idx) < 0 || XINT (idx) >= DENSE_TABLE_SIZE))
@@ -295,8 +301,8 @@ store_in_keymap (keymap, idx, def)
/* If idx is a list (some sort of mouse click, perhaps?),
the index we want to use is the car of the list, which
ought to be a symbol. */
- if (XTYPE (idx) == Lisp_Cons)
- idx = Fcar (idx);
+ if (EVENT_HAS_PARAMETERS (idx))
+ idx = EVENT_HEAD (idx);
if (XTYPE (idx) == Lisp_Int
&& (XINT (idx) < 0 || XINT (idx) >= DENSE_TABLE_SIZE))
@@ -569,7 +575,8 @@ append_key (key_sequence, key)
/* Global, local, and minor mode keymap stuff. */
/* We can't put these variables inside current_minor_maps, since under
- DGUX they dump as pure. Bleah. */
+ some systems, static gets macro-defined to be the empty string.
+ Ickypoo. */
static Lisp_Object *cmm_modes, *cmm_maps;
static int cmm_size;
@@ -594,15 +601,15 @@ current_minor_maps (modeptr, mapptr)
Lisp_Object **modeptr, **mapptr;
{
int i = 0;
- Lisp_Object alist, assoc, var;
+ Lisp_Object alist, assoc, var, val;
for (alist = Vminor_mode_map_alist;
CONSP (alist);
alist = XCONS (alist)->cdr)
if (CONSP (assoc = XCONS (alist)->car)
&& XTYPE (var = XCONS (assoc)->car) == Lisp_Symbol
- && ! NILP (Fboundp (var))
- && ! NILP (Fsymbol_value (var)))
+ && ! EQ ((val = find_symbol_value (var)), Qunbound)
+ && ! NILP (val))
{
if (i >= cmm_size)
{
@@ -687,7 +694,9 @@ The binding is probably a symbol with a function definition.")
DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 1, 0,
"Return the binding for command KEYS in current global keymap only.\n\
KEYS is a string, a sequence of keystrokes.\n\
-The binding is probably a symbol with a function definition.")
+The binding is probably a symbol with a function definition.\n\
+This function's return values are the same as those of lookup-key\n\
+(which see).")
(keys)
Lisp_Object keys;
{
@@ -1089,6 +1098,9 @@ Control characters turn into C-whatever, etc.")
register unsigned char c;
char tem[6];
+ if (EVENT_HAS_PARAMETERS (key))
+ key = EVENT_HEAD (key);
+
switch (XTYPE (key))
{
case Lisp_Int: /* Normal character */
@@ -1099,13 +1111,6 @@ Control characters turn into C-whatever, etc.")
case Lisp_Symbol: /* Function key or event-symbol */
return Fsymbol_name (key);
- case Lisp_Cons: /* Mouse event */
- key = XCONS (key)->car;
- if (XTYPE (key) == Lisp_Symbol)
- return Fsymbol_name (key);
- /* Mouse events should have an identifying symbol as their car;
- fall through when this isn't the case. */
-
default:
error ("KEY must be an integer, cons, or symbol.");
}
@@ -1804,6 +1809,24 @@ If two active keymaps bind the same key, the keymap appearing earlier\n\
in the list takes precedence.");
Vminor_mode_map_alist = Qnil;
+ DEFVAR_LISP ("function-key-map", &Vfunction_key_map,
+ "Keymap mapping ASCII function key sequences onto their preferred forms.\n\
+This allows Emacs to recognize function keys sent from ASCII\n\
+terminals at any point in a key sequence.\n\
+\n\
+The read-key-sequence function replaces subsequences bound by\n\
+function-key-map with their bindings. When the current local and global\n\
+keymaps have no binding for the current key sequence but\n\
+function-key-map binds a suffix of the sequence to a vector,\n\
+read-key-sequence replaces the matching suffix with its binding, and\n\
+continues with the new sequence.\n\
+\n\
+For example, suppose function-key-map binds `ESC O P' to [pf1].\n\
+Typing `ESC O P' to read-key-sequence would return [pf1]. Typing\n\
+`C-x ESC O P' would return [?\C-x pf1]. If [pf1] were a prefix\n\
+key, typing `ESC O P x' would return [pf1 x].");
+ Vfunction_key_map = Fmake_sparse_keymap ();
+
Qsingle_key_description = intern ("single-key-description");
staticpro (&Qsingle_key_description);
diff --git a/src/xterm.c b/src/xterm.c
index dd07185ca2..0f8da85011 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1286,21 +1286,12 @@ enum window_type
text_window,
};
-/* Symbol returned in input stream to indicate mouse movement. */
-Lisp_Object Qmouse_moved;
-
/* Position of the mouse in characters */
unsigned int x_mouse_x, x_mouse_y;
-/* Emacs window the mouse is in, if any. */
-extern Lisp_Object Vmouse_window;
-
/* Offset in buffer of character under the pointer, or 0. */
extern int mouse_buffer_offset;
-/* Part of the screen the mouse is in. */
-extern Lisp_Object Vmouse_screen_part;
-
extern int buffer_posn_from_coords ();
/* Symbols from xfns.c to denote the different parts of a window. */
@@ -1701,10 +1692,6 @@ static char *events[] =
#define XEvent XKeyPressedEvent
#endif /* HAVE_X11 */
-/* Symbols returned in the input stream to indicate various X events. */
-Lisp_Object Qmouse_click;
-Lisp_Object Qscrollbar_click;
-
/* Timestamp of enter window event. This is only used by XTread_socket,
but we have to put it out here, since static variables within functions
sometimes don't work. */
@@ -1888,7 +1875,6 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
disabled; you don't want to spend time updating a
display that won't ever be seen. */
s->visible = 0;
- Vmouse_window = Vmouse_screen_part = Qnil;
x_mouse_x = x_mouse_y = -1;
}
}
@@ -3323,7 +3309,6 @@ x_make_screen_visible (s)
#endif /* not HAVE_X11 */
}
- XRaiseWindow (XDISPLAY s->display.x->window_desc);
XFlushQueue ();
UNBLOCK_INPUT;
@@ -3761,10 +3746,6 @@ syms_of_xterm ()
{
staticpro (&invocation_name);
invocation_name = Qnil;
-
- Qmouse_moved = intern ("mouse-moved");
- Qmouse_click = intern ("mouse-click");
- Qscrollbar_click = intern ("scrollbar-click");
}
#endif /* HAVE_X11 */
#endif /* HAVE_X_WINDOWS */