IDE Mode for Jed
-----------------

By Guido Gonzato  <guido@ibogfs.cineca.it>
Version 1.0.0; January 4, 1998
I put IDE Mode for Jed under GPL. Please read the accompanying file COPYING.


Introduction
-------------

IDE Mode for Jed is, clearly enough, a mode for the editor Jed. It aims at
making Jed behave like Borland IDE as closely as possible. That means that
if you have experience with any of the Turbo or Borland languages, or the
old DOS editor, or even the ancestor WordStar, you will feel immediately at
home with Jed. 

I wrote IDE Mode because a lot of time ago, back in early Holocene, I used
WordStar under CP/M, and its key bindings are now etched in my DNA. I just
can't help it.

IDE mode inherits some old routines written by Stuart Herbert for Jed
0.F96.*, and John E. Davis' original wordstar.sl. It works with Jed 0.F97.14
upwards under Linux (both console and X11) and DOS.


Installation
-------------

To install and use IDE Mode, all you have to do is copy the files ide.sl and
ide.hlp to $JED_ROOT/lib. Under Linux, this directory will typically be
/usr/lib/jed/lib, but check out first.

Then include this line in your .jedrc:

  () = evalfile("ide");

Make sure that all references to emacs.sl, edt.sl, brief.sl, and wordstar.sl
in your .jedrc are commented out.


Main Features
--------------

In writing ide.sl, I tried hard to implement as many of the Borland key
bindings and routines as possible. To begin with, all special keys (function
keys, movement keys, etc) are supported. That is, you can use F3 to load a
file, F9 to compile, F10 to invoke the menu, and so on. Some key bindings
were inspired by Jstar, the WordStar compatibility mode of the editor Joe.

ALT-something key bindings are supported. ESC-something is equivalent.

After any movement you can go back to the previous location with Ctrl-Q-P.

Press F1, then `d' to get help.

I dropped in a nice comment/uncomment block feature that works with TeX,
HTML, C, SLang, SH, and Fortran text files.

There could be many more things to say. I believe that the following list,
taken from ide.sl, is the best explanation:

%
% Basic commands: cursor movement, delete, search & replace, etc.
%
setkey ("begin_macro", "\e(");
setkey ("compile", Key_F9);
setkey ("delete_char_cmd", "^G");
setkey ("delete_line","^Y");
setkey ("end_macro", "\e)");
setkey ("execute_macro", "\em");
setkey ("format_paragraph", "^B");
setkey ("toggle_overwrite", "^V");
setkey ("undo", "^U");
setkey ("ide_bdelete_word", Key_Alt_BS);
setkey ("ide_bdelete_word", "\eo");
setkey ("ide_bskip_word", "^A");
setkey ("ide_delete_word", "^T");
setkey ("ide_insert_last_block", "^P");
setkey ("ide_next_char_cmd", "^D");
setkey ("ide_next_char_cmd", Key_ArRight);
setkey ("ide_next_line_cmd", "^X"); % this BREAKS cmode's ^X; But who cares?
setkey ("ide_next_line_cmd", Key_ArDown);
setkey ("ide_page_down", "^C");
setkey ("ide_page_down", Key_PgDown);
setkey ("ide_page_up", "^R");
setkey ("ide_page_up", Key_PgUp);
setkey ("ide_previous_char_cmd", "^S");
setkey ("ide_previous_char_cmd", Key_ArLeft);
setkey ("ide_previous_line_cmd", "^E");
setkey ("ide_previous_line_cmd", Key_ArUp);
setkey ("ide_repeat_search", "^L");
setkey ("ide_skip_word", "^F");
setkey ("ide_window_down", "^Z");
setkey ("ide_window_up", "^W");
%
% Borland-style commands
%
setkey ("compile", Key_Alt_C);		% ALT-C
setkey ("IDE_buffer_menu", Key_Alt_B);	% ALT-B
setkey ("IDE_edit_menu", Key_Alt_E);	% ALT-E
setkey ("IDE_file_menu", Key_Alt_F);	% ALT-F
setkey ("IDE_menu", Key_F10);		% F10
% setkey ("IDE_mode_menu", Key_Alt_M);	% ALT-M
setkey ("IDE_search_menu", Key_Alt_S);	% ALT-S
setkey ("IDE_system_menu", Key_Alt_Y);	% ALT-Y
setkey ("IDE_window_menu", Key_Alt_W);	% ALT-W
setkey ("ide_help", Key_F1);
setkey ("ide_help", Key_Alt_H);		% ALT-H
%
% Control-Q keys  --- hope you figure out how to pass ^Q/^S through system
% In case you *cannot* figure out how, you can use ESC+^key instead of ^Q; 
% for instance, ESC-^Y acts as ^Q-Y.
% This makes ide.sl usable on non-Linux or non-DOS terminals - namely,
% vt100 and compatibles.
%
setkey (".0 ide_goto_mark_n", "^Q0");
setkey (".1 ide_goto_mark_n", "^Q1");
setkey (".2 ide_goto_mark_n", "^Q2");
setkey (".3 ide_goto_mark_n", "^Q3");
setkey (".4 ide_goto_mark_n", "^Q4");
setkey (".5 ide_goto_mark_n", "^Q5");
setkey (".6 ide_goto_mark_n", "^Q6");
setkey (".7 ide_goto_mark_n", "^Q7");
setkey (".8 ide_goto_mark_n", "^Q8");
setkey (".9 ide_goto_mark_n", "^Q9");
#ifndef MSDOS
setkey (".0 ide_goto_mark_n", "\e0");
setkey (".1 ide_goto_mark_n", "\e1");
setkey (".2 ide_goto_mark_n", "\e2");
setkey (".3 ide_goto_mark_n", "\e3");
setkey (".4 ide_goto_mark_n", "\e4");
setkey (".5 ide_goto_mark_n", "\e5");
setkey (".6 ide_goto_mark_n", "\e6");
setkey (".7 ide_goto_mark_n", "\e7");
setkey (".8 ide_goto_mark_n", "\e8");
setkey (".9 ide_goto_mark_n", "\e9");
#endif
setkey ("kill_line", "^QY");
setkey ("kill_line", "^Q^Y");
setkey ("ide_bob", "^QR");
setkey ("ide_bob", "^Q^R");
setkey ("ide_bol", "^QS");
setkey ("ide_bol", "^Q^S");
setkey ("ide_bol", Key_Home);
setkey ("ide_eob", "^QC");
setkey ("ide_eob", "^Q^C");
setkey ("ide_eol", "^QD");
setkey ("ide_eol", "^Q^D");
setkey ("ide_eol", Key_End);
setkey ("ide_goto_begin_block", "^QB");
setkey ("ide_goto_begin_block", "^Q^B");
setkey ("ide_goto_bottom_of_window", "^QX");
setkey ("ide_goto_bottom_of_window", "^Q^X");
setkey ("ide_goto_end_block", "^QK");
setkey ("ide_goto_end_block", "^Q^K");
setkey ("ide_goto_line_cmd", "^QI");
setkey ("ide_goto_line_cmd", "^Q^I");
setkey ("ide_goto_prev", "^QP");
setkey ("ide_goto_top_of_window", "^QE");
setkey ("ide_goto_top_of_window", "^Q^E");
setkey ("ide_replace_cmd", "^QA");
setkey ("ide_replace_cmd", "^Q^A");
setkey ("ide_search_forward", "^QF");
setkey ("ide_search_forward", "^Q^F");
setkey ("ide_toggle_case", "^QT");
setkey ("ide_toggle_case", "^Q^T");
#ifndef MSDOS
setkey ("kill_line", "\e^Y");
setkey ("ide_bob", "\e^R");
setkey ("ide_bol", "\e^S");
setkey ("ide_eob", "\e^C");
setkey ("ide_eol", "\e^D");
setkey ("ide_goto_begin_block", "\e^B");	% doesn't make much sense
setkey ("ide_goto_bottom_of_window", "\e^X");
setkey ("ide_goto_end_block", "\e^K");		% ditto
setkey ("ide_goto_line_cmd", "\e^I");
setkey ("ide_goto_prev", "\e^P");
setkey ("ide_goto_top_of_window", "\e^E");
setkey ("ide_replace_cmd", "\e^A");
setkey ("ide_search_forward", "\e^F");
setkey ("ide_toggle_case", "\e^T");
#endif
%
% Control-K map
%
setkey (".0 ide_set_mark_n", "^K0");
setkey (".1 ide_set_mark_n", "^K1");
setkey (".2 ide_set_mark_n", "^K2");
setkey (".3 ide_set_mark_n", "^K3");
setkey (".4 ide_set_mark_n", "^K4");
setkey (".5 ide_set_mark_n", "^K5");
setkey (".6 ide_set_mark_n", "^K6");
setkey (".7 ide_set_mark_n", "^K7");
setkey (".8 ide_set_mark_n", "^K8");
setkey (".9 ide_set_mark_n", "^K9");
setkey ("exit_jed", "^KX");
setkey ("exit_jed", "^K^X");
setkey ("open_file", "^KE");
setkey ("open_file", "^K^E");
setkey ("open_file", Key_F3);
setkey ("kill_buffer", "^KQ");
setkey ("kill_buffer", "^K^Q");
setkey ("kill_buffer", Key_Alt_F3);
setkey ("one_window", "^KI");
setkey ("one_window", "^K^I");
setkey ("one_window", Key_F5);
setkey ("save_buffer", "^KD");
setkey ("save_buffer", "^K^D");
setkey ("save_buffer", Key_F2);
setkey ("suspend", "^KZ");
setkey ("suspend", "^K^Z");
setkey ("switch_to_buffer", "^KP");
setkey ("switch_to_buffer", "^K^P");
setkey ("switch_to_buffer", Key_F6);
setkey ("ide_begin_block", "^KB");	% set mark
setkey ("ide_begin_block", "^K^B");
setkey ("ide_comment_block", "^K;");	% I like this one
setkey ("ide_copy_block", "^KC");	% yank
setkey ("ide_copy_block", "^K^C");
setkey ("ide_delete_block", "^KY");	% kill region
setkey ("ide_delete_block", "^K^Y");
setkey ("ide_end_block", "^KK");	% exchange point and mark
setkey ("ide_end_block", "^K^K");
setkey ("ide_filter_region", "^K/");
setkey ("ide_insert_file", "^KR");
setkey ("ide_insert_file", "^K^R");
setkey ("ide_lowercase_region", "^KL");
setkey ("ide_lowercase_region", "^K^L");
% setkey ("ide_move_block", "^KV");	% no longer implemented
% setkey ("ide_move_block", "^K^V");
setkey ("ide_save_buffer", "^KS");
setkey ("ide_save_buffer", "^K^S");
setkey ("ide_select_word", "^KT");
setkey ("ide_select_word", "^K^T");
setkey ("ide_clear_block", "^KH");	% clear but copy to clipboard
setkey ("ide_clear_block", "^K^H");
setkey ("ide_uncomment_block", "^K:");
setkey ("ide_uppercase_region", "^KU");
setkey ("ide_uppercase_region", "^K^U");
setkey ("ide_write_region", "^KW");
setkey ("ide_write_region", "^K^W");


Known Differences
------------------

Some key bindings/actions couldn't be fully implemented. The miss-list
includes:

- ALT-F3 doesn't close the current buffer, as this key binding is employed
to switch to the third virtual console in Linux. Use ESC-F3;

- The blocks are implemented with the usual key bindings, but behave
differently. In fact, the blocks are handled as in Emacs mode to provide
compatibility with many other .sl files: you don't actually use a block, but
define a region.

- Can you think of any? If so, please get in touch with me and I'll try and
see to it.


If You Don't Like It
---------------------

Although I believe that IDE mode makes Jed not only the best Emacs
emulation, but also one of the finest Borland IDE clones, there are
alternatives. Probably the best is Robert H\"ohne rhide, a very close clone
of Borland C++ 3.x IDE with integrated debugging. Its editor is less
advanced than Jed, but it's a very fine piece of software nonetheless.
You'll find on 

ftp://sunsite.unc.edu/pub/Linux/devel/debuggers/rhide-1.X-Y.i386.rpm

where X and Y depend on the version.


Final Remarks
--------------

I use IDE Mode every day and I'm very satisfied with it. I hope I have done
something useful for other people too.

Cheers,
	Guido =8-)



Guido Gonzato  <guido@ibogfs.cineca.it>  - Linux sysadm & LDP Author
Universita' di Bologna (Italy), Dip. di Fisica, Settore di Geofisica 
Viale Berti Pichat 8, 40127 Bologna (Italy) - Fax +39 51 6305058










