home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
jed098-4.zip
/
JED
/
DOC
/
JED_FAQ.TXT
< prev
next >
Wrap
Text File
|
1997-02-01
|
15KB
|
400 lines
Frequently Asked Questions about the JED editor.
To find the answer to one of the following questions, Search for the number
enclosed in <>, e.g., <3> for question 3.
----------------------------------------------------------------------------
Frequently asked questions:
1. How do I obtain JED? (ftp and email)
2. How do I disable JED's C mode.
3. What is C mode?
4. How do I turn on wrap mode or turn it off?
5. What are the differences between internal and intrinsic functions?
6. Sometimes during screen updates, JED pauses. Why is this?
7. How do I get JED to recognize Control-S and Control-Q?
8. Can I bind the Alt keys on the PC?
9. How do I find out what characters a particular key generates.
10. JED scrolls slow on my WizBang-X-Super-Terminal. What can I do about it?
11. How do I get a list of functions?
12. How can I use edt.sl with jed386.exe?
----------------------------------------------------------------------------
Answers:
<1> How do I obtain JED? (ftp and email)
JED is available via anonymous ftp from space.mit.edu in the pub/davis/jed
directory. JED comes in three forms:
jedxxx.tar.Z unix distribution for version xxx
jedxxx.*_of_n n part VMS share distribution for xxx
jedxxx.zip PC distribution with precompiled jed.exe
All distributions are identical except that the zip file also contains a
precompiled executable for PC systems.
JED may also be obtained by email for those without ftp access. To learn
about how to ftp using email, send email to ftpmail@pa.dec.com with the
single line `help'. A message will be returned with instructions.
For those on BITNET, particularly with VMS systems, Hunter Goatley has
made JED available via email:
To get JED via e-mail, send the following commands in the body
of a mail message to FILESERV@WKUVX1.BITNET:
SEND JED090
SEND FILESERV_TOOLS !Only needed if you don't have UNZIP and MFTU
You can also get it via anonymous ftp from ftp.spc.edu in
[.MACRO32.SAVESETS]JED090.ZIP.
This distribution includes VMS .OBJs and a .EXE file that was
linked under VMS V5.1. [Note that although this distribution
is intended for VMS systems, it includes makefiles and sources
for unix as well. However, you will need to get unzip for
your unix system. --John]
<2> How do I disable JED's C mode.
The startup file `site.sl' contains the function `mode_hook' which is
called whenever a file is loaded. This function is passed the filename
extension. If a file with `c' or `h' extension is read, this function
will turn on C-mode for that buffer. You could modify this function to
not select C-mode. However, this is not recommended. Rather, it is
recommended that you simply rebind the offending keybinding. These
include: `{`, `}`, the TAB key, and the RETURN key.
Simply put any or all of:
"self_insert_cmd" "{" setkey
"self_insert_cmd" "}" setkey
"self_insert_cmd" "^I" setkey
"newline" "^M" setkey
in your personal startup file (jed.rc or .jedrc).
Before you do this, are you sure that you really understand what C mode
does? If not, please read on.
<3> What is C mode?
In C mode, the TAB key does not insert tabs. Instead, it runs a command
called `indent_line'. It is really the quickest way to edit C code. In
this mode, the TAB, RETURN, `{`, and `}' keys are special.
If you edit a file called x.c, JED will invoke its C mode. Entering the
28 characters (no newline, TAB, etc...)
`main (){if (x == 2){x = 4;}}'
should result in:
main () {
if (x == 2) {
x = 4;
}
}
which would take alot more time using the TAB and NEWLINE keys. If you
do not like the indentation style, you can customize it by setting the
appropriate variables in jed.rc. My preference is to set the variables
such that the SAME characters above yield:
main ()
{
if (x == 2)
{
x = 4;
}
}
To see the use of the tab key, delete the whitespace in front of all the
lines to produce:
main () {
if (x == 2) {
x = 4;
}
}
Now, move to any of the lines (anywhere on the line) and hit the TAB key.
This should correctly indent the line to according to your preferences
(i.e., the variables in jed.rc).
Finally, move to one of the lines and enter `ESC ;'. This should produce
a C comment.
Using the C mode and the TAB key as indent_line also helps you avoid
syntax errors. Basically, a line simply will not indent properly. This
indicats that you left off a brace, mismatched parenthesis, etc... If
you bind TAB away from indent_line, you lose some of this.
Note that these same comments apply to Fortran mode. Get a file called
`x.for'. Enter the characters:
TABprogram mainRETinteger*4 iRETdo 10 i=1,3RETcall f(i)RET10continueRETend
Here TAB means hit TAB and RET means hit return. This will result in:
program main
integer*4 i
do 10 i=1,3
call f(i)
10 continue
end
Again, the editor has done all the work. Once you get used to this style
of editing, you will not want to go back.
Also note that this will not work if EDT is loaded. To get this
functionality back, you will need to do:
setkey("indent_line_cmd", "\t");
setkey("newline_and_indent_cmd", "^M");
AFTER edt.sl is loaded.
<4> How do I turn on wrap mode or turn it off?
Normally, this is done automatically when JED loads a file with extensions
.txt, .doc, etc... See question 2 for a discussion of how this is done.
To turn on wrap mode for the current buffer, simply press Escape-X and
enter:
text_mode
at the prompt. To turn it off, you must change the mode to something
else. A fairly generic choice is the `no_mode' mode. To do this, press
Escape-X and enter:
no_mode
at the prompt. It is easy to write a function to toggle the mode for
you that can be bound to a key. This one (toggle_wrapmode) will work:
define toggle_wrapmode ()
{
variable mode, modestr;
(modestr, mode) = whatmode ();
if (mode & 1) % test wrap bit
mode = mode & ~(1); % wrap bit on so mask it off
else mode = mode | 1; % wrap bit off so set it.
setmode (modestr, mode);
}
<5> What is the difference between internal and intrinsic functions?
An intrinsic function is a function that is directly callable from S-Lang
while an internal function cannot. However, internal functions can be
called indirectly through the use of the intrinsic function `call'. For
example, consider the internal function `self_insert_cmd'. Most typing
keys are bound to this function and cause the key to be directly inserted
into the buffer. Consider the effect of this. After a character to be
inserted is received by JED, the buffer is updated to reflect its
insertion. Then the screen is updated. Here lies the essential
difference between the two types of functions. If the screen was in sync
before the insertion, JED can simply put the terminal in insert mode,
send out the character and take the terminal back out of insert mode.
However, this requires knowing the state of the screen. If called from a
S-Lang routine, all bets are off. Since the screen update is not
performed until after any S-Lang function has returned to JED, the buffer
and the screen will almost always be out of sync with respect to one
another and a full screen update will have to be performed. But this is
very costly to have to do for every insertion. Hence, JED makes a
distinction between the two types of functions by making the most common
ones internal. The upshot is this: intrinsic functions will cause a full
screen update while internal ones may not.
<6> Sometimes during screen updates, JED pauses. Why is this?
Since version 0.91, JED checks the baud rate and tries to output
characters based on reported rate. JED will literally sleep when
outputting many characters if the reported baud rate is small. One
should first check to see that terminal driver has the baud rate set
appropriately. On Unix, this is done by typing `stty -a' at the shell
prompt. If setting the baud rate to the correct value does not help, set
the internal global variable `OUTPUT_RATE' to zero. This is achived by
uncommenting the line referring to OUTPUT_RATE in the jed.rc
initialization file. If there is still a problem, contact me.
<7> How do I get JED to recognize Control-S and Control-Q?
Many systems use ^S/^Q for flow control--- the so-called XON/XOFF
protocol which is probably the reason JED does not see either of these
two characters. Perhaps the most portable solution to this problem is to
simply avoid using ^S and ^Q altogether. This may require the user to
rebind those those functions that have key bindings composed of these
characters.
JED is able to enable or disable flow control on the system that it is
running. This may be done by putting the line:
enable_flow_control (0); % turn flow control off
in your .jedrc file. Using a value of 1 turns flow control on.
Another solution is to use the `map_input' function to map a different
key to ^S (and ^Q). For example, one might simply choose to map ^\ to ^S
and ^^ (Control-^) to ^Q. To do this, simply put:
map_input (28, 19); % ^\ --> ^S
map_input (30, 17); % ^^ --> ^Q
in your .jedrc (jed.rc) file.
<8> Can I bind the Alt keys on the PC?
Yes. The ALT keys return a two character key sequence. The key sequence
for a particular ALT key as well as other function keys are listed in the
file `pc-keys.txt'.
Many users simply want to use the ALT key as a Meta Character. To have
JED interpret ALT-X as ESC-X, put
ALT_CHAR = 27;
int your jed.rc file. Here `X' is any key. (Actually, this should
not be necessary-- the default value for ALT_CHAR is 27).
<9> How do I find out what characters a particular key generates?
The simpliest way is to start JED via the command:
jed -l keycode -f keycode
JED will then prompt for a key to be pressed and return the escape
sequence that the key sends. If Xjed is used, it will also return
the keysym (See online help on the x_set_keysym function for more
information).
An alternative approach is to use the quoted insert function. By
default, this is bound to the backquote (`) key. Simply switch to
the `*scratch*' buffer, press the backquote key followed by the key
in question. The key sequence will be inserted into the buffer.
This exploits the fact that most multi-character key sequences
begin with the ESC character followed one or more printable
characters.
If this fails, the following function will suffice:
define insert_this_key ()
{
variable c;
pop2buf ("*scratch*");
eob ();
message ("Press key:"); update (1);
forever
{
c = getkey ();
if (c == 0) insert("^@"); else insert (char (c));
!if (input_pending (3)) break;
}
}
Simply type it into the scratch buffer, press ESC-X and type
`evalbuffer'. Then, to use the function, press ESC-X again and enter
`insert_this_key'.
<10> JED scrolls slow on my WizBang-X-Super-Terminal. What can I do about it?
On Unix, JED uses termcap (terminfo) and the value of the TERM
environment variable. Chance are, even though you are using an expansive
state of the art terminal, you have told unix it is a vt100. Even if you
have set the TERM variable to the appropriate value for you terminal, the
termcap file may be missing entries for your ``WizBang'' features. This
is particularly the case for Ultrix systems--- the vt102, vt200, and
vt300 termcap entries are missing the AL and DL termcap flags. In fact,
the Ultrix man page for termcap does not even mention these capabilities!
JED is able to compensate for missing termcap entries only for vtxxx
terminals. If your terminal is a fancy vtxxx terminal, put the line:
set_term_vtxxx (0);
in your .jedrc file.
<11> How do I get a list of functions?
Help on any documented function is available by pressing `Ctrl-H f' and
entering the function name at the prompt. If you simply hit return, you
will get the documentation for all functions.
<12> How can I use edt.sl with jed386.exe?
The basic problem is the current generation of the 32 bit compiler (DJGPP)
used to generate jed386.exe cannot handle the hardware keyboard interrupt
used to remap the numeric keypad. Nevertheless, it is possible to use
edt.sl with jed386. However, the function keys, F1 to F10 must be used
for the EDT keypad.
The remapping is as follows:
VT100 Keys
IBM Function On the Numeric Keypad
------------------------- -------------------------
| F1 | F2 | F3 | F4 | | PF1 | PF2 | PF3 | PF4 |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| F5 | F6 | F7 | F8 | | 7 | 8 | 9 | - |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| F9 | F10 | F11 | F12 | | 4 | 5 | 6 | , |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| SF1 | SF2 | SF3 | SF4 | | 1 | 2 | 3 | |
|-----------+-----|-----| |-----------+-----|ENTER|
| SF5 | SF6 | SF7 | SF8 | | 0 | . | |
------------------------- -------------------------
Here, SF1 means SHIFT-F1, etc...
<13> How do I set custom tab stops in jed?
Put something like:
variable Tab_Stops;
Tab_Stops = create_array('i', 20, 1);
%% The following defines the tab stops to be 8 column:
_for (0, 19, 1)
{ =$1;
Tab_Stops[$1] = $1 * 8 + 1;
}
in your jed.rc. To individually set them, do:
Tab_Stops[0] = 4;
Tab_Stops[1] = 18;
etc...
-------------------------------------------------------------------------------
This is a useful function used to maintain numbers in this faq.
define faq_fix ()
{
variable n; n = 1;
bob();
bol_fsearch("---------------"); pop(); % always found
push_mark();
bol_fsearch("-------------"); pop(); narrow();
bob();
while (re_fsearch("^[0-9]+\\."))
{
replace_match (strcat(string(n), "."), 1); pop();
++n;
}
widen();
n = 1;
while (re_fsearch("^<[0-9]+>"))
{
replace_match (Sprintf("<%d>", n, 1), 1); pop();
++n;
}
}