Mercurial > emacs
comparison src/term.c @ 85106:fd282fb888de
Add new `input-decode-map' keymap and use it for temrinal
escape sequences.
* keyboard.h (struct kboard): Add Vinput_decode_map.
Remove Vlocal_key_translation_map.
* keyboard.c (read_key_sequence): Add support for input-decode-map.
(init_kboard): Init input-decode-map.
Replace local-key-translation-map back with key-translation-map.
(syms_of_keyboard): Declare input-decode-map.
Remove local-key-translation-map. Update docstrings.
(mark_kboards): Mark Vinput_decode_map.
Don't mark Vlocal_key_translation_map.
* keymap.c (Fdescribe_buffer_bindings): Describe input-decode-map.
Replace local-key-translation-map back with key-translation-map.
* term.c (term_get_fkeys_1, CONDITIONAL_REASSIGN):
Bind in input-decode-map rather than function-key-map.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 09 Oct 2007 05:05:39 +0000 |
parents | a35153116cd0 |
children | 9f3a25157e4f bdb3fe0ba9fa |
comparison
equal
deleted
inserted
replaced
85105:ba4f1a829f83 | 85106:fd282fb888de |
---|---|
1272 | 1272 |
1273 static char **term_get_fkeys_address; | 1273 static char **term_get_fkeys_address; |
1274 static KBOARD *term_get_fkeys_kboard; | 1274 static KBOARD *term_get_fkeys_kboard; |
1275 static Lisp_Object term_get_fkeys_1 (); | 1275 static Lisp_Object term_get_fkeys_1 (); |
1276 | 1276 |
1277 /* Find the escape codes sent by the function keys for Vfunction_key_map. | 1277 /* Find the escape codes sent by the function keys for Vinput_decode_map. |
1278 This function scans the termcap function key sequence entries, and | 1278 This function scans the termcap function key sequence entries, and |
1279 adds entries to Vfunction_key_map for each function key it finds. */ | 1279 adds entries to Vinput_decode_map for each function key it finds. */ |
1280 | 1280 |
1281 static void | 1281 static void |
1282 term_get_fkeys (address, kboard) | 1282 term_get_fkeys (address, kboard) |
1283 char **address; | 1283 char **address; |
1284 KBOARD *kboard; | 1284 KBOARD *kboard; |
1304 | 1304 |
1305 char **address = term_get_fkeys_address; | 1305 char **address = term_get_fkeys_address; |
1306 KBOARD *kboard = term_get_fkeys_kboard; | 1306 KBOARD *kboard = term_get_fkeys_kboard; |
1307 | 1307 |
1308 /* This can happen if CANNOT_DUMP or with strange options. */ | 1308 /* This can happen if CANNOT_DUMP or with strange options. */ |
1309 if (!initialized) | 1309 if (!KEYMAPP (kboard->Vinput_decode_map)) |
1310 kboard->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil); | 1310 kboard->Vinput_decode_map = Fmake_sparse_keymap (Qnil); |
1311 | 1311 |
1312 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) | 1312 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) |
1313 { | 1313 { |
1314 char *sequence = tgetstr (keys[i].cap, address); | 1314 char *sequence = tgetstr (keys[i].cap, address); |
1315 if (sequence) | 1315 if (sequence) |
1316 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence), | 1316 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), |
1317 Fmake_vector (make_number (1), | 1317 Fmake_vector (make_number (1), |
1318 intern (keys[i].name))); | 1318 intern (keys[i].name))); |
1319 } | 1319 } |
1320 | 1320 |
1321 /* The uses of the "k0" capability are inconsistent; sometimes it | 1321 /* The uses of the "k0" capability are inconsistent; sometimes it |
1331 if (k_semi) | 1331 if (k_semi) |
1332 { | 1332 { |
1333 if (k0) | 1333 if (k0) |
1334 /* Define f0 first, so that f10 takes precedence in case the | 1334 /* Define f0 first, so that f10 takes precedence in case the |
1335 key sequences happens to be the same. */ | 1335 key sequences happens to be the same. */ |
1336 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0), | 1336 Fdefine_key (kboard->Vinput_decode_map, build_string (k0), |
1337 Fmake_vector (make_number (1), intern ("f0"))); | 1337 Fmake_vector (make_number (1), intern ("f0"))); |
1338 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k_semi), | 1338 Fdefine_key (kboard->Vinput_decode_map, build_string (k_semi), |
1339 Fmake_vector (make_number (1), intern ("f10"))); | 1339 Fmake_vector (make_number (1), intern ("f10"))); |
1340 } | 1340 } |
1341 else if (k0) | 1341 else if (k0) |
1342 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0), | 1342 Fdefine_key (kboard->Vinput_decode_map, build_string (k0), |
1343 Fmake_vector (make_number (1), intern (k0_name))); | 1343 Fmake_vector (make_number (1), intern (k0_name))); |
1344 } | 1344 } |
1345 | 1345 |
1346 /* Set up cookies for numbered function keys above f10. */ | 1346 /* Set up cookies for numbered function keys above f10. */ |
1347 { | 1347 { |
1360 { | 1360 { |
1361 char *sequence = tgetstr (fcap, address); | 1361 char *sequence = tgetstr (fcap, address); |
1362 if (sequence) | 1362 if (sequence) |
1363 { | 1363 { |
1364 sprintf (fkey, "f%d", i); | 1364 sprintf (fkey, "f%d", i); |
1365 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence), | 1365 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), |
1366 Fmake_vector (make_number (1), | 1366 Fmake_vector (make_number (1), |
1367 intern (fkey))); | 1367 intern (fkey))); |
1368 } | 1368 } |
1369 } | 1369 } |
1370 } | 1370 } |
1377 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \ | 1377 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \ |
1378 if (!tgetstr (cap1, address)) \ | 1378 if (!tgetstr (cap1, address)) \ |
1379 { \ | 1379 { \ |
1380 char *sequence = tgetstr (cap2, address); \ | 1380 char *sequence = tgetstr (cap2, address); \ |
1381 if (sequence) \ | 1381 if (sequence) \ |
1382 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence), \ | 1382 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), \ |
1383 Fmake_vector (make_number (1), \ | 1383 Fmake_vector (make_number (1), \ |
1384 intern (sym))); \ | 1384 intern (sym))); \ |
1385 } | 1385 } |
1386 | 1386 |
1387 /* if there's no key_next keycap, map key_npage to `next' keysym */ | 1387 /* if there's no key_next keycap, map key_npage to `next' keysym */ |