comparison src/keymap.c @ 793:e38acbeb1cae

[xemacs-hg @ 2002-03-29 04:46:17 by ben] lots o' fixes etc/ChangeLog: New file. Separated out all entries for etc/ into their own ChangeLog. Includes entries for the following files: etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad, etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL, etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS, etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL, etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se, etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh, etc/custom/example-themes/europe-theme.el, etc/custom/example-themes/ex-custom-file, etc/custom/example-themes/example-theme.el, etc/e/eterm.ti, etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1, etc/gnuserv.README, etc/package-index.LATEST.gpg, etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm, etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs, etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E, etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm, etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm, etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar, etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1, etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL, etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el, etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\* unicode/unicode-consortium/8859-16.TXT: New file. mule/english.el: Define this charset now, since a bug was fixed that formerly prevented it. mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be integers. Makefile.in.in: Always include gui.c, to fix compile error when TTY-only. EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo(). Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate nearly all uses of Lisp_String * in favor of Lisp_Object, and correct macros so most of them favor Lisp_Object. Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings, but at level `debug' (usually ignored). Use it when instantiating specifiers, so problems can be debugged. Move log-warning-minimum-level into C so that we can optimize ERROR_ME_DEBUG_WARN. Fix warning levels consistent with new definitions. Add default_ and parent fields to char table; not yet implemented. New fun Dynarr_verify(); use for further error checking on Dynarrs. Rearrange code at top of lisp.h in conjunction with dynarr changes. Fix eifree(). Use Eistrings in various places (format_event_object(), where_is_to_char(), and callers thereof) to avoid fixed-size strings buffers. New fun write_eistring(). Reindent and fix GPM code to follow standards. Set default MS Windows font to Lucida Console (same size as Courier New but less interline spacing, so more lines fit). Increase default frame size on Windows to 50 lines. (If that's too big for the workspace, the frame will be shrunk as necessary.) Fix problem with text files with no newlines (). (Change `convert-eol' coding system to use `nil' for autodetect, consistent with make-coding-system.) Correct compile warnings in vm-limit.c. Fix handling of reverse-direction charsets to avoid errors when opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el. Recode some object printing methods to use write_fmt_string() instead of a fixed buffer and sprintf. Turn on display of png comments as warnings (level `info'), now that they're unobtrusive. Revamped the sound documentation. Fixed bug in redisplay w.r.t. hscroll/truncation/continuation glyphs causing jumping up and down of the lines, since they're bigger than the line size. (It was seen most obviously when there's a horizontal scroll bar, e.g. do C-h a glyph or something like that.) The problem was that the glyph-contrib-p setting on glyphs was ignored even if it was set properly, which it wasn't until now.
author ben
date Fri, 29 Mar 2002 04:49:13 +0000
parents 943eaba38521
children a5954632b187
comparison
equal deleted inserted replaced
792:4e83fdb13eb9 793:e38acbeb1cae
1 /* Manipulation of keymaps 1 /* Manipulation of keymaps
2 Copyright (C) 1985, 1991-1995 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1991-1995 Free Software Foundation, Inc.
3 Copyright (C) 1995 Board of Trustees, University of Illinois. 3 Copyright (C) 1995 Board of Trustees, University of Illinois.
4 Copyright (C) 1995 Sun Microsystems, Inc. 4 Copyright (C) 1995 Sun Microsystems, Inc.
5 Copyright (C) 2001 Ben Wing. 5 Copyright (C) 2001, 2002 Ben Wing.
6 Totally redesigned by jwz in 1991. 6 Totally redesigned by jwz in 1991.
7 7
8 This file is part of XEmacs. 8 This file is part of XEmacs.
9 9
10 XEmacs is free software; you can redistribute it and/or modify it 10 XEmacs is free software; you can redistribute it and/or modify it
476 abort (); 476 abort ();
477 477
478 k = XKEYMAP (keymap); 478 k = XKEYMAP (keymap);
479 479
480 /* If the keysym is a one-character symbol, use the char code instead. */ 480 /* If the keysym is a one-character symbol, use the char code instead. */
481 if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) 481 if (SYMBOLP (keysym) && XSTRING_CHAR_LENGTH (XSYMBOL (keysym)->name) == 1)
482 { 482 {
483 Lisp_Object i_fart_on_gcc = 483 Lisp_Object i_fart_on_gcc =
484 make_char (string_char (XSYMBOL (keysym)->name, 0)); 484 make_char (XSTRING_CHAR (XSYMBOL (keysym)->name, 0));
485 keysym = i_fart_on_gcc; 485 keysym = i_fart_on_gcc;
486 } 486 }
487 487
488 if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */ 488 if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */
489 { 489 {
654 assert ((modifiers & ~(XEMACS_MOD_CONTROL | XEMACS_MOD_META 654 assert ((modifiers & ~(XEMACS_MOD_CONTROL | XEMACS_MOD_META
655 | XEMACS_MOD_SUPER | XEMACS_MOD_HYPER 655 | XEMACS_MOD_SUPER | XEMACS_MOD_HYPER
656 | XEMACS_MOD_ALT | XEMACS_MOD_SHIFT)) == 0); 656 | XEMACS_MOD_ALT | XEMACS_MOD_SHIFT)) == 0);
657 657
658 /* If the keysym is a one-character symbol, use the char code instead. */ 658 /* If the keysym is a one-character symbol, use the char code instead. */
659 if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) 659 if (SYMBOLP (keysym) && XSTRING_CHAR_LENGTH (XSYMBOL (keysym)->name) == 1)
660 keysym = make_char (string_char (XSYMBOL (keysym)->name, 0)); 660 keysym = make_char (XSTRING_CHAR (XSYMBOL (keysym)->name, 0));
661 661
662 if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */ 662 if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */
663 { 663 {
664 Lisp_Object submap = Fgethash (MAKE_MODIFIER_HASH_KEY (XEMACS_MOD_META), 664 Lisp_Object submap = Fgethash (MAKE_MODIFIER_HASH_KEY (XEMACS_MOD_META),
665 k->table, Qnil); 665 k->table, Qnil);
757 make_keymap (Elemcount size) 757 make_keymap (Elemcount size)
758 { 758 {
759 Lisp_Object result; 759 Lisp_Object result;
760 Lisp_Keymap *keymap = alloc_lcrecord_type (Lisp_Keymap, &lrecord_keymap); 760 Lisp_Keymap *keymap = alloc_lcrecord_type (Lisp_Keymap, &lrecord_keymap);
761 761
762 XSETKEYMAP (result, keymap); 762 result = wrap_keymap (keymap);
763 763
764 keymap->parents = Qnil; 764 keymap->parents = Qnil;
765 keymap->prompt = Qnil; 765 keymap->prompt = Qnil;
766 keymap->table = Qnil; 766 keymap->table = Qnil;
767 keymap->inverse_table = Qnil; 767 keymap->inverse_table = Qnil;
1262 int modifiers) 1262 int modifiers)
1263 { 1263 {
1264 /* Now, check and massage the trailing keysym specifier. */ 1264 /* Now, check and massage the trailing keysym specifier. */
1265 if (SYMBOLP (*keysym)) 1265 if (SYMBOLP (*keysym))
1266 { 1266 {
1267 if (string_char_length (XSYMBOL (*keysym)->name) == 1) 1267 if (XSTRING_CHAR_LENGTH (XSYMBOL (*keysym)->name) == 1)
1268 { 1268 {
1269 Lisp_Object ream_gcc_up_the_ass = 1269 Lisp_Object ream_gcc_up_the_ass =
1270 make_char (string_char (XSYMBOL (*keysym)->name, 0)); 1270 make_char (XSTRING_CHAR (XSYMBOL (*keysym)->name, 0));
1271 *keysym = ream_gcc_up_the_ass; 1271 *keysym = ream_gcc_up_the_ass;
1272 goto fixnum_keysym; 1272 goto fixnum_keysym;
1273 } 1273 }
1274 } 1274 }
1275 else if (CHAR_OR_CHAR_INTP (*keysym)) 1275 else if (CHAR_OR_CHAR_INTP (*keysym))
1292 invalid_argument ("Unknown keysym specifier", *keysym); 1292 invalid_argument ("Unknown keysym specifier", *keysym);
1293 } 1293 }
1294 1294
1295 if (SYMBOLP (*keysym)) 1295 if (SYMBOLP (*keysym))
1296 { 1296 {
1297 char *name = (char *) string_data (XSYMBOL (*keysym)->name); 1297 Intbyte *name = XSTRING_DATA (XSYMBOL (*keysym)->name);
1298 1298
1299 /* FSFmacs uses symbols with the printed representation of keysyms in 1299 /* FSFmacs uses symbols with the printed representation of keysyms in
1300 their names, like 'M-x, and we use the syntax '(meta x). So, to avoid 1300 their names, like 'M-x, and we use the syntax '(meta x). So, to avoid
1301 confusion, notice the M-x syntax and signal an error - because 1301 confusion, notice the M-x syntax and signal an error - because
1302 otherwise it would be interpreted as a regular keysym, and would even 1302 otherwise it would be interpreted as a regular keysym, and would even
1308 It might be useful to reject keysyms which are not x-valid-keysym- 1308 It might be useful to reject keysyms which are not x-valid-keysym-
1309 name-p, but that would interfere with various tricks we do to 1309 name-p, but that would interfere with various tricks we do to
1310 sanitize the Sun keyboards, and would make it trickier to 1310 sanitize the Sun keyboards, and would make it trickier to
1311 conditionalize a .emacs file for multiple X servers. 1311 conditionalize a .emacs file for multiple X servers.
1312 */ 1312 */
1313 if (((int) strlen (name) >= 2 && name[1] == '-') 1313 if (((int) qxestrlen (name) >= 2 && name[1] == '-')
1314 #if 1 1314 #if 1
1315 || 1315 ||
1316 /* Ok, this is a bit more dubious - prevent people from doing things 1316 /* Ok, this is a bit more dubious - prevent people from doing things
1317 like (global-set-key 'RET 'something) because that will have the 1317 like (global-set-key 'RET 'something) because that will have the
1318 same problem as above. (Gag!) Maybe we should just silently 1318 same problem as above. (Gag!) Maybe we should just silently
1319 accept these as aliases for the "real" names? 1319 accept these as aliases for the "real" names?
1320 */ 1320 */
1321 (string_length (XSYMBOL (*keysym)->name) <= 3 && 1321 (XSTRING_LENGTH (XSYMBOL (*keysym)->name) <= 3 &&
1322 (!strcmp (name, "LFD") || 1322 (!qxestrcmp_c (name, "LFD") ||
1323 !strcmp (name, "TAB") || 1323 !qxestrcmp_c (name, "TAB") ||
1324 !strcmp (name, "RET") || 1324 !qxestrcmp_c (name, "RET") ||
1325 !strcmp (name, "ESC") || 1325 !qxestrcmp_c (name, "ESC") ||
1326 !strcmp (name, "DEL") || 1326 !qxestrcmp_c (name, "DEL") ||
1327 !strcmp (name, "SPC") || 1327 !qxestrcmp_c (name, "SPC") ||
1328 !strcmp (name, "BS"))) 1328 !qxestrcmp_c (name, "BS")))
1329 #endif /* unused */ 1329 #endif /* unused */
1330 ) 1330 )
1331 invalid_argument 1331 invalid_argument
1332 ("Invalid (FSF Emacs) key format (see doc of define-key)", 1332 ("Invalid (FSF Emacs) key format (see doc of define-key)",
1333 *keysym); 1333 *keysym);
1335 /* #### Ok, this is a bit more dubious - make people not lose if they 1335 /* #### Ok, this is a bit more dubious - make people not lose if they
1336 do things like (global-set-key 'RET 'something) because that would 1336 do things like (global-set-key 'RET 'something) because that would
1337 otherwise have the same problem as above. (Gag!) We silently 1337 otherwise have the same problem as above. (Gag!) We silently
1338 accept these as aliases for the "real" names. 1338 accept these as aliases for the "real" names.
1339 */ 1339 */
1340 else if (!strncmp(name, "kp_", 3)) { 1340 else if (!qxestrncmp_c (name, "kp_", 3))
1341 /* Likewise, the obsolete keysym binding of kp_.* should not lose. */ 1341 {
1342 char temp[50]; 1342 /* Likewise, the obsolete keysym binding of kp_.* should not lose. */
1343 1343 DECLARE_EISTRING (temp);
1344 strncpy(temp, name, sizeof (temp)); 1344 eicpy_raw (temp, name, qxestrlen (name));
1345 temp[sizeof (temp) - 1] = '\0'; 1345 eisetch_char (temp, 2, '-');
1346 temp[2] = '-'; 1346 *keysym = Fintern_soft (eimake_string (temp), Qnil);
1347 *keysym = Fintern_soft(make_string((Intbyte *)temp, 1347 }
1348 strlen(temp)), 1348 else if (EQ (*keysym, QLFD))
1349 Qnil);
1350 } else if (EQ (*keysym, QLFD))
1351 *keysym = QKlinefeed; 1349 *keysym = QKlinefeed;
1352 else if (EQ (*keysym, QTAB)) 1350 else if (EQ (*keysym, QTAB))
1353 *keysym = QKtab; 1351 *keysym = QKtab;
1354 else if (EQ (*keysym, QRET)) 1352 else if (EQ (*keysym, QRET))
1355 *keysym = QKreturn; 1353 *keysym = QKreturn;
1523 arg = Fcar (Fcdr (list)); 1521 arg = Fcar (Fcdr (list));
1524 if (SYMBOLP (arg)) 1522 if (SYMBOLP (arg))
1525 fn = Qcall_interactively; 1523 fn = Qcall_interactively;
1526 else 1524 else
1527 fn = Qeval; 1525 fn = Qeval;
1528 XSETFRAME (XEVENT (event)->channel, selected_frame ()); 1526 XEVENT (event)->channel = wrap_frame (selected_frame ());
1529 XEVENT (event)->event_type = misc_user_event; 1527 XEVENT (event)->event_type = misc_user_event;
1530 XEVENT (event)->event.eval.function = fn; 1528 XEVENT (event)->event.eval.function = fn;
1531 XEVENT (event)->event.eval.object = arg; 1529 XEVENT (event)->event.eval.object = arg;
1532 return; 1530 return;
1533 } 1531 }
1902 Lisp_Object c; 1900 Lisp_Object c;
1903 struct key_data raw_key1; 1901 struct key_data raw_key1;
1904 struct key_data raw_key2; 1902 struct key_data raw_key2;
1905 1903
1906 if (STRINGP (keys)) 1904 if (STRINGP (keys))
1907 c = make_char (string_char (XSTRING (keys), idx)); 1905 c = make_char (XSTRING_CHAR (keys, idx));
1908 else 1906 else
1909 c = XVECTOR_DATA (keys) [idx]; 1907 c = XVECTOR_DATA (keys) [idx];
1910 1908
1911 define_key_parser (c, &raw_key1); 1909 define_key_parser (c, &raw_key1);
1912 1910
2228 if (length == 0) 2226 if (length == 0)
2229 return Qnil; 2227 return Qnil;
2230 2228
2231 for (i = 0; i < length; i++) 2229 for (i = 0; i < length; i++)
2232 { 2230 {
2233 Emchar n = string_char (XSTRING (keys), i); 2231 Emchar n = XSTRING_CHAR (keys, i);
2234 define_key_parser (make_char (n), &(raw_keys[i])); 2232 define_key_parser (make_char (n), &(raw_keys[i]));
2235 } 2233 }
2236 return raw_lookup_key (keymap, raw_keys, length, 0, 2234 return raw_lookup_key (keymap, raw_keys, length, 0,
2237 !NILP (accept_default)); 2235 !NILP (accept_default));
2238 } 2236 }
2329 } 2327 }
2330 else if (!EVENTP (terminal) 2328 else if (!EVENTP (terminal)
2331 || (XEVENT (terminal)->event_type != button_press_event 2329 || (XEVENT (terminal)->event_type != button_press_event
2332 && XEVENT (terminal)->event_type != button_release_event)) 2330 && XEVENT (terminal)->event_type != button_release_event))
2333 { 2331 {
2334 Lisp_Object tem; 2332 Lisp_Object tem = wrap_buffer (current_buffer);
2335 XSETBUFFER (tem, current_buffer); 2333
2336 /* It's not a mouse event; order of keymaps searched is: 2334 /* It's not a mouse event; order of keymaps searched is:
2337 o keymap of any/all extents under the mouse 2335 o keymap of any/all extents under the mouse
2338 o minor-mode maps 2336 o minor-mode maps
2339 o local-map of current-buffer 2337 o local-map of current-buffer
2340 o global-tty-map or global-window-system-map 2338 o global-tty-map or global-window-system-map
2500 if (SYMBOLP (sym)) 2498 if (SYMBOLP (sym))
2501 { 2499 {
2502 Lisp_Object val = symbol_value_in_buffer (sym, buffer); 2500 Lisp_Object val = symbol_value_in_buffer (sym, buffer);
2503 if (!NILP (val) && !UNBOUNDP (val)) 2501 if (!NILP (val) && !UNBOUNDP (val))
2504 { 2502 {
2505 Lisp_Object map = get_keymap (XCDR (assoc), 0, 1); 2503 return get_keymap (XCDR (assoc), 0, 1);
2506 return map;
2507 } 2504 }
2508 } 2505 }
2509 } 2506 }
2510 return Qnil; 2507 return Qnil;
2511 } 2508 }
2926 if (bit1 || bit2) 2923 if (bit1 || bit2)
2927 return bit2 ? 1 : -1; 2924 return bit2 ? 1 : -1;
2928 2925
2929 /* otherwise, string-sort them. */ 2926 /* otherwise, string-sort them. */
2930 { 2927 {
2931 char *s1 = (char *) string_data (XSYMBOL (obj1)->name); 2928 Intbyte *s1 = XSTRING_DATA (XSYMBOL (obj1)->name);
2932 char *s2 = (char *) string_data (XSYMBOL (obj2)->name); 2929 Intbyte *s2 = XSTRING_DATA (XSYMBOL (obj2)->name);
2933 return 0 > strcmp (s1, s2) ? 1 : -1; 2930 return 0 > qxestrcmp (s1, s2) ? 1 : -1;
2934 } 2931 }
2935 } 2932 }
2936 2933
2937 2934
2938 /* used by map_keymap() */ 2935 /* used by map_keymap() */
3244 3241
3245 for (i = 0; i < size; i++) 3242 for (i = 0; i < size; i++)
3246 { 3243 {
3247 Lisp_Object s2 = Fsingle_key_description 3244 Lisp_Object s2 = Fsingle_key_description
3248 (STRINGP (keys) 3245 (STRINGP (keys)
3249 ? make_char (string_char (XSTRING (keys), i)) 3246 ? make_char (XSTRING_CHAR (keys, i))
3250 : XVECTOR_DATA (keys)[i]); 3247 : XVECTOR_DATA (keys)[i]);
3251 3248
3252 if (i == 0) 3249 if (i == 0)
3253 string = s2; 3250 string = s2;
3254 else 3251 else
3273 if (SYMBOLP (key)) 3270 if (SYMBOLP (key))
3274 key = Fcons (key, Qnil); /* sleaze sleaze */ 3271 key = Fcons (key, Qnil); /* sleaze sleaze */
3275 3272
3276 if (EVENTP (key) || CHAR_OR_CHAR_INTP (key)) 3273 if (EVENTP (key) || CHAR_OR_CHAR_INTP (key))
3277 { 3274 {
3278 char buf [255]; 3275 DECLARE_EISTRING_MALLOC (buf);
3276 Lisp_Object str;
3277
3279 if (!EVENTP (key)) 3278 if (!EVENTP (key))
3280 { 3279 {
3281 Lisp_Event event; 3280 Lisp_Event event;
3282 event.event_type = empty_event; 3281 event.event_type = empty_event;
3283 CHECK_CHAR_COERCE_INT (key); 3282 CHECK_CHAR_COERCE_INT (key);
3285 XCONSOLE (Vselected_console), 0, 1); 3284 XCONSOLE (Vselected_console), 0, 1);
3286 format_event_object (buf, &event, 1); 3285 format_event_object (buf, &event, 1);
3287 } 3286 }
3288 else 3287 else
3289 format_event_object (buf, XEVENT (key), 1); 3288 format_event_object (buf, XEVENT (key), 1);
3290 return build_string (buf); 3289 str = eimake_string (buf);
3290 eifree (buf);
3291 return str;
3291 } 3292 }
3292 3293
3293 if (CONSP (key)) 3294 if (CONSP (key))
3294 { 3295 {
3295 char buf[255]; 3296 DECLARE_EISTRING (bufp);
3296 char *bufp = buf; 3297
3297 Lisp_Object rest; 3298 Lisp_Object rest;
3298 buf[0] = 0;
3299 LIST_LOOP (rest, key) 3299 LIST_LOOP (rest, key)
3300 { 3300 {
3301 Lisp_Object keysym = XCAR (rest); 3301 Lisp_Object keysym = XCAR (rest);
3302 if (EQ (keysym, Qcontrol)) strcpy (bufp, "C-"), bufp += 2; 3302 if (EQ (keysym, Qcontrol)) eicat_c (bufp, "C-");
3303 else if (EQ (keysym, Qctrl)) strcpy (bufp, "C-"), bufp += 2; 3303 else if (EQ (keysym, Qctrl)) eicat_c (bufp, "C-");
3304 else if (EQ (keysym, Qmeta)) strcpy (bufp, "M-"), bufp += 2; 3304 else if (EQ (keysym, Qmeta)) eicat_c (bufp, "M-");
3305 else if (EQ (keysym, Qsuper)) strcpy (bufp, "S-"), bufp += 2; 3305 else if (EQ (keysym, Qsuper)) eicat_c (bufp, "S-");
3306 else if (EQ (keysym, Qhyper)) strcpy (bufp, "H-"), bufp += 2; 3306 else if (EQ (keysym, Qhyper)) eicat_c (bufp, "H-");
3307 else if (EQ (keysym, Qalt)) strcpy (bufp, "A-"), bufp += 2; 3307 else if (EQ (keysym, Qalt)) eicat_c (bufp, "A-");
3308 else if (EQ (keysym, Qshift)) strcpy (bufp, "Sh-"), bufp += 3; 3308 else if (EQ (keysym, Qshift)) eicat_c (bufp, "Sh-");
3309 else if (CHAR_OR_CHAR_INTP (keysym)) 3309 else if (CHAR_OR_CHAR_INTP (keysym))
3310 { 3310 eicat_ch (bufp, XCHAR_OR_CHAR_INT (keysym));
3311 bufp += set_charptr_emchar ((Intbyte *) bufp,
3312 XCHAR_OR_CHAR_INT (keysym));
3313 *bufp = 0;
3314 }
3315 else 3311 else
3316 { 3312 {
3317 CHECK_SYMBOL (keysym); 3313 CHECK_SYMBOL (keysym);
3318 #if 0 /* This is bogus */ 3314 #if 0 /* This is bogus */
3319 if (EQ (keysym, QKlinefeed)) strcpy (bufp, "LFD"); 3315 if (EQ (keysym, QKlinefeed)) eicat_c (bufp, "LFD");
3320 else if (EQ (keysym, QKtab)) strcpy (bufp, "TAB"); 3316 else if (EQ (keysym, QKtab)) eicat_c (bufp, "TAB");
3321 else if (EQ (keysym, QKreturn)) strcpy (bufp, "RET"); 3317 else if (EQ (keysym, QKreturn)) eicat_c (bufp, "RET");
3322 else if (EQ (keysym, QKescape)) strcpy (bufp, "ESC"); 3318 else if (EQ (keysym, QKescape)) eicat_c (bufp, "ESC");
3323 else if (EQ (keysym, QKdelete)) strcpy (bufp, "DEL"); 3319 else if (EQ (keysym, QKdelete)) eicat_c (bufp, "DEL");
3324 else if (EQ (keysym, QKspace)) strcpy (bufp, "SPC"); 3320 else if (EQ (keysym, QKspace)) eicat_c (bufp, "SPC");
3325 else if (EQ (keysym, QKbackspace)) strcpy (bufp, "BS"); 3321 else if (EQ (keysym, QKbackspace)) eicat_c (bufp, "BS");
3326 else 3322 else
3327 #endif 3323 #endif
3328 strcpy (bufp, (char *) string_data (XSYMBOL (keysym)->name)); 3324 eicat_lstr (bufp, XSYMBOL (keysym)->name);
3329 if (!NILP (XCDR (rest))) 3325 if (!NILP (XCDR (rest)))
3330 invalid_argument ("Invalid key description", 3326 invalid_argument ("Invalid key description", key);
3331 key);
3332 } 3327 }
3333 } 3328 }
3334 return build_string (buf); 3329 return eimake_string (bufp);
3335 } 3330 }
3336 return Fsingle_key_description 3331 return Fsingle_key_description
3337 (wrong_type_argument (intern ("char-or-event-p"), key)); 3332 (wrong_type_argument (intern ("char-or-event-p"), key));
3338 } 3333 }
3339 3334
3419 /* where-is (mapping bindings to keys) */ 3414 /* where-is (mapping bindings to keys) */
3420 /************************************************************************/ 3415 /************************************************************************/
3421 3416
3422 static Lisp_Object 3417 static Lisp_Object
3423 where_is_internal (Lisp_Object definition, Lisp_Object *maps, int nmaps, 3418 where_is_internal (Lisp_Object definition, Lisp_Object *maps, int nmaps,
3424 Lisp_Object firstonly, char *target_buffer); 3419 Lisp_Object firstonly, Eistring *target_buffer);
3425 3420
3426 DEFUN ("where-is-internal", Fwhere_is_internal, 1, 5, 0, /* 3421 DEFUN ("where-is-internal", Fwhere_is_internal, 1, 5, 0, /*
3427 Return list of keys that invoke DEFINITION in KEYMAPS. 3422 Return list of keys that invoke DEFINITION in KEYMAPS.
3428 KEYMAPS can be either a keymap (meaning search in that keymap and the 3423 KEYMAPS can be either a keymap (meaning search in that keymap and the
3429 current global keymap) or a list of keymaps (meaning search in exactly 3424 current global keymap) or a list of keymaps (meaning search in exactly
3492 except that it writes its output into a (char *) buffer that you 3487 except that it writes its output into a (char *) buffer that you
3493 provide; it doesn't cons (or allocate memory) at all, so it's 3488 provide; it doesn't cons (or allocate memory) at all, so it's
3494 very fast. This is used by menubar.c. 3489 very fast. This is used by menubar.c.
3495 */ 3490 */
3496 void 3491 void
3497 where_is_to_char (Lisp_Object definition, char *buffer) 3492 where_is_to_char (Lisp_Object definition, Eistring *buffer)
3498 { 3493 {
3499 /* This function can GC */ 3494 /* This function can GC */
3500 Lisp_Object maps[100]; 3495 Lisp_Object maps[100];
3501 Lisp_Object *gubbish = maps; 3496 Lisp_Object *gubbish = maps;
3502 int nmaps; 3497 int nmaps;
3507 { 3502 {
3508 gubbish = alloca_array (Lisp_Object, nmaps); 3503 gubbish = alloca_array (Lisp_Object, nmaps);
3509 nmaps = get_relevant_keymaps (Qnil, nmaps, gubbish); 3504 nmaps = get_relevant_keymaps (Qnil, nmaps, gubbish);
3510 } 3505 }
3511 3506
3512 buffer[0] = 0;
3513 where_is_internal (definition, maps, nmaps, Qt, buffer); 3507 where_is_internal (definition, maps, nmaps, Qt, buffer);
3514 } 3508 }
3515 3509
3516 3510
3517 static Lisp_Object 3511 static Lisp_Object
3523 return result; 3517 return result;
3524 } 3518 }
3525 3519
3526 3520
3527 static void 3521 static void
3528 format_raw_keys (struct key_data *keys, int count, char *buf) 3522 format_raw_keys (struct key_data *keys, int count, Eistring *buf)
3529 { 3523 {
3530 int i; 3524 int i;
3531 Lisp_Event event; 3525 Lisp_Event event;
3532 event.event_type = key_press_event; 3526 event.event_type = key_press_event;
3533 event.channel = Vselected_console; 3527 event.channel = Vselected_console;
3534 for (i = 0; i < count; i++) 3528 for (i = 0; i < count; i++)
3535 { 3529 {
3536 event.event.key.keysym = keys[i].keysym; 3530 event.event.key.keysym = keys[i].keysym;
3537 event.event.key.modifiers = keys[i].modifiers; 3531 event.event.key.modifiers = keys[i].modifiers;
3538 format_event_object (buf, &event, 1); 3532 format_event_object (buf, &event, 1);
3539 buf += strlen (buf); 3533 if (i < count - 1)
3540 if (i < count-1) 3534 eicat_c (buf, " ");
3541 buf[0] = ' ', buf++;
3542 } 3535 }
3543 } 3536 }
3544 3537
3545 3538
3546 /* definition is the thing to look for. 3539 /* definition is the thing to look for.
3569 Lisp_Object *shadow; 3562 Lisp_Object *shadow;
3570 int shadow_count; 3563 int shadow_count;
3571 int firstonly; 3564 int firstonly;
3572 int keys_count; 3565 int keys_count;
3573 int modifiers_so_far; 3566 int modifiers_so_far;
3574 char *target_buffer; 3567 Eistring *target_buffer;
3575 struct key_data *keys_so_far; 3568 struct key_data *keys_so_far;
3576 int keys_so_far_total_size; 3569 int keys_so_far_total_size;
3577 int keys_so_far_malloced; 3570 int keys_so_far_malloced;
3578 }; 3571 };
3579 3572
3586 struct where_is_closure *c = (struct where_is_closure *) arg; 3579 struct where_is_closure *c = (struct where_is_closure *) arg;
3587 Lisp_Object definition = c->definition; 3580 Lisp_Object definition = c->definition;
3588 const int firstonly = c->firstonly; 3581 const int firstonly = c->firstonly;
3589 const int keys_count = c->keys_count; 3582 const int keys_count = c->keys_count;
3590 const int modifiers_so_far = c->modifiers_so_far; 3583 const int modifiers_so_far = c->modifiers_so_far;
3591 char *target_buffer = c->target_buffer; 3584 Eistring *target_buffer = c->target_buffer;
3592 Lisp_Object keys = Fgethash (definition, 3585 Lisp_Object keys = Fgethash (definition,
3593 XKEYMAP (map)->inverse_table, 3586 XKEYMAP (map)->inverse_table,
3594 Qnil); 3587 Qnil);
3595 Lisp_Object submaps; 3588 Lisp_Object submaps;
3596 Lisp_Object result = Qnil; 3589 Lisp_Object result = Qnil;
3734 } 3727 }
3735 3728
3736 3729
3737 static Lisp_Object 3730 static Lisp_Object
3738 where_is_internal (Lisp_Object definition, Lisp_Object *maps, int nmaps, 3731 where_is_internal (Lisp_Object definition, Lisp_Object *maps, int nmaps,
3739 Lisp_Object firstonly, char *target_buffer) 3732 Lisp_Object firstonly, Eistring *target_buffer)
3740 { 3733 {
3741 /* This function can GC */ 3734 /* This function can GC */
3742 Lisp_Object result = Qnil; 3735 Lisp_Object result = Qnil;
3743 int i; 3736 int i;
3744 struct key_data raw[20]; 3737 struct key_data raw[20];