[gnu.emacs] More about X emacs weirdness

cowan@soleil.sps.mot.com (02/06/90)

OK, thanks for letting me know that at least my version of
18.55 is probably correct given that my x-* completions are
correct and word counts look OK.  (Thanks to tale@turing, and
karney@CCC.)

Maybe I should have started with a description of what I'm trying to do
and ask why it isn't happening as I expected it to.

What I want to do is customize my key mappings under X windows
emacs 18.55 (compiled on a Sun4, being X-served to a Visual 
X-terminal).  From gray@lucid.com I got the clue to use the
x-rebind-keys function and put the following in my startup
(.emacs) file:

    (x-rebind-key "Right" "Control_L" "\ef") 
			; ctrl-right-arrow = forward word

The weirdness that provoked my first question is that I'm
getting this message when I startup:

	"Symbol's function definition is void: x-rebind-key"

Now, is that weird?  Or normal?  What's the problem?

-AC


 Andy Cowan
 cowan@soleil.sps.mot.com
 (602)821-4942

vasta@apollo.HP.COM (John Vasta) (02/08/90)

In article <2001@dover.sps.mot.com> cowan@soleil.sps.mot.com () writes:
>What I want to do is customize my key mappings under X windows
>emacs 18.55 (compiled on a Sun4, being X-served to a Visual 
>X-terminal).  From gray@lucid.com I got the clue to use the
>x-rebind-keys function and put the following in my startup
>(.emacs) file:
>
>    (x-rebind-key "Right" "Control_L" "\ef") 
>			; ctrl-right-arrow = forward word
>
>The weirdness that provoked my first question is that I'm
>getting this message when I startup:
>
>	"Symbol's function definition is void: x-rebind-key"
>
>Now, is that weird?  Or normal?  What's the problem?

It sounds like the Lucid folk may be using the x-rebind-key function
which was written by John Brezak at HP/Apollo. If you look in the x11fns.c
file, you'll see that the function is mainly commented out. I think that
all you need to do is replace it with this:

DEFUN ("x-rebind-key", Fx_rebind_key, Sx_rebind_key, 3, 3, 0,
  "Rebind KeySym, with ModifierSym, to new string NEWSTRING.\n\
KeySym and ModifierSym should be Strings representing the names of\n\
X keyboard keycap and modifier keycap name. If the ModifierSym is\n\
nill, then the KeySym's key will be bound to NEWSTRING for all modifier\n\
combinations.\n\
Common modifiers:\n\
     Shift_L Shift_R Control_L Control_R Meta\n")
  (keycode, keymodifier, newstring)
     register Lisp_Object keycode;
     register Lisp_Object keymodifier;
     register Lisp_Object newstring;
{
	char *rawstring;
	KeySym rawkey, rawmod[2];
	int mod_len = 0;
	int strsize;

        /*
         * Check args
         */
	CHECK_STRING (keycode, 1);
	if (!NULL (keymodifier))
		CHECK_STRING (keymodifier, 2);
	CHECK_STRING (newstring, 3);

        /*
         * Get newstring and sizeof it
         */
	strsize = XSTRING (newstring) ->size;
	rawstring = (char *) xmalloc (strsize);
	bcopy (XSTRING (newstring)->data, rawstring, strsize);

        /*
         * Translate key to keysym
         */
	rawkey = XStringToKeysym(XSTRING(keycode)->data);

        /*
         * Translate modifier to keysym
         */
        if (!NULL (keymodifier))
        {
                rawmod[0] = XStringToKeysym(XSTRING(keymodifier)->data);
                mod_len++;
        }
        
        if (rawkey != NoSymbol)
          XRebindKeysym (XXdisplay, rawkey, rawmod, mod_len, rawstring, strsize);
        else
          error("Keysym \"%s\" unknown", XSTRING(keycode)->data);

 	return Qnil;
}

John Vasta                Hewlett-Packard Apollo Systems Division
vasta@apollo.hp.com       M.S. CHA-01-LT
(508) 256-6600 x6362      300 Apollo Drive, Chelmsford, MA 01824
UUCP: {decwrl!decvax, mit-eddie, attunix}!apollo!vasta