Mercurial > emacs
changeset 83317:e235da12dd03
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
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 26 Jun 2005 03:20:47 +0000 |
parents | 102194c6d773 |
children | 666b48e39a5a |
files | src/term.c |
diffstat | 1 files changed, 34 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/term.c Sun Jun 26 03:19:45 2005 +0000 +++ b/src/term.c Sun Jun 26 03:20:47 2005 +0000 @@ -1311,7 +1311,8 @@ {"!3", "S-undo"} /*shifted undo key*/ }; -static char **term_get_fkeys_arg; +static char **term_get_fkeys_address; +static KBOARD *term_get_fkeys_kboard; static Lisp_Object term_get_fkeys_1 (); /* Find the escape codes sent by the function keys for Vfunction_key_map. @@ -1319,8 +1320,9 @@ adds entries to Vfunction_key_map for each function key it finds. */ void -term_get_fkeys (address) +term_get_fkeys (address, kboard) char **address; + KBOARD *kboard; { /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp errors during the call. The only errors should be from Fdefine_key @@ -1331,7 +1333,8 @@ refusing to run at all on such a terminal. */ extern Lisp_Object Fidentity (); - term_get_fkeys_arg = address; + term_get_fkeys_address = address; + term_get_fkeys_kboard = kboard; internal_condition_case (term_get_fkeys_1, Qerror, Fidentity); } @@ -1340,17 +1343,18 @@ { int i; - char **address = term_get_fkeys_arg; - + char **address = term_get_fkeys_address; + KBOARD *kboard = term_get_fkeys_kboard; + /* This can happen if CANNOT_DUMP or with strange options. */ if (!initialized) - current_kboard->Vfunction_key_map = Fmake_sparse_keymap (Qnil); + kboard->Vfunction_key_map = Fmake_sparse_keymap (Qnil); for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) { char *sequence = tgetstr (keys[i].cap, address); if (sequence) - Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), + Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), Fmake_vector (make_number (1), intern (keys[i].name))); } @@ -1370,13 +1374,13 @@ if (k0) /* Define f0 first, so that f10 takes precedence in case the key sequences happens to be the same. */ - Fdefine_key (current_kboard->Vfunction_key_map, build_string (k0), + Fdefine_key (kboard->Vfunction_key_map, build_string (k0), Fmake_vector (make_number (1), intern ("f0"))); - Fdefine_key (current_kboard->Vfunction_key_map, build_string (k_semi), + Fdefine_key (kboard->Vfunction_key_map, build_string (k_semi), Fmake_vector (make_number (1), intern ("f10"))); } else if (k0) - Fdefine_key (current_kboard->Vfunction_key_map, build_string (k0), + Fdefine_key (kboard->Vfunction_key_map, build_string (k0), Fmake_vector (make_number (1), intern (k0_name))); } @@ -1399,7 +1403,7 @@ if (sequence) { sprintf (fkey, "f%d", i); - Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), + Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), Fmake_vector (make_number (1), intern (fkey))); } @@ -1415,10 +1419,10 @@ if (!tgetstr (cap1, address)) \ { \ char *sequence = tgetstr (cap2, address); \ - if (sequence) \ - Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), \ - Fmake_vector (make_number (1), \ - intern (sym))); \ + if (sequence) \ + Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), \ + Fmake_vector (make_number (1), \ + intern (sym))); \ } /* if there's no key_next keycap, map key_npage to `next' keysym */ @@ -2446,7 +2450,7 @@ delete_tty (display); error ("Could not open file: %s", name); } - if (! isatty (fd)) + if (!isatty (fd)) { close (fd); error ("Not a tty device: %s", name); @@ -2677,7 +2681,20 @@ tty->TF_underscore = tgetflag ("ul"); tty->TF_teleray = tgetflag ("xt"); - term_get_fkeys (address); +#ifdef MULTI_KBOARD + tty->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); + init_kboard (tty->kboard); + tty->kboard->next_kboard = all_kboards; + all_kboards = tty->kboard; + /* Don't let the initial kboard remain current longer than necessary. + That would cause problems if a file loaded on startup tries to + prompt in the mini-buffer. */ + if (current_kboard == initial_kboard) + current_kboard = tty->kboard; + tty->kboard->reference_count++; +#endif + + term_get_fkeys (address, tty->kboard); /* Get frame size from system, or else from termcap. */ { @@ -2895,19 +2912,6 @@ display->char_ins_del_ok = 0; #endif -#ifdef MULTI_KBOARD - tty->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); - init_kboard (tty->kboard); - tty->kboard->next_kboard = all_kboards; - all_kboards = tty->kboard; - /* Don't let the initial kboard remain current longer than necessary. - That would cause problems if a file loaded on startup tries to - prompt in the mini-buffer. */ - if (current_kboard == initial_kboard) - current_kboard = tty->kboard; - tty->kboard->reference_count++; -#endif - /* Don't do this. I think termcap may still need the buffer. */ /* xfree (buffer); */