home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR36 / KEXX.ZIP / INDENT.DOC < prev    next >
Text File  |  1992-12-30  |  7KB  |  188 lines

  1.                         INDENT.KEX Documentation
  2.                             (December 1989)
  3.  
  4. The auto indentation package currently consists of three separate parts:
  5.  
  6. **** Regular indentation support.
  7.  
  8. This consists of several keydefs that support moving the left margin around
  9. with different tab functions.
  10.  
  11. TAB       - moves the cursor forward to the next tab stop, then sets left margin
  12.             to the destination.
  13. SHIFT-TAB - moves the cursor backward to the last tab stop, then sets left
  14.             margin to the destination.
  15. CTL-I     - CTL-INDENT - Set left margin to the cursor position.
  16. CTL-U     - CTL-UNDENT - Put the cursor in column 1 and set the left margin to
  17.             column 1
  18. ALT-TAB   - moves the cursor forward to the last tab stop. then sets the left
  19.             margin to the destination.
  20.             Next the contents of the line are shifted so that the first non
  21.             blank character is placed at the cursor position. If the cursor
  22.             is located on the first line in a line block, the entire block is
  23.             shifted.
  24. CTL-TAB   - moves the cursor backward to the last tab stop. then sets the left
  25.             margin to the destination.
  26.             Next the contents of the line are shifted so that the first non
  27.             blank character is placed at the cursor position. If the cursor
  28.             is located on the first line in a line block, the entire block is
  29.             shifted.
  30. CTL-HOME  - The contents of the line are shifted so that the first non
  31.             blank character is placed at the cursor position. If the cursor
  32.             is located on the first line in a line block, the entire block is
  33.             shifted. The left margin is set to the cursor position. No tab
  34.             function is performed.
  35.  
  36. The tab direction for ALT-TAB and CTL-TAB is based on their relative position on
  37. the extended keyboard, making it easier to remember which way they go.
  38.  
  39. Regular indenting is enabled only for those extensions you wish by executing the
  40. RINDENT macro in your PROFILE.KEX with the desired file extensions, separated by
  41. semicolons, as an argument.  For example:
  42.  
  43. 'macro rindent c;h;rex;kex;kml'
  44.  
  45. would enable the RINDENT functions for .c, .h, .rex, .kex, and .kml files.
  46. RINDENT.KEX needs to load RINDENT.KML, and must be able to find it.
  47.  
  48. **** Smart indenting
  49.  
  50. One big macro that gets attached to the NUMENTER key on the extended keyboard.
  51. It adds a line and tries to intelligently place the cursor and left margin based
  52. on the contents of the file.
  53.  
  54. There is currently only support for: the C language or REXX or KEX.
  55.  
  56. It is acivated in the same fashion as the regular indenting package, via a
  57. similar macro in your PROFILE.KEX file:
  58.  
  59. 'macro sindent c;h;cpp;rex;kex;kml;cmd'
  60.  
  61. As with the regular indenting support macro, SINDENT.KEX will try to load
  62. SINDENT.KML, and must be able to find it.
  63.  
  64. **** TINDENT.KML - bracket matching and template completion for the C language,
  65.                    as well as DO/END matching for REXX/KEXX programs.
  66.  
  67. These functions try to anticipate your needs and provide templates for standard
  68. C statements, or automatically providing ending brackets or END statements. The
  69. effected keys are:
  70.  
  71. NUMENTER - when pressed, it will try to handle bracket and DO/END completions.
  72.  
  73. SPACE    - when pressed, it will try to intelligently provide "fill in"
  74.            statement templates.
  75.  
  76. CTL-T    - Toggles the SPACE function on and off.
  77.  
  78. Templates for C programmers include:
  79.  
  80. else
  81. else if ()
  82. if ()
  83. while ()
  84. for ()
  85. switch ()
  86. case :
  87. break;
  88. default:
  89. return;
  90.  
  91. If you want the functions associated with template completion, all you need to
  92. do to enable them is issue a macro very much like what you've done for the
  93. regular and smart indentation stuff:
  94.  
  95. 'macro tindent c;h'
  96.  
  97. By default, the SPACE bar functions are toggled off, and you would have to press
  98. CTL-T to enable them.  If you decide that you prefer to have the SPACE bar
  99. functions turned on initially, you can also place the following line in your
  100. PROFILE.KEX:
  101.  
  102. 'Editv Setf IEscape OFF'
  103.  
  104. You can also use a special INDENT.KEX macro to control the way that KEDIT
  105. indents for different file extensions.  INDENT.KEX takes four arguments:  the
  106. file extension, followed by three different numeric values.  They are separated
  107. from one another with blanks.  The first value controls the indenting of any
  108. hanging opening brackets.  It tells KEDIT how many tab stops in from beginning
  109. of the corresponding control statement you want the bracket to be placed.  The
  110. third value is used to help KEDIT place the corresponding closing bracket;
  111. again, the value corresponds to the number of TAB stops in from the beginning of
  112. the appropriate control line.  The second value, much like the others, is used
  113. to determine the number of tab stops to indent any time it is appropriate.  This
  114. includes, but is not restricted to, the statements that would lie between
  115. opening and closing braces.
  116.  
  117. Let's consider the case where you want the braces to lie even with the
  118. controlling statements, but want the lines in between to lie one tab stop
  119. over from them. The command you would use to set this up would be:
  120.  
  121. 'macro indent c 0 1 0'
  122.  
  123. If your tabs settings are set for every four columns, then KEDIT's smart
  124. indenting and template completion would then produce structure that looks
  125. like:
  126.  
  127. if (a == b)
  128. {
  129.     c = d;
  130. }
  131.  
  132. The default for C programs is: 1 1 1, which would produce:
  133.  
  134. if (a == b)
  135.     {
  136.     c = d;
  137.     }
  138.  
  139. For REXX programs, only the second and third values are used by the indenting
  140. logic. The third value controls the placement of any matching END statements,
  141. while the second value works exactly the same as for C programs. If you
  142. prefer to have your structures look like this:
  143.  
  144. IF a = b THEN DO
  145.     x = y
  146.     END
  147.  
  148. then the command should be:
  149.  
  150. 'macro indent 0 1 1'
  151.  
  152. On the other hand, if you prefer
  153.  
  154. IF a = b THEN DO
  155.     x = y
  156. END
  157.  
  158. you would specify:
  159.  
  160. 'macro indent 0 1 0'
  161.  
  162. The default setting for any file extension not overridden in this fashion
  163. is 1 1 1.
  164.  
  165. *** Note that negative values as well as values larger than one are valid.  Also
  166. note that the first and third values only have relevance with the template
  167. completion logic associated with the NUMENTER key.  The second value is used
  168. throughout the smart indenting logic.
  169.  
  170. ****
  171.  
  172. Disclaimer for all BBS (and other distributed) utilities/programs/macros:
  173.  
  174. The programs and macros distributed on this diskette are available
  175. strictly as aids and examples for users of Mansfield Software Group
  176. products.
  177.  
  178. Mansfield Software does not guarantee, or commit to support or maintain
  179. the programs or macros distributed on this diskette.  Also note that the
  180. programs and macros provided are not guaranteed to work with past,
  181. present, or future versions of Mansfield Software products.
  182.  
  183. Nonetheless, comments and suggestions are welcome.  Please post any
  184. comments, suggestions, or bug reports in:
  185.  
  186.   -- section 2 of the PCVENA forum on CompuServe, or
  187.   -- the Mansfield Software Group Bulletin Board, at (203) 429-3784.
  188.