jed-users mailing list

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

Re: How to discover prefix keysequences?


John E. Davis wrote:

The path that I would pursue would be to create an FLTK-specific
function that processes the Alt-XX keys and binds it to "\e<char>".
Then if the user rebinds, e.g., "\eA" to foo, foo will get called.  If
"\eA" is not rebound, your FLTK-specific function will get called.

This way if something is bound to "\eX" it can be invoked with
Alt-X, but if something is bound to "\eXY" it can only be invoked
by pressing ESC X Y.

If one really needs longer sequences bound beginning with Alt-X
one can:
  - crete a menu &Xmenu in the menubar, or
  - create a function that reads a character from the keyboard.

The function foo bound to Alt-X can display a minibuffer menu
from which the user can select further actions.

Example:

define menu_for_goto ()
{
   variable ch;
   ch = get_char ("Goto Line/Routine/Bookmark/regeXp/grepFile/Wordcount", "lrbxfw");
   switch (ch)
     {case 'l': goto_line_cmd (); }
     {case 'b': bkmrk_goto_mark (); }
     {case 'r': if (is_defined ("list_routines")) eval ("list_routines"); }
     {case 'x': if (is_defined ("occur")) eval ("occur"); }
     {case 'f': if (is_defined ("grep_text")) eval ("grep_text"); }
     {case 'w': if (is_defined ("grep_word_count")) eval ("grep_word_count"); }
}

setkey("menu_for_goto", "\eg");

--------------------------
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]