aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 ec45512837b..5fde6b20a74 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -24,6 +24,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
24#include "lisp.h" 24#include "lisp.h"
25#include "commands.h" 25#include "commands.h"
26#include "buffer.h" 26#include "buffer.h"
27#include "keyboard.h"
27 28
28#define min(a, b) ((a) < (b) ? (a) : (b)) 29#define min(a, b) ((a) < (b) ? (a) : (b))
29 30
@@ -67,6 +68,11 @@ Lisp_Object Vminibuffer_local_must_match_map;
67/* Alist of minor mode variables and keymaps. */ 68/* Alist of minor mode variables and keymaps. */
68Lisp_Object Vminor_mode_map_alist; 69Lisp_Object Vminor_mode_map_alist;
69 70
71/* Keymap mapping ASCII function key sequences onto their preferred forms.
72 Initialized by the terminal-specific lisp files. See DEFVAR for more
73 documentation. */
74Lisp_Object Vfunction_key_map;
75
70Lisp_Object Qkeymapp, Qkeymap; 76Lisp_Object Qkeymapp, Qkeymap;
71 77
72/* A char over 0200 in a key sequence 78/* A char over 0200 in a key sequence
@@ -220,8 +226,8 @@ access_keymap (map, idx)
220 /* If idx is a list (some sort of mouse click, perhaps?), 226 /* If idx is a list (some sort of mouse click, perhaps?),
221 the index we want to use is the car of the list, which 227 the index we want to use is the car of the list, which
222 ought to be a symbol. */ 228 ought to be a symbol. */
223 if (XTYPE (idx) == Lisp_Cons) 229 if (EVENT_HAS_PARAMETERS (idx))
224 idx = XCONS (idx)->car; 230 idx = EVENT_HEAD (idx);
225 231
226 if (XTYPE (idx) == Lisp_Int 232 if (XTYPE (idx) == Lisp_Int
227 && (XINT (idx) < 0 || XINT (idx) >= DENSE_TABLE_SIZE)) 233 && (XINT (idx) < 0 || XINT (idx) >= DENSE_TABLE_SIZE))
@@ -295,8 +301,8 @@ store_in_keymap (keymap, idx, def)
295 /* If idx is a list (some sort of mouse click, perhaps?), 301 /* If idx is a list (some sort of mouse click, perhaps?),
296 the index we want to use is the car of the list, which 302 the index we want to use is the car of the list, which
297 ought to be a symbol. */ 303 ought to be a symbol. */
298 if (XTYPE (idx) == Lisp_Cons) 304 if (EVENT_HAS_PARAMETERS (idx))
299 idx = Fcar (idx); 305 idx = EVENT_HEAD (idx);
300 306
301 if (XTYPE (idx) == Lisp_Int 307 if (XTYPE (idx) == Lisp_Int
302 && (XINT (idx) < 0 || XINT (idx) >= DENSE_TABLE_SIZE)) 308 && (XINT (idx) < 0 || XINT (idx) >= DENSE_TABLE_SIZE))
@@ -569,7 +575,8 @@ append_key (key_sequence, key)
569/* Global, local, and minor mode keymap stuff. */ 575/* Global, local, and minor mode keymap stuff. */
570 576
571/* We can't put these variables inside current_minor_maps, since under 577/* We can't put these variables inside current_minor_maps, since under
572 DGUX they dump as pure. Bleah. */ 578 some systems, static gets macro-defined to be the empty string.
579 Ickypoo. */
573static Lisp_Object *cmm_modes, *cmm_maps; 580static Lisp_Object *cmm_modes, *cmm_maps;
574static int cmm_size; 581static int cmm_size;
575 582
@@ -594,15 +601,15 @@ current_minor_maps (modeptr, mapptr)
594 Lisp_Object **modeptr, **mapptr; 601 Lisp_Object **modeptr, **mapptr;
595{ 602{
596 int i = 0; 603 int i = 0;
597 Lisp_Object alist, assoc, var; 604 Lisp_Object alist, assoc, var, val;
598 605
599 for (alist = Vminor_mode_map_alist; 606 for (alist = Vminor_mode_map_alist;
600 CONSP (alist); 607 CONSP (alist);
601 alist = XCONS (alist)->cdr) 608 alist = XCONS (alist)->cdr)
602 if (CONSP (assoc = XCONS (alist)->car) 609 if (CONSP (assoc = XCONS (alist)->car)
603 && XTYPE (var = XCONS (assoc)->car) == Lisp_Symbol 610 && XTYPE (var = XCONS (assoc)->car) == Lisp_Symbol
604 && ! NILP (Fboundp (var)) 611 && ! EQ ((val = find_symbol_value (var)), Qunbound)
605 && ! NILP (Fsymbol_value (var))) 612 && ! NILP (val))
606 { 613 {
607 if (i >= cmm_size) 614 if (i >= cmm_size)
608 { 615 {
@@ -687,7 +694,9 @@ The binding is probably a symbol with a function definition.")
687DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 1, 0, 694DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 1, 0,
688 "Return the binding for command KEYS in current global keymap only.\n\ 695 "Return the binding for command KEYS in current global keymap only.\n\
689KEYS is a string, a sequence of keystrokes.\n\ 696KEYS is a string, a sequence of keystrokes.\n\
690The binding is probably a symbol with a function definition.") 697The binding is probably a symbol with a function definition.\n\
698This function's return values are the same as those of lookup-key\n\
699(which see).")
691 (keys) 700 (keys)
692 Lisp_Object keys; 701 Lisp_Object keys;
693{ 702{
@@ -1089,6 +1098,9 @@ Control characters turn into C-whatever, etc.")
1089 register unsigned char c; 1098 register unsigned char c;
1090 char tem[6]; 1099 char tem[6];
1091 1100
1101 if (EVENT_HAS_PARAMETERS (key))
1102 key = EVENT_HEAD (key);
1103
1092 switch (XTYPE (key)) 1104 switch (XTYPE (key))
1093 { 1105 {
1094 case Lisp_Int: /* Normal character */ 1106 case Lisp_Int: /* Normal character */
@@ -1099,13 +1111,6 @@ Control characters turn into C-whatever, etc.")
1099 case Lisp_Symbol: /* Function key or event-symbol */ 1111 case Lisp_Symbol: /* Function key or event-symbol */
1100 return Fsymbol_name (key); 1112 return Fsymbol_name (key);
1101 1113
1102 case Lisp_Cons: /* Mouse event */
1103 key = XCONS (key)->car;
1104 if (XTYPE (key) == Lisp_Symbol)
1105 return Fsymbol_name (key);
1106 /* Mouse events should have an identifying symbol as their car;
1107 fall through when this isn't the case. */
1108
1109 default: 1114 default:
1110 error ("KEY must be an integer, cons, or symbol."); 1115 error ("KEY must be an integer, cons, or symbol.");
1111 } 1116 }
@@ -1804,6 +1809,24 @@ If two active keymaps bind the same key, the keymap appearing earlier\n\
1804in the list takes precedence."); 1809in the list takes precedence.");
1805 Vminor_mode_map_alist = Qnil; 1810 Vminor_mode_map_alist = Qnil;
1806 1811
1812 DEFVAR_LISP ("function-key-map", &Vfunction_key_map,
1813 "Keymap mapping ASCII function key sequences onto their preferred forms.\n\
1814This allows Emacs to recognize function keys sent from ASCII\n\
1815terminals at any point in a key sequence.\n\
1816\n\
1817The read-key-sequence function replaces subsequences bound by\n\
1818function-key-map with their bindings. When the current local and global\n\
1819keymaps have no binding for the current key sequence but\n\
1820function-key-map binds a suffix of the sequence to a vector,\n\
1821read-key-sequence replaces the matching suffix with its binding, and\n\
1822continues with the new sequence.\n\
1823\n\
1824For example, suppose function-key-map binds `ESC O P' to [pf1].\n\
1825Typing `ESC O P' to read-key-sequence would return [pf1]. Typing\n\
1826`C-x ESC O P' would return [?\C-x pf1]. If [pf1] were a prefix\n\
1827key, typing `ESC O P x' would return [pf1 x].");
1828 Vfunction_key_map = Fmake_sparse_keymap ();
1829
1807 Qsingle_key_description = intern ("single-key-description"); 1830 Qsingle_key_description = intern ("single-key-description");
1808 staticpro (&Qsingle_key_description); 1831 staticpro (&Qsingle_key_description);
1809 1832
diff --git a/src/xterm.c b/src/xterm.c
index dd07185ca23..0f8da850112 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1286,21 +1286,12 @@ enum window_type
1286 text_window, 1286 text_window,
1287}; 1287};
1288 1288
1289/* Symbol returned in input stream to indicate mouse movement. */
1290Lisp_Object Qmouse_moved;
1291
1292/* Position of the mouse in characters */ 1289/* Position of the mouse in characters */
1293unsigned int x_mouse_x, x_mouse_y; 1290unsigned int x_mouse_x, x_mouse_y;
1294 1291
1295/* Emacs window the mouse is in, if any. */
1296extern Lisp_Object Vmouse_window;
1297
1298/* Offset in buffer of character under the pointer, or 0. */ 1292/* Offset in buffer of character under the pointer, or 0. */
1299extern int mouse_buffer_offset; 1293extern int mouse_buffer_offset;
1300 1294
1301/* Part of the screen the mouse is in. */
1302extern Lisp_Object Vmouse_screen_part;
1303
1304extern int buffer_posn_from_coords (); 1295extern int buffer_posn_from_coords ();
1305 1296
1306/* Symbols from xfns.c to denote the different parts of a window. */ 1297/* Symbols from xfns.c to denote the different parts of a window. */
@@ -1701,10 +1692,6 @@ static char *events[] =
1701#define XEvent XKeyPressedEvent 1692#define XEvent XKeyPressedEvent
1702#endif /* HAVE_X11 */ 1693#endif /* HAVE_X11 */
1703 1694
1704/* Symbols returned in the input stream to indicate various X events. */
1705Lisp_Object Qmouse_click;
1706Lisp_Object Qscrollbar_click;
1707
1708/* Timestamp of enter window event. This is only used by XTread_socket, 1695/* Timestamp of enter window event. This is only used by XTread_socket,
1709 but we have to put it out here, since static variables within functions 1696 but we have to put it out here, since static variables within functions
1710 sometimes don't work. */ 1697 sometimes don't work. */
@@ -1888,7 +1875,6 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
1888 disabled; you don't want to spend time updating a 1875 disabled; you don't want to spend time updating a
1889 display that won't ever be seen. */ 1876 display that won't ever be seen. */
1890 s->visible = 0; 1877 s->visible = 0;
1891 Vmouse_window = Vmouse_screen_part = Qnil;
1892 x_mouse_x = x_mouse_y = -1; 1878 x_mouse_x = x_mouse_y = -1;
1893 } 1879 }
1894 } 1880 }
@@ -3323,7 +3309,6 @@ x_make_screen_visible (s)
3323#endif /* not HAVE_X11 */ 3309#endif /* not HAVE_X11 */
3324 } 3310 }
3325 3311
3326 XRaiseWindow (XDISPLAY s->display.x->window_desc);
3327 XFlushQueue (); 3312 XFlushQueue ();
3328 3313
3329 UNBLOCK_INPUT; 3314 UNBLOCK_INPUT;
@@ -3761,10 +3746,6 @@ syms_of_xterm ()
3761{ 3746{
3762 staticpro (&invocation_name); 3747 staticpro (&invocation_name);
3763 invocation_name = Qnil; 3748 invocation_name = Qnil;
3764
3765 Qmouse_moved = intern ("mouse-moved");
3766 Qmouse_click = intern ("mouse-click");
3767 Qscrollbar_click = intern ("scrollbar-click");
3768} 3749}
3769#endif /* HAVE_X11 */ 3750#endif /* HAVE_X11 */
3770#endif /* HAVE_X_WINDOWS */ 3751#endif /* HAVE_X_WINDOWS */