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 >
Text File  |  1997-02-01  |  15KB  |  400 lines

  1. Frequently Asked Questions about the JED editor.
  2.  
  3. To find the answer to one of the following questions,  Search for the number
  4. enclosed in <>, e.g., <3> for question 3.
  5.  
  6. ----------------------------------------------------------------------------
  7. Frequently asked questions:
  8.  
  9. 1. How do I obtain JED?  (ftp and email)
  10. 2. How do I disable JED's C mode.
  11. 3. What is C mode?
  12. 4. How do I turn on wrap mode or turn it off?
  13. 5. What are the differences between internal and intrinsic functions?
  14. 6. Sometimes during screen updates, JED pauses.  Why is this?
  15. 7. How do I get JED to recognize Control-S and Control-Q?
  16. 8. Can I bind the Alt keys on the PC?
  17. 9. How do I find out what characters a particular key generates.
  18. 10. JED scrolls slow on my WizBang-X-Super-Terminal.  What can I do about it?
  19. 11. How do I get a list of functions?
  20. 12. How can I use edt.sl with jed386.exe?
  21. ----------------------------------------------------------------------------
  22. Answers:
  23.  
  24. <1> How do I obtain JED? (ftp and email)
  25.  
  26.    JED is available via anonymous ftp from space.mit.edu in the pub/davis/jed
  27.    directory.  JED comes in three forms:
  28.  
  29.      jedxxx.tar.Z     unix distribution for version xxx
  30.      jedxxx.*_of_n    n part VMS share distribution for xxx
  31.      jedxxx.zip       PC distribution with precompiled jed.exe
  32.      
  33.    All distributions are identical except that the zip file also contains a
  34.    precompiled executable for PC systems.
  35.    
  36.    JED may also be obtained by email for those without ftp access.  To learn
  37.    about how to ftp using email, send email to ftpmail@pa.dec.com with the
  38.    single line `help'.  A message will be returned with instructions.
  39.    
  40.    For those on BITNET, particularly with VMS systems, Hunter Goatley has
  41.    made JED available via email:
  42.  
  43.        To get JED via e-mail, send the following commands in the body
  44.        of a mail message to FILESERV@WKUVX1.BITNET:
  45.  
  46.        SEND JED090
  47.        SEND FILESERV_TOOLS  !Only needed if you don't have UNZIP and MFTU
  48.  
  49.        You can also get it via anonymous ftp from ftp.spc.edu in
  50.        [.MACRO32.SAVESETS]JED090.ZIP.
  51.  
  52.        This distribution includes VMS .OBJs and a .EXE file that was
  53.        linked under VMS V5.1.  [Note that although this distribution
  54.        is intended for VMS systems, it includes makefiles and sources
  55.        for unix as well.  However, you will need to get unzip for
  56.        your unix system. --John]
  57.  
  58. <2> How do I disable JED's C mode.
  59.  
  60.    The startup file `site.sl' contains the function `mode_hook' which is 
  61.    called whenever a file is loaded.  This function is passed the filename
  62.    extension.  If a file with `c' or `h' extension is read, this function
  63.    will turn on C-mode for that buffer.  You could modify this function to
  64.    not select C-mode.  However, this is not recommended.  Rather, it is
  65.    recommended that you simply rebind the offending keybinding.  These
  66.    include: `{`, `}`, the TAB key, and the RETURN key.
  67.    
  68.    Simply put any or all of:
  69.    
  70.       "self_insert_cmd"  "{"   setkey 
  71.       "self_insert_cmd"  "}"   setkey
  72.       "self_insert_cmd"  "^I"  setkey
  73.       "newline"          "^M"  setkey
  74.       
  75.    in your personal startup file (jed.rc or .jedrc).
  76.    
  77.    Before you do this, are you sure that you really understand what C mode
  78.    does?  If not, please read on.
  79.  
  80. <3> What is C mode?
  81.  
  82.    In C mode, the TAB key does not insert tabs.  Instead, it runs a command
  83.    called `indent_line'.  It is really the quickest way to edit C code.  In
  84.    this mode, the TAB, RETURN, `{`, and `}' keys are special.
  85.  
  86.    If you edit a file called x.c, JED will invoke its C mode.  Entering the
  87.    28 characters (no newline, TAB, etc...)
  88.  
  89.    `main (){if (x == 2){x = 4;}}'
  90.    
  91.    should result in:
  92.  
  93.    main () {
  94.       if (x == 2) {
  95.         x = 4;
  96.       }
  97.    }
  98.  
  99.    which would take alot more time using the TAB and NEWLINE keys.  If you
  100.    do not like the indentation style, you can customize it by setting the
  101.    appropriate variables in jed.rc.  My preference is to set the variables
  102.    such that the SAME characters above yield:
  103.  
  104.    main ()
  105.    {
  106.       if (x == 2)
  107.         {
  108.            x = 4;
  109.         }
  110.    }
  111.  
  112.    To see the use of the tab key, delete the whitespace in front of all the
  113.    lines to produce:
  114.  
  115.    main () {
  116.    if (x == 2) {
  117.    x = 4;
  118.    }
  119.    }
  120.  
  121.    Now, move to any of the lines (anywhere on the line) and hit the TAB key.
  122.    This should correctly indent the line to according to your preferences
  123.    (i.e., the variables in jed.rc).
  124.  
  125.    Finally, move to one of the lines and enter `ESC ;'.  This should produce
  126.    a C comment.
  127.  
  128.    Using the C mode and the TAB key as indent_line also helps you avoid
  129.    syntax errors.  Basically, a line simply will not indent properly.  This
  130.    indicats that you left off a brace, mismatched parenthesis, etc...  If
  131.    you bind TAB away from indent_line, you lose some of this.
  132.  
  133.  
  134.    Note that these same comments apply to Fortran mode.  Get a file called
  135.    `x.for'.  Enter the characters:
  136.  
  137.    TABprogram mainRETinteger*4 iRETdo 10 i=1,3RETcall f(i)RET10continueRETend
  138.  
  139.    Here TAB means hit TAB and RET means hit return.  This will result in:
  140.  
  141.          program main
  142.      integer*4 i
  143.      do 10 i=1,3
  144.        call f(i)
  145.     10   continue
  146.          end
  147.  
  148.    Again, the editor has done all the work.  Once you get used to this style
  149.    of editing, you will not want to go back.
  150.  
  151.    Also note that this will not work if EDT is loaded.  To get this
  152.    functionality back, you will need to do:
  153.  
  154.       setkey("indent_line_cmd", "\t");
  155.       setkey("newline_and_indent_cmd", "^M");
  156.  
  157.    AFTER edt.sl is loaded.        
  158.  
  159.    
  160. <4> How do I turn on wrap mode or turn it off?
  161.  
  162.    Normally, this is done automatically when JED loads a file with extensions
  163.    .txt, .doc, etc...  See question 2 for a discussion of how this is done.
  164.    To turn on wrap mode for the current buffer, simply press Escape-X and 
  165.    enter:
  166.            text_mode
  167.     
  168.    at the prompt.  To turn it off, you must change the mode to something
  169.    else.  A fairly generic choice is the `no_mode' mode.  To do this, press
  170.    Escape-X and enter:
  171.    
  172.            no_mode
  173.        
  174.    at the prompt.  It is easy to write a function to toggle the mode for
  175.    you that can be bound to a key.  This one (toggle_wrapmode) will work:
  176.    
  177.    define toggle_wrapmode ()
  178.    {
  179.       variable mode, modestr;
  180.       (modestr, mode) = whatmode ();
  181.       if (mode & 1)          % test wrap bit
  182.         mode = mode & ~(1);  % wrap bit on so mask it off
  183.       else mode = mode | 1;  % wrap bit off so set it.
  184.       setmode (modestr, mode);
  185.    }
  186.  
  187. <5> What is the difference between internal and intrinsic functions?
  188.  
  189.    An intrinsic function is a function that is directly callable from S-Lang
  190.    while an internal function cannot.  However, internal functions can be
  191.    called indirectly through the use of the intrinsic function `call'.  For
  192.    example, consider the internal function `self_insert_cmd'.  Most typing
  193.    keys are bound to this function and cause the key to be directly inserted
  194.    into the buffer.  Consider the effect of this.  After a character to be
  195.    inserted is received by JED, the buffer is updated to reflect its
  196.    insertion. Then the screen is updated.  Here lies the essential
  197.    difference between the two types of functions.  If the screen was in sync
  198.    before the insertion, JED can simply put the terminal in insert mode,
  199.    send out the character and take the terminal back out of insert mode. 
  200.    However, this requires knowing the state of the screen.  If called from a
  201.    S-Lang routine, all bets are off.  Since the screen update is not
  202.    performed until after any S-Lang function has returned to JED, the buffer
  203.    and the screen will almost always be out of sync with respect to one
  204.    another and a full screen update will have to be performed.  But this is
  205.    very costly to have to do for every insertion.  Hence, JED makes a
  206.    distinction between the two types of functions by making the most common
  207.    ones internal.  The upshot is this: intrinsic functions will cause a full
  208.    screen update while internal ones may not.
  209.    
  210. <6> Sometimes during screen updates, JED pauses.  Why is this?
  211.  
  212.    Since version 0.91, JED checks the baud rate and tries to output
  213.    characters based on reported rate.  JED will literally sleep when
  214.    outputting many characters if the reported baud rate is small.  One
  215.    should first check to see that terminal driver has the baud rate set
  216.    appropriately.  On Unix, this is done by typing `stty -a' at the shell
  217.    prompt. If setting the baud rate to the correct value does not help, set
  218.    the internal global variable `OUTPUT_RATE' to zero.  This is achived by
  219.    uncommenting the line referring to OUTPUT_RATE in the jed.rc
  220.    initialization file.  If there is still a problem, contact me.
  221.  
  222. <7> How do I get JED to recognize Control-S and Control-Q?
  223.  
  224.    Many systems use ^S/^Q for flow control--- the so-called XON/XOFF
  225.    protocol which is probably the reason JED does not see either of these
  226.    two characters.  Perhaps the most portable solution to this problem is to
  227.    simply avoid using ^S and ^Q altogether.  This may require the user to
  228.    rebind those those functions that have key bindings composed of these
  229.    characters.
  230.    
  231.    JED is able to enable or disable flow control on the system that it is
  232.    running.  This may be done by putting the line:
  233.    
  234.       enable_flow_control (0);  % turn flow control off
  235.        
  236.    in your .jedrc file.  Using a value of 1 turns flow control on.
  237.    
  238.    Another solution is to use the `map_input' function to map a different
  239.    key to ^S (and ^Q).  For example, one might simply choose to map ^\ to ^S
  240.    and ^^ (Control-^) to ^Q.  To do this, simply put:
  241.    
  242.      map_input (28, 19);    % ^\ --> ^S
  243.      map_input (30, 17);    % ^^ --> ^Q
  244.  
  245.    in your .jedrc (jed.rc) file.
  246.  
  247. <8> Can I bind the Alt keys on the PC?
  248.  
  249.    Yes.  The ALT keys return a two character key sequence.  The key sequence
  250.    for a particular ALT key as well as other function keys are listed in the
  251.    file `pc-keys.txt'.
  252.  
  253.    Many users simply want to use the ALT key as a Meta Character.  To have
  254.    JED interpret ALT-X as ESC-X, put
  255.    
  256.          ALT_CHAR = 27;
  257.      
  258.    int your jed.rc file.  Here `X' is any key.  (Actually, this should
  259.    not be necessary-- the default value for ALT_CHAR is 27).
  260.  
  261. <9> How do I find out what characters a particular key generates?
  262.  
  263.    The simpliest way is to start JED via the command:
  264.    
  265.        jed -l keycode -f keycode
  266.        
  267.    JED will then prompt for a key to be pressed and return the escape
  268.    sequence that the key sends.  If Xjed is used, it will also return
  269.    the keysym (See online help on the x_set_keysym function for more
  270.    information).
  271.    
  272.    An alternative approach is to use the quoted insert function.  By
  273.    default, this is bound to the backquote (`) key.  Simply switch to
  274.    the `*scratch*' buffer, press the backquote key followed by the key
  275.    in question.  The key sequence will be inserted into the buffer.
  276.    This exploits the fact that most multi-character key sequences
  277.    begin with the ESC character followed one or more printable
  278.    characters.
  279.  
  280.    If this fails, the following function will suffice:
  281.    
  282.       define insert_this_key ()
  283.       {
  284.         variable c;
  285.     pop2buf ("*scratch*");
  286.     eob ();
  287.         message ("Press key:"); update (1);
  288.     forever 
  289.       {
  290.          c = getkey ();
  291.          if (c == 0) insert("^@"); else insert (char (c));
  292.          !if (input_pending (3)) break;
  293.       } 
  294.       }
  295.    
  296.    Simply type it into the scratch buffer, press ESC-X and type
  297.    `evalbuffer'.  Then, to use the function,  press ESC-X again and enter
  298.    `insert_this_key'.
  299.  
  300. <10> JED scrolls slow on my WizBang-X-Super-Terminal.  What can I do about it?
  301.  
  302.    On Unix, JED uses termcap (terminfo) and the value of the TERM
  303.    environment variable.  Chance are, even though you are using an expansive
  304.    state of the art terminal, you have told unix it is a vt100.  Even if you
  305.    have set the TERM variable to the appropriate value for you terminal, the
  306.    termcap file may be missing entries for your ``WizBang'' features.  This
  307.    is particularly the case for Ultrix systems--- the vt102, vt200, and 
  308.    vt300 termcap entries are missing the AL and DL termcap flags.  In fact,
  309.    the Ultrix man page for termcap does not even mention these capabilities!
  310.    
  311.    JED is able to compensate for missing termcap entries only for vtxxx
  312.    terminals.  If your terminal is a fancy vtxxx terminal, put the line:
  313.    
  314.        set_term_vtxxx (0);
  315.     
  316.    in your .jedrc file.  
  317.  
  318. <11> How do I get a list of functions?
  319.  
  320.    Help on any documented function is available by pressing `Ctrl-H f' and
  321.    entering the function name at the prompt.  If you simply hit return, you
  322.    will get the documentation for all functions.
  323.  
  324. <12> How can I use edt.sl with jed386.exe?
  325.  
  326.   The basic problem is the current generation of the 32 bit compiler (DJGPP)
  327.   used to generate jed386.exe cannot handle the hardware keyboard interrupt
  328.   used to remap the numeric keypad.  Nevertheless, it is possible to use
  329.   edt.sl with jed386.  However, the function keys, F1 to F10 must be used
  330.   for the EDT keypad.
  331.   
  332.   The remapping is as follows:
  333.  
  334.                                           VT100 Keys
  335.           IBM Function               On the Numeric Keypad
  336.    -------------------------       -------------------------
  337.    |  F1 |  F2 | F3  | F4  |       | PF1 | PF2 | PF3 | PF4 |
  338.    |-----+-----+-----+-----|       |-----+-----+-----+-----|
  339.    |  F5 |  F6 | F7  | F8  |       |  7  |  8  |  9  |  -  |
  340.    |-----+-----+-----+-----|       |-----+-----+-----+-----|
  341.    |  F9 | F10 | F11 | F12 |       |  4  |  5  |  6  |  ,  |
  342.    |-----+-----+-----+-----|       |-----+-----+-----+-----|
  343.    | SF1 | SF2 | SF3 | SF4 |       |  1  |  2  |  3  |     |
  344.    |-----------+-----|-----|       |-----------+-----|ENTER|
  345.    | SF5 | SF6 | SF7 | SF8 |       |     0     |  .  |     |
  346.    -------------------------       -------------------------
  347.     
  348.   Here, SF1 means SHIFT-F1, etc...
  349.   
  350.   
  351.      
  352. <13> How do I set custom tab stops in jed?
  353.  
  354.    Put something like:
  355.   
  356.    variable Tab_Stops;
  357.    Tab_Stops = create_array('i', 20, 1);
  358.    
  359.    %% The following defines the tab stops to be 8 column:
  360.    _for (0, 19, 1) 
  361.      { =$1; 
  362.     Tab_Stops[$1] = $1 * 8 + 1;
  363.      }
  364.  
  365.   in your jed.rc.  To individually set them, do:
  366.   
  367.      Tab_Stops[0] = 4;
  368.      Tab_Stops[1] = 18;
  369.      
  370.   etc...
  371.  
  372.  
  373. -------------------------------------------------------------------------------
  374. This is a useful function used to maintain numbers in this faq.
  375.  
  376. define faq_fix ()
  377. {
  378.    variable n; n = 1;
  379.    bob();
  380.    bol_fsearch("---------------"); pop();        % always found
  381.    push_mark();
  382.    bol_fsearch("-------------"); pop(); narrow();
  383.    bob();
  384.    while (re_fsearch("^[0-9]+\\."))
  385.      {
  386.     replace_match (strcat(string(n), "."), 1); pop();
  387.     ++n;
  388.      }
  389.   
  390.    widen();
  391.    n = 1;
  392.    
  393.    while (re_fsearch("^<[0-9]+>"))
  394.      {
  395.     replace_match (Sprintf("<%d>", n, 1), 1); pop();
  396.     ++n;
  397.      }
  398. }
  399.  
  400.