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. How do I turn on wrap mode or turn it off?
4. What are the differences between internal and intrinsic functions?
5. Sometimes during screen updates, JED pauses.  Why is this?
6. How do I get JED to recognize Control-S and Control-Q?
7. Can I bind the Alt keys on the PC?
8. How do I find out what characters a particular key generates.
9. JED scrolls slow on my WizBang-X-Super-Terminal.  What can I do about it?

----------------------------------------------------------------------------
Answers:

<1> How do I obtain JED? (ftp and email)

   JED is available via anonymous ftp from amy.tch.harvard.edu
   (134.174.22.100) in the pub/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).
   
   
<3> 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:
   
     ( 
       [n]
       whatmode =n
       n 1 &          ; test wrap bit
         { n 1 ~ &}   ; wrap bit on so mask it off
	 { n 1 | }    ; wrap bit off so set it.
       else
       setmode
     ) toggle_wrapmode
     
   Here is the same function expressed in S-Lang infix notation.
     ( 
       [n name]
.      n = whatmode(), =name   ; whatmode leave 2 values on stack!
.      n & 1                   ; test wrap bit
.        { n = n & ~(1) }      ; wrap bit on so mask it off
.        { n = n | 1 }         ; wrap bit off so set it.
       else
.      setmode(name, n)
     ) toggle_wrapmode
     
   Note that lines containg infix must begin with a period!

<4> 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.
   
<5> 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.

<6> 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:
   
       0 enable_flow_control  ; 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:
   
     28 19  map_input   ; ^\ --> ^S
     30 17  map_input   ; ^^ --> ^Q

   in your .jedrc (jed.rc) file.

<7> 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.
   Currently, there is no simple way to do this.  However, it can be done as
   described in the previous paragraph.  For example, suppose it is desired
   to have ALT-X mimic ESC-X which is bound to the function
   `emacs_escape_x'.  From pc-keys.txt, the ALT-X key generates the two
   character key sequence "^@-"  (Control-@ Minus).  Hence, 
   
      "emacs_escape_x"  "^@-"  setkey
      
   will do the trick.


<8> How do I find out what characters a particular key generates?

   The easiest way 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:
   
      (
        [c]
	"*scratch*"  pop2buf
        "Press key:" message update
	{
	  getkey =c
 	  c 0 == {"^@"}{c char} else insert
	  1 input_pending {break} !if
	} forever
      ) insert_this_key
   
   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'.

<9> 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:
   
        0 set_term_vtxxx
	
   in your .jedrc file.  
   
-------------------------------------------------------------------------------
This is a useful function used to maintain numbers in this faq.

(
  [n] 1 =n
  bob "---------------" fsearch pop        ; always found
  push_mark
  "-------------" fsearch pop narrow
  bob
  {1 down}
  {
     bol
     "0-9" skip_chars "." looking_at {continue} !if
     push_mark bol del_region
     n string insert
     ++n
  } while
  
  widen
  1 =n
  {"<" bol_fsearch}
  {
     1 right pop
     push_mark
     "0-9" skip_chars bufsubstr
     integer n == 
       {
          push_mark "0-9" bskip_chars del_region
	  n string insert
       } !if
     ++n
  } while
) faq_fix
