/usr/share/jed/lib/menu.sl is in jed-common 1:0.99.19-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | % This File is OBSOLETE
%
% Example of menus for JED. This is designed to aid in learning
% the editor since after a menu item has been chosen, the user is
% informed of the keybinding of the function.
%
enable_top_status_line (1);
if (TOP_WINDOW_ROW == 1) error ("Menu bar has been disabled. It must be present to use the menus.");
define menu_build_display_string (list)
{
variable i = 0, cmd, s = Null_String;
forever
{
cmd = extract_element (list, i, ',');
if (cmd == NULL) break;
if (i) s += ", ";
s = sprintf("%s(%d)%s", s, i, cmd);
++i;
}
s;
}
define menu_list_length (list)
{
variable i = 0;
i - 1;
}
variable Menu_Last_Cmd;
variable Menu_Abort; Menu_Abort = 0;
define menu_select_cmd (s_list, cmd_list)
{
variable cmd, i, s, n;
i = 0;
n = 0;
while (NULL != extract_element(cmd_list, n, ',')) n++;
n--;
s = strcat ("Menu: ", menu_build_display_string(s_list));
do
{
Menu_Abort = 0;
forever
{
message ("Pick a number or press Ctrl-G to abort or SPACE to go back to previous level.");
set_top_status_line (s); pop (); update_sans_update_hook(1);
i = getkey();
if (i == 7) call ("kbd_quit");
if (i == ' ')
{
Menu_Abort = 1;
return;
}
i -= '0';
if ((i >= 0) and (i <= n)) break;
beep();
flush_input();
% flush("Pick a number or press Ctrl-G to abort or SPACE to go back.");
% pop(input_pending(20));
}
cmd = extract_element(cmd_list, i, ',');
if (cmd [0] == '@')
{
Menu_Last_Cmd = substr(cmd, 2, strlen(cmd));
call (Menu_Last_Cmd);
}
else
{
Menu_Last_Cmd = cmd;
eval(strcat (".", cmd)); % Use RPN--- no need to parse it
}
}
while(Menu_Abort);
}
define menu_window_cmds ()
{
menu_select_cmd ("One window,Split Window,Other Window,Del Window,Redraw",
"@one_window,@split_window,@other_window,@delete_window,@redraw");
}
define search_replace ()
{
menu_select_cmd ("Search Forward,Search Backward,Replace",
"search_forward,search_backward,replace_cmd");
}
define menu_deletion_cmd ()
{
menu_select_cmd ("Delete Char,Delete Word",
"del,delete_word");
}
define menu_cut_paste ()
{
menu_select_cmd ("Deleting,Begin Region,Cut Region,Copy Region,Paste",
"menu_deletion_cmd,@set_mark_cmd,@kill_region,@copy_region,@yank");
}
define menu_movement ()
{
menu_select_cmd ("Page Up,Page Down,Top,Bottom,Page Left,Page Right",
"@page_up,@page_down,@beg_of_buffer,@end_of_buffer,@scroll_right,@scroll_left");
}
define menu_buffer_modes ()
{
menu_select_cmd ("C-Mode,Text-Mode,No-Mode,Fortran-Mode",
"c_mode,text_mode,no_mode,fortran");
}
define menu_basics ()
{
menu_select_cmd ("Search/Replace,Movement,Cut/Paste,Undo,Formatting",
"search_replace,menu_movement,menu_cut_paste,@undo,@format_paragraph");
}
define menu_buffers ()
{
menu_select_cmd ("Kill Buffer,Switch To Buffer,List Buffers,Set buffer modes",
"@kill_buffer,@switch_to_buffer,list_buffers,menu_buffer_modes");
}
define menu_files ()
{
menu_select_cmd ("Open File,Save to File,Save Buffers,Insert File",
"@find_file,@write_buffer,@save_some_buffers,@insert_file");
}
define menu_help ()
{
menu_select_cmd ("Pop up help,Browse Documentation,Show Key,Where is Command",
"help,info_reader,showkey,where_is");
}
define menu_misc ()
{
#ifdef UNIX VMS
menu_select_cmd ("compose mail,send mail,ispell,shell command,suspend",
"mail,mail_send,ispell,do_shell_cmd,@sys_spawn_cmd");
#else
menu_select_cmd ("Shell command,Suspend",
"do_shell_cmd,@sys_spawn_cmd");
#endif
}
define menu_main_cmds ()
{
variable n, key, len, next, nlen;
try
{
menu_select_cmd ("File,Edit,Buffers,Windows,Help,Misc,Exit",
"menu_files,menu_basics,menu_buffers,menu_window_cmds,menu_help,menu_misc,@exit_jed");
}
finally
() = set_top_status_line (Global_Top_Status_Line);
%
% Show user keybinding of the function.
% The problem with this is that any function which leaves a message
% in the message buffer, the message will be destroyed. Here I
% update screen and sleep for a second before continuing. Menus are
% intrinsically inefficient anyway.
%
if (strlen(MESSAGE_BUFFER))
{
update_sans_update_hook (0);
() = input_pending(20);
}
if (Menu_Abort)
{
return;
}
if (n = which_key (Menu_Last_Cmd), n)
{
key = (); n--;
len = strlen (key);
loop (n)
{
next = ();
nlen = strlen (next);
if (nlen < len)
{
len = nlen;
key = next;
}
}
sprintf ("%s is on key %s", Menu_Last_Cmd, expand_keystring (key));
}
else strcat (Menu_Last_Cmd, " is not on any keys.");
message (());
}
|