Commit f2a00342 authored by Roland McGrath's avatar Roland McGrath
Browse files

(term_get_fkeys_data): Variable removed.

(term_get_fkeys_define_1, term_get_fkeys_define): Functions removed.
(term_get_fkeys_address): New variable, to pass arg through condition-case.
(term_get_fkeys): Set that to ADDRESS; just do condition-case around call to
term_get_fkeys_1, ignoring all errors.
(term_get_fkeys_1): New function, containing body of term_get_fkeys.
Don't use term_get_fkeys_define_1; call Fdefine_key directly.
parent 89bca612
/* terminal control module for terminals described by TERMCAP
Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc.
Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc.
This file is part of GNU Emacs.
......@@ -1229,29 +1229,8 @@ static struct fkey_table keys[] = {
"k9", "f9",
};
/* These subroutines are used to call
Fdefine_key inside of a condition-case. */
static Lisp_Object term_get_fkeys_data;
extern Lisp_Object cmd_error ();
static Lisp_Object
term_get_fkeys_define_1 ()
{
Fdefine_key (Vfunction_key_map, Fcar (term_get_fkeys_data),
Fcdr (term_get_fkeys_data));
return Qnil;
}
/* Define KEY as DEFINITION in function-key-map, catching errors. */
static void
term_get_fkeys_define (key, definition)
Lisp_Object key, definition;
{
term_get_fkeys_data = Fcons (key, definition);
internal_condition_case (term_get_fkeys_define_1, Qerror, cmd_error);
}
static char **term_get_fkeys_arg;
static Lisp_Object term_get_fkeys_1 ();
/* Find the escape codes sent by the function keys for Vfunction_key_map.
This function scans the termcap function key sequence entries, and
......@@ -1260,6 +1239,23 @@ term_get_fkeys_define (key, definition)
void
term_get_fkeys (address)
char **address;
{
/* 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
when given a key sequence containing an invalid prefix key. If the
termcap defines function keys which use a prefix that is already bound
to a command by the default bindings, we should silently ignore that
function key specification, rather than giving the user an error and
refusing to run at all on such a terminal. */
extern Lisp_Object Fidentity ();
static Lisp_Object term_get_fkeys_1 ();
term_get_fkeys_arg = address;
internal_condition_case (term_get_fkeys_1, Qerror, Fidentity);
}
static Lisp_Object
term_get_fkeys_1 ()
{
extern char *tgetstr ();
int i;
......@@ -1272,9 +1268,9 @@ term_get_fkeys (address)
{
char *sequence = tgetstr (keys[i].cap, address);
if (sequence)
term_get_fkeys_define (build_string (sequence),
Fmake_vector (make_number (1),
intern (keys[i].name)));
Fdefine_key (Vfunction_key_map, build_string (sequence),
Fmake_vector (make_number (1),
intern (keys[i].name)));
}
/* The uses of the "k0" capability are inconsistent; sometimes it
......@@ -1289,14 +1285,14 @@ term_get_fkeys (address)
if (k_semi)
{
term_get_fkeys_define (build_string (k_semi),
Fmake_vector (make_number (1), intern ("f10")));
Fdefine_key (Vfunction_key_map, build_string (k_semi),
Fmake_vector (make_number (1), intern ("f10")));
k0_name = "f0";
}
if (k0)
term_get_fkeys_define (build_string (k0),
Fmake_vector (make_number (1), intern (k0_name)));
Fdefine_key (Vfunction_key_map, build_string (k0),
Fmake_vector (make_number (1), intern (k0_name)));
}
/* Set up cookies for numbered function keys above f10. */
......@@ -1318,9 +1314,9 @@ term_get_fkeys (address)
if (sequence)
{
sprintf (fkey, "f%d", i);
term_get_fkeys_define (build_string (sequence),
Fmake_vector (make_number (1),
intern (fkey)));
Fdefine_key (Vfunction_key_map, build_string (sequence),
Fmake_vector (make_number (1),
intern (fkey)));
}
}
}
......@@ -1335,9 +1331,9 @@ term_get_fkeys (address)
{ \
char *sequence = tgetstr (cap2, address); \
if (sequence) \
term_get_fkeys_define (build_string (sequence), \
Fmake_vector (make_number (1), \
intern (sym))); \
Fdefine_key (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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment