jed-users mailing list

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

enable_menu_keys patch


Dear John and Jed Users,

the latest discussion about the brief mode on this list lead to my suggstion
of a new version of the enable_menu_keys() function in menus.sl. One that
only changes the minimum of bindings to let the user access the menus with
Alt-* hot-keys. This way, an emulations binding to e.g. Alt-M or F10 remains
untouched even if jed.rc contained

   require("brief");
   enable_menu_keys();
   
I put my version on the list for discussion in the hope of an eventual
inclusion in a future version of menus.sl.

Guenter



% A "non-invasive" version of enable_menu_keys()
% only Alt-* Hotkeys, no "invisible" bindings like Alt-M or F10.
% The binding of the generic "select_menubar" should be done by the
% emulation mode, e.g.
%
%   require("keydefs");
%   unset_setkey ("select_menubar", Key_F10);
%
% This version also honours the value of ALT_CHAR.
% 
% Under Win/DOS, if ALT_CHAR is 0 the string sent by Esc <key> differs
% from  the string sent by Alt-<key>. In this case, only Alt-<key> is
% rebound, leaving the emulation's bindings of Esc-<key> intact.


% duplicate from menus.sl to enable evaluation
private define unset_setkey (fun, key)
{
   unsetkey (key);
   setkey (fun, key);
}


%!%+
%\function{enable_menu_keys}
%\synopsis{}
%\usage{enable_menu_keys ()}
%\description
% Some emulations set keys that conflict with access to the menubars.  For
% example, emacs uses ESC-f to move by words.
% 
% \sfun{enable_menu_keys} re-binds the Alt-F ... Alt-H hot-keys to activate
% the menus. 
%\example
% Put (or uncomment) the line
%#v+
%  enable_menu_keys();
%#v-
% in your jed.rc file to let the menu hot-keys override the emulation
% bindings.
%\seealso{menu_select_menu, menu_load_popups}
%!%-
define enable_menu_keys ()
{
   variable fun = "menu_select_menu(\"Global.%s\")";
#ifdef IBMPC_SYSTEM
   if (ALT_CHAR == 0)
     {
	unset_setkey(sprintf(fun, "&File"),    "^@!");      %  Alt-F
	unset_setkey(sprintf(fun, "&Edit"),    "^@^R");     %  Alt-E
	unset_setkey(sprintf(fun, "M&ode"),    "^@^X");     %  Alt-O
	unset_setkey(sprintf(fun, "&Search"),  "^@^_");     %  Alt-S
	unset_setkey(sprintf(fun, "&Buffers"), "^@0");      %  Alt-B
	unset_setkey(sprintf(fun, "W&indows"), "^@^W");     %  Alt-I
	unset_setkey(sprintf(fun, "&Help"),    "^@^U");     %  Alt-Y
	unset_setkey(sprintf(fun, "S&ystem"),  "^@#");      %  Alt-H
	return;
     }
#endif
   unset_setkey(sprintf(fun, "&File"),    sprintf("%cf", ALT_CHAR));
   unset_setkey(sprintf(fun, "&Edit"),    sprintf("%ce", ALT_CHAR));
   unset_setkey(sprintf(fun, "M&ode"),    sprintf("%co", ALT_CHAR));
   unset_setkey(sprintf(fun, "&Search"),  sprintf("%cs", ALT_CHAR));
   unset_setkey(sprintf(fun, "&Buffers"), sprintf("%cb", ALT_CHAR));
   unset_setkey(sprintf(fun, "W&indows"), sprintf("%ci", ALT_CHAR));
   unset_setkey(sprintf(fun, "&Help"),    sprintf("%cy", ALT_CHAR));
   unset_setkey(sprintf(fun, "S&ystem"),  sprintf("%ch", ALT_CHAR));
}

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


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