jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Keybindings


Marko Mahnic <marko.mahnic@xxxxxxxx> wrote:
>In C code I need to find out if a key is bound to sth.
>I used to use the function jed_get_key_function for the purpose,
>but in 99-17.111 it has disappeared from keymap.c (it used to be a
>static function in 99-17.95 and I made it public for fljed to
>correctly handle Alt-keys).

The function was removed as part of the cleanup when I added support
for Ref_Type objects to the setkey function.  For example, it is now
possible to do

   private define foo ()
   {
      insert ("foo");
   }
   setkey (&foo, "^Cf");

As a work-around, you can use something like:

   static int is_key_bound (char *keyseq)
   {
      int type;

      if (1 != SLang_run_hooks ("get_key_binding", 1, keyseq))
        return 0;
      /* Two values are returned: type and func. */
      if ((-1 == SLdo_pop ())
          || (-1 == SLang_pop_int (&type)))
	return 0;
	
      return (type != -1);
    }

--John

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]