diff options
| author | Roland McGrath | 1994-03-08 06:20:26 +0000 |
|---|---|---|
| committer | Roland McGrath | 1994-03-08 06:20:26 +0000 |
| commit | f2a003428d6cf16dbb0701b6998259cc15d0739e (patch) | |
| tree | 53527883266e8912fe2629d14fdf2ae540706943 /src | |
| parent | 89bca6129b086443bf60762a2b72b2ac32f815d9 (diff) | |
| download | emacs-f2a003428d6cf16dbb0701b6998259cc15d0739e.tar.gz emacs-f2a003428d6cf16dbb0701b6998259cc15d0739e.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 70 |
1 files changed, 33 insertions, 37 deletions
diff --git a/src/term.c b/src/term.c index fc3d0c7d913..c58de2cb827 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* terminal control module for terminals described by TERMCAP | 1 | /* terminal control module for terminals described by TERMCAP |
| 2 | Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc. | 2 | Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -1229,29 +1229,8 @@ static struct fkey_table keys[] = { | |||
| 1229 | "k9", "f9", | 1229 | "k9", "f9", |
| 1230 | }; | 1230 | }; |
| 1231 | 1231 | ||
| 1232 | /* These subroutines are used to call | 1232 | static char **term_get_fkeys_arg; |
| 1233 | Fdefine_key inside of a condition-case. */ | 1233 | static Lisp_Object term_get_fkeys_1 (); |
| 1234 | static Lisp_Object term_get_fkeys_data; | ||
| 1235 | |||
| 1236 | extern Lisp_Object cmd_error (); | ||
| 1237 | |||
| 1238 | static Lisp_Object | ||
| 1239 | term_get_fkeys_define_1 () | ||
| 1240 | { | ||
| 1241 | Fdefine_key (Vfunction_key_map, Fcar (term_get_fkeys_data), | ||
| 1242 | Fcdr (term_get_fkeys_data)); | ||
| 1243 | return Qnil; | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | /* Define KEY as DEFINITION in function-key-map, catching errors. */ | ||
| 1247 | |||
| 1248 | static void | ||
| 1249 | term_get_fkeys_define (key, definition) | ||
| 1250 | Lisp_Object key, definition; | ||
| 1251 | { | ||
| 1252 | term_get_fkeys_data = Fcons (key, definition); | ||
| 1253 | internal_condition_case (term_get_fkeys_define_1, Qerror, cmd_error); | ||
| 1254 | } | ||
| 1255 | 1234 | ||
| 1256 | /* Find the escape codes sent by the function keys for Vfunction_key_map. | 1235 | /* Find the escape codes sent by the function keys for Vfunction_key_map. |
| 1257 | This function scans the termcap function key sequence entries, and | 1236 | This function scans the termcap function key sequence entries, and |
| @@ -1261,6 +1240,23 @@ void | |||
| 1261 | term_get_fkeys (address) | 1240 | term_get_fkeys (address) |
| 1262 | char **address; | 1241 | char **address; |
| 1263 | { | 1242 | { |
| 1243 | /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp | ||
| 1244 | errors during the call. The only errors should be from Fdefine_key | ||
| 1245 | when given a key sequence containing an invalid prefix key. If the | ||
| 1246 | termcap defines function keys which use a prefix that is already bound | ||
| 1247 | to a command by the default bindings, we should silently ignore that | ||
| 1248 | function key specification, rather than giving the user an error and | ||
| 1249 | refusing to run at all on such a terminal. */ | ||
| 1250 | |||
| 1251 | extern Lisp_Object Fidentity (); | ||
| 1252 | static Lisp_Object term_get_fkeys_1 (); | ||
| 1253 | term_get_fkeys_arg = address; | ||
| 1254 | internal_condition_case (term_get_fkeys_1, Qerror, Fidentity); | ||
| 1255 | } | ||
| 1256 | |||
| 1257 | static Lisp_Object | ||
| 1258 | term_get_fkeys_1 () | ||
| 1259 | { | ||
| 1264 | extern char *tgetstr (); | 1260 | extern char *tgetstr (); |
| 1265 | int i; | 1261 | int i; |
| 1266 | 1262 | ||
| @@ -1272,9 +1268,9 @@ term_get_fkeys (address) | |||
| 1272 | { | 1268 | { |
| 1273 | char *sequence = tgetstr (keys[i].cap, address); | 1269 | char *sequence = tgetstr (keys[i].cap, address); |
| 1274 | if (sequence) | 1270 | if (sequence) |
| 1275 | term_get_fkeys_define (build_string (sequence), | 1271 | Fdefine_key (Vfunction_key_map, build_string (sequence), |
| 1276 | Fmake_vector (make_number (1), | 1272 | Fmake_vector (make_number (1), |
| 1277 | intern (keys[i].name))); | 1273 | intern (keys[i].name))); |
| 1278 | } | 1274 | } |
| 1279 | 1275 | ||
| 1280 | /* The uses of the "k0" capability are inconsistent; sometimes it | 1276 | /* The uses of the "k0" capability are inconsistent; sometimes it |
| @@ -1289,14 +1285,14 @@ term_get_fkeys (address) | |||
| 1289 | 1285 | ||
| 1290 | if (k_semi) | 1286 | if (k_semi) |
| 1291 | { | 1287 | { |
| 1292 | term_get_fkeys_define (build_string (k_semi), | 1288 | Fdefine_key (Vfunction_key_map, build_string (k_semi), |
| 1293 | Fmake_vector (make_number (1), intern ("f10"))); | 1289 | Fmake_vector (make_number (1), intern ("f10"))); |
| 1294 | k0_name = "f0"; | 1290 | k0_name = "f0"; |
| 1295 | } | 1291 | } |
| 1296 | 1292 | ||
| 1297 | if (k0) | 1293 | if (k0) |
| 1298 | term_get_fkeys_define (build_string (k0), | 1294 | Fdefine_key (Vfunction_key_map, build_string (k0), |
| 1299 | Fmake_vector (make_number (1), intern (k0_name))); | 1295 | Fmake_vector (make_number (1), intern (k0_name))); |
| 1300 | } | 1296 | } |
| 1301 | 1297 | ||
| 1302 | /* Set up cookies for numbered function keys above f10. */ | 1298 | /* Set up cookies for numbered function keys above f10. */ |
| @@ -1318,9 +1314,9 @@ term_get_fkeys (address) | |||
| 1318 | if (sequence) | 1314 | if (sequence) |
| 1319 | { | 1315 | { |
| 1320 | sprintf (fkey, "f%d", i); | 1316 | sprintf (fkey, "f%d", i); |
| 1321 | term_get_fkeys_define (build_string (sequence), | 1317 | Fdefine_key (Vfunction_key_map, build_string (sequence), |
| 1322 | Fmake_vector (make_number (1), | 1318 | Fmake_vector (make_number (1), |
| 1323 | intern (fkey))); | 1319 | intern (fkey))); |
| 1324 | } | 1320 | } |
| 1325 | } | 1321 | } |
| 1326 | } | 1322 | } |
| @@ -1335,9 +1331,9 @@ term_get_fkeys (address) | |||
| 1335 | { \ | 1331 | { \ |
| 1336 | char *sequence = tgetstr (cap2, address); \ | 1332 | char *sequence = tgetstr (cap2, address); \ |
| 1337 | if (sequence) \ | 1333 | if (sequence) \ |
| 1338 | term_get_fkeys_define (build_string (sequence), \ | 1334 | Fdefine_key (Vfunction_key_map, build_string (sequence), \ |
| 1339 | Fmake_vector (make_number (1), \ | 1335 | Fmake_vector (make_number (1), \ |
| 1340 | intern (sym))); \ | 1336 | intern (sym))); \ |
| 1341 | } | 1337 | } |
| 1342 | 1338 | ||
| 1343 | /* if there's no key_next keycap, map key_npage to `next' keysym */ | 1339 | /* if there's no key_next keycap, map key_npage to `next' keysym */ |