Mercurial > hg > xemacs-beta
diff 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 |
line wrap: on
line diff
--- a/src/keymap.c Sat Mar 23 05:08:52 2002 +0000 +++ b/src/keymap.c Fri Mar 29 04:49:13 2002 +0000 @@ -2,7 +2,7 @@ Copyright (C) 1985, 1991-1995 Free Software Foundation, Inc. Copyright (C) 1995 Board of Trustees, University of Illinois. Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. Totally redesigned by jwz in 1991. This file is part of XEmacs. @@ -478,10 +478,10 @@ k = XKEYMAP (keymap); /* If the keysym is a one-character symbol, use the char code instead. */ - if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) + if (SYMBOLP (keysym) && XSTRING_CHAR_LENGTH (XSYMBOL (keysym)->name) == 1) { Lisp_Object i_fart_on_gcc = - make_char (string_char (XSYMBOL (keysym)->name, 0)); + make_char (XSTRING_CHAR (XSYMBOL (keysym)->name, 0)); keysym = i_fart_on_gcc; } @@ -656,8 +656,8 @@ | XEMACS_MOD_ALT | XEMACS_MOD_SHIFT)) == 0); /* If the keysym is a one-character symbol, use the char code instead. */ - if (SYMBOLP (keysym) && string_char_length (XSYMBOL (keysym)->name) == 1) - keysym = make_char (string_char (XSYMBOL (keysym)->name, 0)); + if (SYMBOLP (keysym) && XSTRING_CHAR_LENGTH (XSYMBOL (keysym)->name) == 1) + keysym = make_char (XSTRING_CHAR (XSYMBOL (keysym)->name, 0)); if (modifiers & XEMACS_MOD_META) /* Utterly hateful ESC lossage */ { @@ -759,7 +759,7 @@ Lisp_Object result; Lisp_Keymap *keymap = alloc_lcrecord_type (Lisp_Keymap, &lrecord_keymap); - XSETKEYMAP (result, keymap); + result = wrap_keymap (keymap); keymap->parents = Qnil; keymap->prompt = Qnil; @@ -1264,10 +1264,10 @@ /* Now, check and massage the trailing keysym specifier. */ if (SYMBOLP (*keysym)) { - if (string_char_length (XSYMBOL (*keysym)->name) == 1) + if (XSTRING_CHAR_LENGTH (XSYMBOL (*keysym)->name) == 1) { Lisp_Object ream_gcc_up_the_ass = - make_char (string_char (XSYMBOL (*keysym)->name, 0)); + make_char (XSTRING_CHAR (XSYMBOL (*keysym)->name, 0)); *keysym = ream_gcc_up_the_ass; goto fixnum_keysym; } @@ -1294,7 +1294,7 @@ if (SYMBOLP (*keysym)) { - char *name = (char *) string_data (XSYMBOL (*keysym)->name); + Intbyte *name = XSTRING_DATA (XSYMBOL (*keysym)->name); /* FSFmacs uses symbols with the printed representation of keysyms in their names, like 'M-x, and we use the syntax '(meta x). So, to avoid @@ -1310,7 +1310,7 @@ sanitize the Sun keyboards, and would make it trickier to conditionalize a .emacs file for multiple X servers. */ - if (((int) strlen (name) >= 2 && name[1] == '-') + if (((int) qxestrlen (name) >= 2 && name[1] == '-') #if 1 || /* Ok, this is a bit more dubious - prevent people from doing things @@ -1318,14 +1318,14 @@ same problem as above. (Gag!) Maybe we should just silently accept these as aliases for the "real" names? */ - (string_length (XSYMBOL (*keysym)->name) <= 3 && - (!strcmp (name, "LFD") || - !strcmp (name, "TAB") || - !strcmp (name, "RET") || - !strcmp (name, "ESC") || - !strcmp (name, "DEL") || - !strcmp (name, "SPC") || - !strcmp (name, "BS"))) + (XSTRING_LENGTH (XSYMBOL (*keysym)->name) <= 3 && + (!qxestrcmp_c (name, "LFD") || + !qxestrcmp_c (name, "TAB") || + !qxestrcmp_c (name, "RET") || + !qxestrcmp_c (name, "ESC") || + !qxestrcmp_c (name, "DEL") || + !qxestrcmp_c (name, "SPC") || + !qxestrcmp_c (name, "BS"))) #endif /* unused */ ) invalid_argument @@ -1337,17 +1337,15 @@ otherwise have the same problem as above. (Gag!) We silently accept these as aliases for the "real" names. */ - else if (!strncmp(name, "kp_", 3)) { - /* Likewise, the obsolete keysym binding of kp_.* should not lose. */ - char temp[50]; - - strncpy(temp, name, sizeof (temp)); - temp[sizeof (temp) - 1] = '\0'; - temp[2] = '-'; - *keysym = Fintern_soft(make_string((Intbyte *)temp, - strlen(temp)), - Qnil); - } else if (EQ (*keysym, QLFD)) + else if (!qxestrncmp_c (name, "kp_", 3)) + { + /* Likewise, the obsolete keysym binding of kp_.* should not lose. */ + DECLARE_EISTRING (temp); + eicpy_raw (temp, name, qxestrlen (name)); + eisetch_char (temp, 2, '-'); + *keysym = Fintern_soft (eimake_string (temp), Qnil); + } + else if (EQ (*keysym, QLFD)) *keysym = QKlinefeed; else if (EQ (*keysym, QTAB)) *keysym = QKtab; @@ -1525,7 +1523,7 @@ fn = Qcall_interactively; else fn = Qeval; - XSETFRAME (XEVENT (event)->channel, selected_frame ()); + XEVENT (event)->channel = wrap_frame (selected_frame ()); XEVENT (event)->event_type = misc_user_event; XEVENT (event)->event.eval.function = fn; XEVENT (event)->event.eval.object = arg; @@ -1904,7 +1902,7 @@ struct key_data raw_key2; if (STRINGP (keys)) - c = make_char (string_char (XSTRING (keys), idx)); + c = make_char (XSTRING_CHAR (keys, idx)); else c = XVECTOR_DATA (keys) [idx]; @@ -2230,7 +2228,7 @@ for (i = 0; i < length; i++) { - Emchar n = string_char (XSTRING (keys), i); + Emchar n = XSTRING_CHAR (keys, i); define_key_parser (make_char (n), &(raw_keys[i])); } return raw_lookup_key (keymap, raw_keys, length, 0, @@ -2331,8 +2329,8 @@ || (XEVENT (terminal)->event_type != button_press_event && XEVENT (terminal)->event_type != button_release_event)) { - Lisp_Object tem; - XSETBUFFER (tem, current_buffer); + Lisp_Object tem = wrap_buffer (current_buffer); + /* It's not a mouse event; order of keymaps searched is: o keymap of any/all extents under the mouse o minor-mode maps @@ -2502,8 +2500,7 @@ Lisp_Object val = symbol_value_in_buffer (sym, buffer); if (!NILP (val) && !UNBOUNDP (val)) { - Lisp_Object map = get_keymap (XCDR (assoc), 0, 1); - return map; + return get_keymap (XCDR (assoc), 0, 1); } } } @@ -2928,9 +2925,9 @@ /* otherwise, string-sort them. */ { - char *s1 = (char *) string_data (XSYMBOL (obj1)->name); - char *s2 = (char *) string_data (XSYMBOL (obj2)->name); - return 0 > strcmp (s1, s2) ? 1 : -1; + Intbyte *s1 = XSTRING_DATA (XSYMBOL (obj1)->name); + Intbyte *s2 = XSTRING_DATA (XSYMBOL (obj2)->name); + return 0 > qxestrcmp (s1, s2) ? 1 : -1; } } @@ -3246,7 +3243,7 @@ { Lisp_Object s2 = Fsingle_key_description (STRINGP (keys) - ? make_char (string_char (XSTRING (keys), i)) + ? make_char (XSTRING_CHAR (keys, i)) : XVECTOR_DATA (keys)[i]); if (i == 0) @@ -3275,7 +3272,9 @@ if (EVENTP (key) || CHAR_OR_CHAR_INTP (key)) { - char buf [255]; + DECLARE_EISTRING_MALLOC (buf); + Lisp_Object str; + if (!EVENTP (key)) { Lisp_Event event; @@ -3287,51 +3286,47 @@ } else format_event_object (buf, XEVENT (key), 1); - return build_string (buf); + str = eimake_string (buf); + eifree (buf); + return str; } if (CONSP (key)) { - char buf[255]; - char *bufp = buf; + DECLARE_EISTRING (bufp); + Lisp_Object rest; - buf[0] = 0; LIST_LOOP (rest, key) { Lisp_Object keysym = XCAR (rest); - if (EQ (keysym, Qcontrol)) strcpy (bufp, "C-"), bufp += 2; - else if (EQ (keysym, Qctrl)) strcpy (bufp, "C-"), bufp += 2; - else if (EQ (keysym, Qmeta)) strcpy (bufp, "M-"), bufp += 2; - else if (EQ (keysym, Qsuper)) strcpy (bufp, "S-"), bufp += 2; - else if (EQ (keysym, Qhyper)) strcpy (bufp, "H-"), bufp += 2; - else if (EQ (keysym, Qalt)) strcpy (bufp, "A-"), bufp += 2; - else if (EQ (keysym, Qshift)) strcpy (bufp, "Sh-"), bufp += 3; + if (EQ (keysym, Qcontrol)) eicat_c (bufp, "C-"); + else if (EQ (keysym, Qctrl)) eicat_c (bufp, "C-"); + else if (EQ (keysym, Qmeta)) eicat_c (bufp, "M-"); + else if (EQ (keysym, Qsuper)) eicat_c (bufp, "S-"); + else if (EQ (keysym, Qhyper)) eicat_c (bufp, "H-"); + else if (EQ (keysym, Qalt)) eicat_c (bufp, "A-"); + else if (EQ (keysym, Qshift)) eicat_c (bufp, "Sh-"); else if (CHAR_OR_CHAR_INTP (keysym)) - { - bufp += set_charptr_emchar ((Intbyte *) bufp, - XCHAR_OR_CHAR_INT (keysym)); - *bufp = 0; - } + eicat_ch (bufp, XCHAR_OR_CHAR_INT (keysym)); else { CHECK_SYMBOL (keysym); #if 0 /* This is bogus */ - if (EQ (keysym, QKlinefeed)) strcpy (bufp, "LFD"); - else if (EQ (keysym, QKtab)) strcpy (bufp, "TAB"); - else if (EQ (keysym, QKreturn)) strcpy (bufp, "RET"); - else if (EQ (keysym, QKescape)) strcpy (bufp, "ESC"); - else if (EQ (keysym, QKdelete)) strcpy (bufp, "DEL"); - else if (EQ (keysym, QKspace)) strcpy (bufp, "SPC"); - else if (EQ (keysym, QKbackspace)) strcpy (bufp, "BS"); + if (EQ (keysym, QKlinefeed)) eicat_c (bufp, "LFD"); + else if (EQ (keysym, QKtab)) eicat_c (bufp, "TAB"); + else if (EQ (keysym, QKreturn)) eicat_c (bufp, "RET"); + else if (EQ (keysym, QKescape)) eicat_c (bufp, "ESC"); + else if (EQ (keysym, QKdelete)) eicat_c (bufp, "DEL"); + else if (EQ (keysym, QKspace)) eicat_c (bufp, "SPC"); + else if (EQ (keysym, QKbackspace)) eicat_c (bufp, "BS"); else #endif - strcpy (bufp, (char *) string_data (XSYMBOL (keysym)->name)); + eicat_lstr (bufp, XSYMBOL (keysym)->name); if (!NILP (XCDR (rest))) - invalid_argument ("Invalid key description", - key); + invalid_argument ("Invalid key description", key); } } - return build_string (buf); + return eimake_string (bufp); } return Fsingle_key_description (wrong_type_argument (intern ("char-or-event-p"), key)); @@ -3421,7 +3416,7 @@ static Lisp_Object where_is_internal (Lisp_Object definition, Lisp_Object *maps, int nmaps, - Lisp_Object firstonly, char *target_buffer); + Lisp_Object firstonly, Eistring *target_buffer); DEFUN ("where-is-internal", Fwhere_is_internal, 1, 5, 0, /* Return list of keys that invoke DEFINITION in KEYMAPS. @@ -3494,7 +3489,7 @@ very fast. This is used by menubar.c. */ void -where_is_to_char (Lisp_Object definition, char *buffer) +where_is_to_char (Lisp_Object definition, Eistring *buffer) { /* This function can GC */ Lisp_Object maps[100]; @@ -3509,7 +3504,6 @@ nmaps = get_relevant_keymaps (Qnil, nmaps, gubbish); } - buffer[0] = 0; where_is_internal (definition, maps, nmaps, Qt, buffer); } @@ -3525,7 +3519,7 @@ static void -format_raw_keys (struct key_data *keys, int count, char *buf) +format_raw_keys (struct key_data *keys, int count, Eistring *buf) { int i; Lisp_Event event; @@ -3536,9 +3530,8 @@ event.event.key.keysym = keys[i].keysym; event.event.key.modifiers = keys[i].modifiers; format_event_object (buf, &event, 1); - buf += strlen (buf); - if (i < count-1) - buf[0] = ' ', buf++; + if (i < count - 1) + eicat_c (buf, " "); } } @@ -3571,7 +3564,7 @@ int firstonly; int keys_count; int modifiers_so_far; - char *target_buffer; + Eistring *target_buffer; struct key_data *keys_so_far; int keys_so_far_total_size; int keys_so_far_malloced; @@ -3588,7 +3581,7 @@ const int firstonly = c->firstonly; const int keys_count = c->keys_count; const int modifiers_so_far = c->modifiers_so_far; - char *target_buffer = c->target_buffer; + Eistring *target_buffer = c->target_buffer; Lisp_Object keys = Fgethash (definition, XKEYMAP (map)->inverse_table, Qnil); @@ -3736,7 +3729,7 @@ static Lisp_Object where_is_internal (Lisp_Object definition, Lisp_Object *maps, int nmaps, - Lisp_Object firstonly, char *target_buffer) + Lisp_Object firstonly, Eistring *target_buffer) { /* This function can GC */ Lisp_Object result = Qnil;