Mercurial > hg > xemacs-beta
comparison src/keymap.c @ 8:4b173ad71786 r19-15b5
Import from CVS: tag r19-15b5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:47:35 +0200 |
parents | ac2d302a0011 |
children | 49a24b4fd526 |
comparison
equal
deleted
inserted
replaced
7:c153ca296910 | 8:4b173ad71786 |
---|---|
1251 /* Defining keys in keymaps */ | 1251 /* Defining keys in keymaps */ |
1252 /************************************************************************/ | 1252 /************************************************************************/ |
1253 | 1253 |
1254 static void | 1254 static void |
1255 define_key_check_keysym (Lisp_Object spec, | 1255 define_key_check_keysym (Lisp_Object spec, |
1256 Lisp_Object keysym, unsigned int modifiers) | 1256 Lisp_Object *keysym, unsigned int modifiers) |
1257 { | 1257 { |
1258 /* Now, check and massage the trailing keysym specifier. */ | 1258 /* Now, check and massage the trailing keysym specifier. */ |
1259 if (SYMBOLP (keysym)) | 1259 if (SYMBOLP (*keysym)) |
1260 { | 1260 { |
1261 if (string_length (XSYMBOL (keysym)->name) == 1) | 1261 if (string_length (XSYMBOL (*keysym)->name) == 1) |
1262 { | 1262 { |
1263 keysym = make_int (string_char (XSYMBOL (keysym)->name, 0)); | 1263 *keysym = make_int (string_char (XSYMBOL (*keysym)->name, 0)); |
1264 goto fixnum_keysym; | 1264 goto fixnum_keysym; |
1265 } | 1265 } |
1266 } | 1266 } |
1267 else if (INTP (keysym)) | 1267 else if (INTP (*keysym)) |
1268 { | 1268 { |
1269 fixnum_keysym: | 1269 fixnum_keysym: |
1270 if (XINT (keysym) < ' ' || XINT (keysym) > 255) | 1270 if (XINT (*keysym) < ' ' || XINT (*keysym) > 255) |
1271 signal_simple_error ("keysym must be in the range 32 - 255", | 1271 signal_simple_error ("keysym must be in the range 32 - 255", |
1272 keysym); | 1272 *keysym); |
1273 /* #### This bites! I want to be able to write (control shift a) */ | 1273 /* #### This bites! I want to be able to write (control shift a) */ |
1274 if (modifiers & MOD_SHIFT) | 1274 if (modifiers & MOD_SHIFT) |
1275 signal_simple_error ("the `shift' modifier may not be applied to ASCII keysyms", | 1275 signal_simple_error ("the `shift' modifier may not be applied to ASCII keysyms", |
1276 spec); | 1276 spec); |
1277 } | 1277 } |
1278 else | 1278 else |
1279 { | 1279 { |
1280 signal_simple_error ("unknown keysym specifier", | 1280 signal_simple_error ("unknown keysym specifier", |
1281 keysym); | 1281 *keysym); |
1282 } | 1282 } |
1283 } | 1283 |
1284 | 1284 /* Code semi-snarfed from v20. */ |
1285 if (SYMBOLP (*keysym)) | |
1286 { | |
1287 char *name = (char *) | |
1288 string_data (XSYMBOL (*keysym)->name); | |
1289 | |
1290 if (!strncmp(name, "kp_", 3)) { | |
1291 /* Likewise, the obsolete keysym binding of kp_.* should not lose. */ | |
1292 char temp[50]; | |
1293 | |
1294 strncpy(temp, name, sizeof (temp)); | |
1295 temp[sizeof (temp) - 1] = '\0'; | |
1296 temp[2] = '-'; | |
1297 *keysym = Fintern_soft(make_string(temp, strlen(temp)), Qnil); | |
1298 } | |
1299 } | |
1300 } | |
1285 | 1301 |
1286 /* Given any kind of key-specifier, return a keysym and modifier mask. | 1302 /* Given any kind of key-specifier, return a keysym and modifier mask. |
1287 */ | 1303 */ |
1288 static void | 1304 static void |
1289 define_key_parser (Lisp_Object spec, struct key_data *returned_value) | 1305 define_key_parser (Lisp_Object spec, struct key_data *returned_value) |
1343 else if (SYMBOLP (spec)) | 1359 else if (SYMBOLP (spec)) |
1344 { | 1360 { |
1345 /* Be nice, allow = to mean (=) */ | 1361 /* Be nice, allow = to mean (=) */ |
1346 if (bucky_sym_to_bucky_bit (spec) != 0) | 1362 if (bucky_sym_to_bucky_bit (spec) != 0) |
1347 signal_simple_error ("Key is a modifier name", spec); | 1363 signal_simple_error ("Key is a modifier name", spec); |
1348 define_key_check_keysym (spec, spec, 0); | 1364 define_key_check_keysym (spec, &spec, 0); |
1349 returned_value->keysym = spec; | 1365 returned_value->keysym = spec; |
1350 returned_value->modifiers = 0; | 1366 returned_value->modifiers = 0; |
1351 } | 1367 } |
1352 else if (CONSP (spec)) | 1368 else if (CONSP (spec)) |
1353 { | 1369 { |
1378 QUIT; | 1394 QUIT; |
1379 } | 1395 } |
1380 if (!NILP (rest)) | 1396 if (!NILP (rest)) |
1381 signal_simple_error ("dotted list", spec); | 1397 signal_simple_error ("dotted list", spec); |
1382 | 1398 |
1383 define_key_check_keysym (spec, keysym, modifiers); | 1399 define_key_check_keysym (spec, &keysym, modifiers); |
1384 returned_value->keysym = keysym; | 1400 returned_value->keysym = keysym; |
1385 returned_value->modifiers = modifiers; | 1401 returned_value->modifiers = modifiers; |
1386 } | 1402 } |
1387 else | 1403 else |
1388 { | 1404 { |