Mercurial > hg > xemacs-beta
comparison src/keymap.c @ 563:183866b06e0b
[xemacs-hg @ 2001-05-24 07:50:48 by ben]
Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c:
-- defsymbol -> DEFSYMBOL.
-- add an error type to all errors.
-- eliminate the error functions in eval.c that let you just
use Qerror as the type.
-- redo the error API to be more consistent, sensibly named,
and easier to use.
-- redo the error hierarchy somewhat. create new errors:
structure-formation-error, gui-error, invalid-constant,
stack-overflow, out-of-memory, process-error, network-error,
sound-error, printing-unreadable-object, base64-conversion-
error; coding-system-error renamed to text-conversion error;
some others.
-- fix Mule problems in error strings in emodules.c, tooltalk.c.
-- fix error handling in mswin open-network-stream.
-- Mule-ize all sound files and clean up the headers.
-- nativesound.h -> sound.h and used for all sound files.
-- move some shared stuff into glyphs-shared.c: first attempt
at eliminating some of the massive GTK code duplication.
xemacs.mak: add glyphs-shared.c.
xemacs-faq.texi: document how to debug X errors
subr.el: fix doc string to reflect reality
author | ben |
---|---|
date | Thu, 24 May 2001 07:51:33 +0000 |
parents | 7039e6323819 |
children | b39c14581166 |
comparison
equal
deleted
inserted
replaced
562:c775bd016b32 | 563:183866b06e0b |
---|---|
254 { | 254 { |
255 /* This function can GC */ | 255 /* This function can GC */ |
256 Lisp_Keymap *keymap = XKEYMAP (obj); | 256 Lisp_Keymap *keymap = XKEYMAP (obj); |
257 char buf[200]; | 257 char buf[200]; |
258 if (print_readably) | 258 if (print_readably) |
259 error ("printing unreadable object #<keymap 0x%x>", keymap->header.uid); | 259 printing_unreadable_object ("#<keymap 0x%x>", keymap->header.uid); |
260 write_c_string ("#<keymap ", printcharfun); | 260 write_c_string ("#<keymap ", printcharfun); |
261 if (!NILP (keymap->name)) | 261 if (!NILP (keymap->name)) |
262 { | 262 { |
263 print_internal (keymap->name, printcharfun, 1); | 263 print_internal (keymap->name, printcharfun, 1); |
264 write_c_string (" ", printcharfun); | 264 write_c_string (" ", printcharfun); |
385 } | 385 } |
386 } | 386 } |
387 keymap = get_keymap (keymap, 1, 1); | 387 keymap = get_keymap (keymap, 1, 1); |
388 if (EQ (keymap, start_keymap)) | 388 if (EQ (keymap, start_keymap)) |
389 { | 389 { |
390 signal_simple_error ("Cyclic keymap indirection", | 390 invalid_argument ("Cyclic keymap indirection", start_keymap); |
391 start_keymap); | |
392 } | 391 } |
393 } | 392 } |
394 } | 393 } |
395 | 394 |
396 | 395 |
584 if (KEYMAPP (def)) | 583 if (KEYMAPP (def)) |
585 { | 584 { |
586 Lisp_Object maps; | 585 Lisp_Object maps; |
587 | 586 |
588 if (XKEYMAP (def) == to_keymap) | 587 if (XKEYMAP (def) == to_keymap) |
589 signal_simple_error ("Cyclic keymap definition", def); | 588 invalid_argument ("Cyclic keymap definition", def); |
590 | 589 |
591 for (maps = keymap_submaps (def); | 590 for (maps = keymap_submaps (def); |
592 CONSP (maps); | 591 CONSP (maps); |
593 maps = XCDR (maps)) | 592 maps = XCDR (maps)) |
594 check_keymap_definition_loop (XCDR (XCAR (maps)), to_keymap); | 593 check_keymap_definition_loop (XCDR (XCAR (maps)), to_keymap); |
1275 fixnum_keysym: | 1274 fixnum_keysym: |
1276 if (XCHAR (*keysym) < ' ' | 1275 if (XCHAR (*keysym) < ' ' |
1277 /* || (XCHAR (*keysym) >= 128 && XCHAR (*keysym) < 160) */) | 1276 /* || (XCHAR (*keysym) >= 128 && XCHAR (*keysym) < 160) */) |
1278 /* yuck! Can't make the above restriction; too many compatibility | 1277 /* yuck! Can't make the above restriction; too many compatibility |
1279 problems ... */ | 1278 problems ... */ |
1280 signal_simple_error ("keysym char must be printable", *keysym); | 1279 invalid_argument ("keysym char must be printable", *keysym); |
1281 /* #### This bites! I want to be able to write (control shift a) */ | 1280 /* #### This bites! I want to be able to write (control shift a) */ |
1282 if (modifiers & XEMACS_MOD_SHIFT) | 1281 if (modifiers & XEMACS_MOD_SHIFT) |
1283 signal_simple_error | 1282 invalid_argument |
1284 ("The `shift' modifier may not be applied to ASCII keysyms", | 1283 ("The `shift' modifier may not be applied to ASCII keysyms", |
1285 spec); | 1284 spec); |
1286 } | 1285 } |
1287 else | 1286 else |
1288 { | 1287 { |
1289 signal_simple_error ("Unknown keysym specifier", *keysym); | 1288 invalid_argument ("Unknown keysym specifier", *keysym); |
1290 } | 1289 } |
1291 | 1290 |
1292 if (SYMBOLP (*keysym)) | 1291 if (SYMBOLP (*keysym)) |
1293 { | 1292 { |
1294 char *name = (char *) string_data (XSYMBOL (*keysym)->name); | 1293 char *name = (char *) string_data (XSYMBOL (*keysym)->name); |
1323 !strcmp (name, "DEL") || | 1322 !strcmp (name, "DEL") || |
1324 !strcmp (name, "SPC") || | 1323 !strcmp (name, "SPC") || |
1325 !strcmp (name, "BS"))) | 1324 !strcmp (name, "BS"))) |
1326 #endif /* unused */ | 1325 #endif /* unused */ |
1327 ) | 1326 ) |
1328 signal_simple_error | 1327 invalid_argument |
1329 ("Invalid (FSF Emacs) key format (see doc of define-key)", | 1328 ("Invalid (FSF Emacs) key format (see doc of define-key)", |
1330 *keysym); | 1329 *keysym); |
1331 | 1330 |
1332 /* #### Ok, this is a bit more dubious - make people not lose if they | 1331 /* #### Ok, this is a bit more dubious - make people not lose if they |
1333 do things like (global-set-key 'RET 'something) because that would | 1332 do things like (global-set-key 'RET 'something) because that would |
1445 } | 1444 } |
1446 returned_value->modifiers = XEVENT (spec)->event.button.modifiers; | 1445 returned_value->modifiers = XEVENT (spec)->event.button.modifiers; |
1447 break; | 1446 break; |
1448 } | 1447 } |
1449 default: | 1448 default: |
1450 signal_error (Qwrong_type_argument, | 1449 wtaerror ("unable to bind this type of event", spec); |
1451 list2 (build_translated_string | |
1452 ("unable to bind this type of event"), | |
1453 spec)); | |
1454 } | 1450 } |
1455 } | 1451 } |
1456 else if (SYMBOLP (spec)) | 1452 else if (SYMBOLP (spec)) |
1457 { | 1453 { |
1458 /* Be nice, allow = to mean (=) */ | 1454 /* Be nice, allow = to mean (=) */ |
1459 if (bucky_sym_to_bucky_bit (spec) != 0) | 1455 if (bucky_sym_to_bucky_bit (spec) != 0) |
1460 signal_simple_error ("Key is a modifier name", spec); | 1456 invalid_argument ("Key is a modifier name", spec); |
1461 define_key_check_and_coerce_keysym (spec, &spec, 0); | 1457 define_key_check_and_coerce_keysym (spec, &spec, 0); |
1462 returned_value->keysym = spec; | 1458 returned_value->keysym = spec; |
1463 returned_value->modifiers = 0; | 1459 returned_value->modifiers = 0; |
1464 } | 1460 } |
1465 else if (CONSP (spec)) | 1461 else if (CONSP (spec)) |
1477 modifier = bucky_sym_to_bucky_bit (keysym); | 1473 modifier = bucky_sym_to_bucky_bit (keysym); |
1478 modifiers |= modifier; | 1474 modifiers |= modifier; |
1479 if (!NILP (XCDR (rest))) | 1475 if (!NILP (XCDR (rest))) |
1480 { | 1476 { |
1481 if (! modifier) | 1477 if (! modifier) |
1482 signal_simple_error ("Unknown modifier", keysym); | 1478 invalid_argument ("Unknown modifier", keysym); |
1483 } | 1479 } |
1484 else | 1480 else |
1485 { | 1481 { |
1486 if (modifier) | 1482 if (modifier) |
1487 signal_simple_error ("Nothing but modifiers here", | 1483 sferror ("Nothing but modifiers here", |
1488 spec); | 1484 spec); |
1489 } | 1485 } |
1490 rest = XCDR (rest); | 1486 rest = XCDR (rest); |
1491 QUIT; | 1487 QUIT; |
1492 } | 1488 } |
1493 if (!NILP (rest)) | 1489 if (!NILP (rest)) |
1494 signal_simple_error ("List must be nil-terminated", spec); | 1490 signal_error (Qlist_formation_error, |
1491 "List must be nil-terminated", spec); | |
1495 | 1492 |
1496 define_key_check_and_coerce_keysym (spec, &keysym, modifiers); | 1493 define_key_check_and_coerce_keysym (spec, &keysym, modifiers); |
1497 returned_value->keysym = keysym; | 1494 returned_value->keysym = keysym; |
1498 returned_value->modifiers = modifiers; | 1495 returned_value->modifiers = modifiers; |
1499 } | 1496 } |
1500 else | 1497 else |
1501 { | 1498 { |
1502 signal_simple_error ("Unknown key-sequence specifier", | 1499 invalid_argument ("Unknown key-sequence specifier", |
1503 spec); | 1500 spec); |
1504 } | 1501 } |
1505 } | 1502 } |
1506 | 1503 |
1507 /* Used by character-to-event */ | 1504 /* Used by character-to-event */ |
1516 /* #### where the hell does this come from? */ | 1513 /* #### where the hell does this come from? */ |
1517 EQ (XCAR (list), Qmenu_selection)) | 1514 EQ (XCAR (list), Qmenu_selection)) |
1518 { | 1515 { |
1519 Lisp_Object fn, arg; | 1516 Lisp_Object fn, arg; |
1520 if (! NILP (Fcdr (Fcdr (list)))) | 1517 if (! NILP (Fcdr (Fcdr (list)))) |
1521 signal_simple_error ("Invalid menu event desc", list); | 1518 invalid_argument ("Invalid menu event desc", list); |
1522 arg = Fcar (Fcdr (list)); | 1519 arg = Fcar (Fcdr (list)); |
1523 if (SYMBOLP (arg)) | 1520 if (SYMBOLP (arg)) |
1524 fn = Qcall_interactively; | 1521 fn = Qcall_interactively; |
1525 else | 1522 else |
1526 fn = Qeval; | 1523 fn = Qeval; |
1539 EQ (raw_key.keysym, Qbutton3) || EQ (raw_key.keysym, Qbutton3up) || | 1536 EQ (raw_key.keysym, Qbutton3) || EQ (raw_key.keysym, Qbutton3up) || |
1540 EQ (raw_key.keysym, Qbutton4) || EQ (raw_key.keysym, Qbutton4up) || | 1537 EQ (raw_key.keysym, Qbutton4) || EQ (raw_key.keysym, Qbutton4up) || |
1541 EQ (raw_key.keysym, Qbutton5) || EQ (raw_key.keysym, Qbutton5up) || | 1538 EQ (raw_key.keysym, Qbutton5) || EQ (raw_key.keysym, Qbutton5up) || |
1542 EQ (raw_key.keysym, Qbutton6) || EQ (raw_key.keysym, Qbutton6up) || | 1539 EQ (raw_key.keysym, Qbutton6) || EQ (raw_key.keysym, Qbutton6up) || |
1543 EQ (raw_key.keysym, Qbutton7) || EQ (raw_key.keysym, Qbutton7up)) | 1540 EQ (raw_key.keysym, Qbutton7) || EQ (raw_key.keysym, Qbutton7up)) |
1544 error ("Mouse-clicks can't appear in saved keyboard macros."); | 1541 invalid_operation ("Mouse-clicks can't appear in saved keyboard macros", |
1542 Qunbound); | |
1545 | 1543 |
1546 XEVENT (event)->channel = Vselected_console; | 1544 XEVENT (event)->channel = Vselected_console; |
1547 XEVENT (event)->event_type = key_press_event; | 1545 XEVENT (event)->event_type = key_press_event; |
1548 XEVENT (event)->event.key.keysym = raw_key.keysym; | 1546 XEVENT (event)->event.key.keysym = raw_key.keysym; |
1549 XEVENT (event)->event.key.modifiers = raw_key.modifiers; | 1547 XEVENT (event)->event.key.modifiers = raw_key.modifiers; |
1722 new_keys = Qnil; | 1720 new_keys = Qnil; |
1723 abort (); | 1721 abort (); |
1724 } | 1722 } |
1725 | 1723 |
1726 if (EQ (keys, new_keys)) | 1724 if (EQ (keys, new_keys)) |
1727 error_with_frob (mpc_binding, | 1725 signal_ferror_with_frob (Qinvalid_operation, mpc_binding, |
1728 "can't bind %s: %s has a non-keymap binding", | 1726 "can't bind %s: %s has a non-keymap binding", |
1729 (char *) XSTRING_DATA (Fkey_description (keys)), | 1727 (char *) XSTRING_DATA (Fkey_description (keys)), |
1730 (char *) XSTRING_DATA (Fsingle_key_description | 1728 (char *) XSTRING_DATA (Fsingle_key_description |
1731 (Vmeta_prefix_char))); | 1729 (Vmeta_prefix_char))); |
1732 else | 1730 else |
1733 error_with_frob (mpc_binding, | 1731 signal_ferror_with_frob (Qinvalid_operation, mpc_binding, |
1734 "can't bind %s: %s %s has a non-keymap binding", | 1732 "can't bind %s: %s %s has a non-keymap binding", |
1735 (char *) XSTRING_DATA (Fkey_description (keys)), | 1733 (char *) XSTRING_DATA (Fkey_description (keys)), |
1736 (char *) XSTRING_DATA (Fkey_description (new_keys)), | 1734 (char *) XSTRING_DATA (Fkey_description |
1737 (char *) XSTRING_DATA (Fsingle_key_description | 1735 (new_keys)), |
1738 (Vmeta_prefix_char))); | 1736 (char *) XSTRING_DATA (Fsingle_key_description |
1737 (Vmeta_prefix_char))); | |
1739 } | 1738 } |
1740 | 1739 |
1741 DEFUN ("define-key", Fdefine_key, 3, 3, 0, /* | 1740 DEFUN ("define-key", Fdefine_key, 3, 3, 0, /* |
1742 Define key sequence KEYS, in KEYMAP, as DEF. | 1741 Define key sequence KEYS, in KEYMAP, as DEF. |
1743 KEYMAP is a keymap object. | 1742 KEYMAP is a keymap object. |
1919 NGCPRO1 (c); | 1918 NGCPRO1 (c); |
1920 meta_map = Fgethash (MAKE_MODIFIER_HASH_KEY (XEMACS_MOD_META), | 1919 meta_map = Fgethash (MAKE_MODIFIER_HASH_KEY (XEMACS_MOD_META), |
1921 XKEYMAP (keymap)->table, Qnil); | 1920 XKEYMAP (keymap)->table, Qnil); |
1922 if (!NILP (meta_map) | 1921 if (!NILP (meta_map) |
1923 && keymap_fullness (meta_map) != 0) | 1922 && keymap_fullness (meta_map) != 0) |
1924 signal_simple_error_2 | 1923 invalid_operation_2 |
1925 ("Map contains meta-bindings, can't bind", | 1924 ("Map contains meta-bindings, can't bind", |
1926 Fsingle_key_description (Vmeta_prefix_char), keymap); | 1925 Fsingle_key_description (Vmeta_prefix_char), keymap); |
1927 NUNGCPRO; | 1926 NUNGCPRO; |
1928 } | 1927 } |
1929 else | 1928 else |
1975 XKEYMAP (cmd)->name /* for debugging */ | 1974 XKEYMAP (cmd)->name /* for debugging */ |
1976 = list2 (make_key_description (&raw_key1, 1), keymap); | 1975 = list2 (make_key_description (&raw_key1, 1), keymap); |
1977 keymap_store (keymap, &raw_key1, cmd); | 1976 keymap_store (keymap, &raw_key1, cmd); |
1978 } | 1977 } |
1979 if (NILP (Fkeymapp (cmd))) | 1978 if (NILP (Fkeymapp (cmd))) |
1980 signal_simple_error_2 ("Invalid prefix keys in sequence", | 1979 sferror_2 ("Invalid prefix keys in sequence", |
1981 c, keys); | 1980 c, keys); |
1982 | 1981 |
1983 if (ascii_hack && !NILP (raw_key2.keysym) && | 1982 if (ascii_hack && !NILP (raw_key2.keysym) && |
1984 NILP (keymap_lookup_1 (keymap, &raw_key2, 0))) | 1983 NILP (keymap_lookup_1 (keymap, &raw_key2, 0))) |
1985 keymap_store (keymap, &raw_key2, cmd); | 1984 keymap_store (keymap, &raw_key2, cmd); |
3276 else if (EQ (keysym, QKbackspace)) strcpy (bufp, "BS"); | 3275 else if (EQ (keysym, QKbackspace)) strcpy (bufp, "BS"); |
3277 else | 3276 else |
3278 #endif | 3277 #endif |
3279 strcpy (bufp, (char *) string_data (XSYMBOL (keysym)->name)); | 3278 strcpy (bufp, (char *) string_data (XSYMBOL (keysym)->name)); |
3280 if (!NILP (XCDR (rest))) | 3279 if (!NILP (XCDR (rest))) |
3281 signal_simple_error ("Invalid key description", | 3280 invalid_argument ("Invalid key description", |
3282 key); | 3281 key); |
3283 } | 3282 } |
3284 } | 3283 } |
3285 return build_string (buf); | 3284 return build_string (buf); |
3286 } | 3285 } |
3310 if (EVENTP (chr)) | 3309 if (EVENTP (chr)) |
3311 { | 3310 { |
3312 Lisp_Object ch = Fevent_to_character (chr, Qnil, Qnil, Qt); | 3311 Lisp_Object ch = Fevent_to_character (chr, Qnil, Qnil, Qt); |
3313 if (NILP (ch)) | 3312 if (NILP (ch)) |
3314 return | 3313 return |
3315 signal_simple_continuable_error | 3314 signal_continuable_error |
3316 ("character has no ASCII equivalent", Fcopy_event (chr, Qnil)); | 3315 (Qinvalid_argument, |
3316 "character has no ASCII equivalent", Fcopy_event (chr, Qnil)); | |
3317 chr = ch; | 3317 chr = ch; |
3318 } | 3318 } |
3319 | 3319 |
3320 CHECK_CHAR_COERCE_INT (chr); | 3320 CHECK_CHAR_COERCE_INT (chr); |
3321 | 3321 |