diff options
| author | Karoly Lorentey | 2005-06-26 03:20:47 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-06-26 03:20:47 +0000 |
| commit | e7cf0fa0edcc9e39c3b192930b7d128ebc6ad6db (patch) | |
| tree | b513384037d338efa488ccbf90842ae5bcb91367 /src | |
| parent | 2bb819d593a8cbf989a84c5346ba9386b89f6960 (diff) | |
| download | emacs-e7cf0fa0edcc9e39c3b192930b7d128ebc6ad6db.tar.gz emacs-e7cf0fa0edcc9e39c3b192930b7d128ebc6ad6db.zip | |
Make sure the terminfo function key sequences are set up in the correct function-key-map.
* src/term.c (term_init): Make sure the function keys are set up in the
correct function-key-map.
(term_get_fkeys_arg): Rename to term_get_fkeys_address.
(term_get_fkeys_kboard): New variable.
(term_get_fkeys): Use it.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-357
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/src/term.c b/src/term.c index 51d191a3bfc..55d1741873c 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1311,7 +1311,8 @@ static struct fkey_table keys[] = | |||
| 1311 | {"!3", "S-undo"} /*shifted undo key*/ | 1311 | {"!3", "S-undo"} /*shifted undo key*/ |
| 1312 | }; | 1312 | }; |
| 1313 | 1313 | ||
| 1314 | static char **term_get_fkeys_arg; | 1314 | static char **term_get_fkeys_address; |
| 1315 | static KBOARD *term_get_fkeys_kboard; | ||
| 1315 | static Lisp_Object term_get_fkeys_1 (); | 1316 | static Lisp_Object term_get_fkeys_1 (); |
| 1316 | 1317 | ||
| 1317 | /* Find the escape codes sent by the function keys for Vfunction_key_map. | 1318 | /* Find the escape codes sent by the function keys for Vfunction_key_map. |
| @@ -1319,8 +1320,9 @@ static Lisp_Object term_get_fkeys_1 (); | |||
| 1319 | adds entries to Vfunction_key_map for each function key it finds. */ | 1320 | adds entries to Vfunction_key_map for each function key it finds. */ |
| 1320 | 1321 | ||
| 1321 | void | 1322 | void |
| 1322 | term_get_fkeys (address) | 1323 | term_get_fkeys (address, kboard) |
| 1323 | char **address; | 1324 | char **address; |
| 1325 | KBOARD *kboard; | ||
| 1324 | { | 1326 | { |
| 1325 | /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp | 1327 | /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp |
| 1326 | errors during the call. The only errors should be from Fdefine_key | 1328 | errors during the call. The only errors should be from Fdefine_key |
| @@ -1331,7 +1333,8 @@ term_get_fkeys (address) | |||
| 1331 | refusing to run at all on such a terminal. */ | 1333 | refusing to run at all on such a terminal. */ |
| 1332 | 1334 | ||
| 1333 | extern Lisp_Object Fidentity (); | 1335 | extern Lisp_Object Fidentity (); |
| 1334 | term_get_fkeys_arg = address; | 1336 | term_get_fkeys_address = address; |
| 1337 | term_get_fkeys_kboard = kboard; | ||
| 1335 | internal_condition_case (term_get_fkeys_1, Qerror, Fidentity); | 1338 | internal_condition_case (term_get_fkeys_1, Qerror, Fidentity); |
| 1336 | } | 1339 | } |
| 1337 | 1340 | ||
| @@ -1340,17 +1343,18 @@ term_get_fkeys_1 () | |||
| 1340 | { | 1343 | { |
| 1341 | int i; | 1344 | int i; |
| 1342 | 1345 | ||
| 1343 | char **address = term_get_fkeys_arg; | 1346 | char **address = term_get_fkeys_address; |
| 1344 | 1347 | KBOARD *kboard = term_get_fkeys_kboard; | |
| 1348 | |||
| 1345 | /* This can happen if CANNOT_DUMP or with strange options. */ | 1349 | /* This can happen if CANNOT_DUMP or with strange options. */ |
| 1346 | if (!initialized) | 1350 | if (!initialized) |
| 1347 | current_kboard->Vfunction_key_map = Fmake_sparse_keymap (Qnil); | 1351 | kboard->Vfunction_key_map = Fmake_sparse_keymap (Qnil); |
| 1348 | 1352 | ||
| 1349 | for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) | 1353 | for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) |
| 1350 | { | 1354 | { |
| 1351 | char *sequence = tgetstr (keys[i].cap, address); | 1355 | char *sequence = tgetstr (keys[i].cap, address); |
| 1352 | if (sequence) | 1356 | if (sequence) |
| 1353 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), | 1357 | Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), |
| 1354 | Fmake_vector (make_number (1), | 1358 | Fmake_vector (make_number (1), |
| 1355 | intern (keys[i].name))); | 1359 | intern (keys[i].name))); |
| 1356 | } | 1360 | } |
| @@ -1370,13 +1374,13 @@ term_get_fkeys_1 () | |||
| 1370 | if (k0) | 1374 | if (k0) |
| 1371 | /* Define f0 first, so that f10 takes precedence in case the | 1375 | /* Define f0 first, so that f10 takes precedence in case the |
| 1372 | key sequences happens to be the same. */ | 1376 | key sequences happens to be the same. */ |
| 1373 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (k0), | 1377 | Fdefine_key (kboard->Vfunction_key_map, build_string (k0), |
| 1374 | Fmake_vector (make_number (1), intern ("f0"))); | 1378 | Fmake_vector (make_number (1), intern ("f0"))); |
| 1375 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (k_semi), | 1379 | Fdefine_key (kboard->Vfunction_key_map, build_string (k_semi), |
| 1376 | Fmake_vector (make_number (1), intern ("f10"))); | 1380 | Fmake_vector (make_number (1), intern ("f10"))); |
| 1377 | } | 1381 | } |
| 1378 | else if (k0) | 1382 | else if (k0) |
| 1379 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (k0), | 1383 | Fdefine_key (kboard->Vfunction_key_map, build_string (k0), |
| 1380 | Fmake_vector (make_number (1), intern (k0_name))); | 1384 | Fmake_vector (make_number (1), intern (k0_name))); |
| 1381 | } | 1385 | } |
| 1382 | 1386 | ||
| @@ -1399,7 +1403,7 @@ term_get_fkeys_1 () | |||
| 1399 | if (sequence) | 1403 | if (sequence) |
| 1400 | { | 1404 | { |
| 1401 | sprintf (fkey, "f%d", i); | 1405 | sprintf (fkey, "f%d", i); |
| 1402 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), | 1406 | Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), |
| 1403 | Fmake_vector (make_number (1), | 1407 | Fmake_vector (make_number (1), |
| 1404 | intern (fkey))); | 1408 | intern (fkey))); |
| 1405 | } | 1409 | } |
| @@ -1415,10 +1419,10 @@ term_get_fkeys_1 () | |||
| 1415 | if (!tgetstr (cap1, address)) \ | 1419 | if (!tgetstr (cap1, address)) \ |
| 1416 | { \ | 1420 | { \ |
| 1417 | char *sequence = tgetstr (cap2, address); \ | 1421 | char *sequence = tgetstr (cap2, address); \ |
| 1418 | if (sequence) \ | 1422 | if (sequence) \ |
| 1419 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), \ | 1423 | Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), \ |
| 1420 | Fmake_vector (make_number (1), \ | 1424 | Fmake_vector (make_number (1), \ |
| 1421 | intern (sym))); \ | 1425 | intern (sym))); \ |
| 1422 | } | 1426 | } |
| 1423 | 1427 | ||
| 1424 | /* if there's no key_next keycap, map key_npage to `next' keysym */ | 1428 | /* if there's no key_next keycap, map key_npage to `next' keysym */ |
| @@ -2446,7 +2450,7 @@ term_init (char *name, char *terminal_type, int must_succeed) | |||
| 2446 | delete_tty (display); | 2450 | delete_tty (display); |
| 2447 | error ("Could not open file: %s", name); | 2451 | error ("Could not open file: %s", name); |
| 2448 | } | 2452 | } |
| 2449 | if (! isatty (fd)) | 2453 | if (!isatty (fd)) |
| 2450 | { | 2454 | { |
| 2451 | close (fd); | 2455 | close (fd); |
| 2452 | error ("Not a tty device: %s", name); | 2456 | error ("Not a tty device: %s", name); |
| @@ -2677,7 +2681,20 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2677 | tty->TF_underscore = tgetflag ("ul"); | 2681 | tty->TF_underscore = tgetflag ("ul"); |
| 2678 | tty->TF_teleray = tgetflag ("xt"); | 2682 | tty->TF_teleray = tgetflag ("xt"); |
| 2679 | 2683 | ||
| 2680 | term_get_fkeys (address); | 2684 | #ifdef MULTI_KBOARD |
| 2685 | tty->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); | ||
| 2686 | init_kboard (tty->kboard); | ||
| 2687 | tty->kboard->next_kboard = all_kboards; | ||
| 2688 | all_kboards = tty->kboard; | ||
| 2689 | /* Don't let the initial kboard remain current longer than necessary. | ||
| 2690 | That would cause problems if a file loaded on startup tries to | ||
| 2691 | prompt in the mini-buffer. */ | ||
| 2692 | if (current_kboard == initial_kboard) | ||
| 2693 | current_kboard = tty->kboard; | ||
| 2694 | tty->kboard->reference_count++; | ||
| 2695 | #endif | ||
| 2696 | |||
| 2697 | term_get_fkeys (address, tty->kboard); | ||
| 2681 | 2698 | ||
| 2682 | /* Get frame size from system, or else from termcap. */ | 2699 | /* Get frame size from system, or else from termcap. */ |
| 2683 | { | 2700 | { |
| @@ -2895,19 +2912,6 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2895 | display->char_ins_del_ok = 0; | 2912 | display->char_ins_del_ok = 0; |
| 2896 | #endif | 2913 | #endif |
| 2897 | 2914 | ||
| 2898 | #ifdef MULTI_KBOARD | ||
| 2899 | tty->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); | ||
| 2900 | init_kboard (tty->kboard); | ||
| 2901 | tty->kboard->next_kboard = all_kboards; | ||
| 2902 | all_kboards = tty->kboard; | ||
| 2903 | /* Don't let the initial kboard remain current longer than necessary. | ||
| 2904 | That would cause problems if a file loaded on startup tries to | ||
| 2905 | prompt in the mini-buffer. */ | ||
| 2906 | if (current_kboard == initial_kboard) | ||
| 2907 | current_kboard = tty->kboard; | ||
| 2908 | tty->kboard->reference_count++; | ||
| 2909 | #endif | ||
| 2910 | |||
| 2911 | /* Don't do this. I think termcap may still need the buffer. */ | 2915 | /* Don't do this. I think termcap may still need the buffer. */ |
| 2912 | /* xfree (buffer); */ | 2916 | /* xfree (buffer); */ |
| 2913 | 2917 | ||