home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / texinfo-3.1-bin.lha / info / texi.info-6 < prev    next >
Encoding:
GNU Info File  |  1994-02-24  |  49.1 KB  |  1,462 lines

  1. This is Info file texi.info, produced by Makeinfo-1.55 from the input
  2. file texi.texi.
  3.  
  4.    This file documents Texinfo, a documentation system that uses a
  5. single source file to produce both on-line information and a printed
  6. manual.
  7.  
  8.    Copyright (C) 1988, 1990, 1991, 1992, 1993 Free Software Foundation,
  9. Inc.
  10.  
  11.    This is the second edition of the Texinfo documentation,
  12. and is consistent with version 2 of `texinfo.tex'.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Free Software Foundation.
  27.  
  28. 
  29. File: texi.info,  Node: Inserting An Atsign,  Next: Inserting Braces,  Up: Braces Atsigns Periods
  30.  
  31. Inserting `@' with @@
  32. ---------------------
  33.  
  34.    `@@' stands for a single `@' in either printed or Info output.
  35.  
  36.    Do not put braces after an `@@' command.
  37.  
  38. 
  39. File: texi.info,  Node: Inserting Braces,  Next: Controlling Spacing,  Prev: Inserting An Atsign,  Up: Braces Atsigns Periods
  40.  
  41. Inserting `{' and `}'with @{ and @}
  42. -----------------------------------
  43.  
  44.    `@{' stands for a single `{' in either printed or Info output.
  45.  
  46.    `@}' stands for a single `}' in either printed or Info output.
  47.  
  48.    Do not put braces after either an `@{' or an `@}' command.
  49.  
  50. 
  51. File: texi.info,  Node: Controlling Spacing,  Prev: Inserting Braces,  Up: Braces Atsigns Periods
  52.  
  53. Spacing After Colons and Periods
  54. --------------------------------
  55.  
  56.    Use the `@:' command after a period, question mark, exclamation
  57. mark, or colon that should not be followed by extra space.  For
  58. example, use `@:' after periods that end abbreviations which are not at
  59. the ends of sentences.  `@:' has no effect on the Info file output.
  60.  
  61.    For example,
  62.  
  63.      The s.o.p.@: has three parts ...
  64.      The s.o.p. has three parts ...
  65.  
  66. produces
  67.  
  68.      The s.o.p. has three parts ...
  69.      The s.o.p. has three parts ...
  70.  
  71. `@:' has no effect on the Info output.  (`s.o.p' is an acronym for
  72. "Standard Operating Procedure".)
  73.  
  74.    Use `@.' instead of a period at the end of a sentence that ends with
  75. a single capital letter.  Otherwise, TeX will think the letter is an
  76. abbreviation and will not insert the correct end-of-sentence spacing.
  77. Here is an example:
  78.  
  79.      Give it to M.I.B. and to M.E.W@.  Also, give it to R.J.C@.
  80.      Give it to M.I.B. and to M.E.W.  Also, give it to R.J.C.
  81.  
  82. produces
  83.  
  84.      Give it to M.I.B. and to M.E.W.  Also, give it to R.J.C.
  85.      Give it to M.I.B. and to M.E.W.  Also, give it to R.J.C.
  86.  
  87.    In the Info file output, `@.' is equivalent to a simple `.'.
  88.  
  89.    The meanings of `@:' and `@.' in Texinfo are designed to work well
  90. with the Emacs sentence motion commands.  This made it necessary for
  91. them to be incompatible with some other formatting systems that use
  92. @-commands.
  93.  
  94.    Do not put braces after either an `@:' or an `@.' command.
  95.  
  96. 
  97. File: texi.info,  Node: dmn,  Next: Dots Bullets,  Prev: Braces Atsigns Periods,  Up: Insertions
  98.  
  99. `@dmn'{DIMENSION}: Format a Dimension
  100. =====================================
  101.  
  102.    At times, you may want to write `12pt' or `8.5in' with little or no
  103. space between the number and the abbreviation for the dimension.  You
  104. can use the `@dmn' command to do this.  On seeing the command, TeX
  105. inserts just enough space for proper typesetting; the Info formatting
  106. commands insert no space at all, since the Info file does not require
  107. it.
  108.  
  109.    To use the `@dmn' command, write the number and then follow it
  110. immediately, with no intervening space, by `@dmn', and then by the
  111. dimension within braces.
  112.  
  113. For example,
  114.  
  115.      A4 paper is 8.27@dmn{in} wide.
  116.  
  117. produces
  118.  
  119.      A4 paper is 8.27in wide.
  120.  
  121.    Not everyone uses this style.  Instead of writing `8.27@dmn{in}' in
  122. the Texinfo file, you may write `8.27 in.' or `8.27 inches'.  (In these
  123. cases, the formatters may insert a line break between the number and the
  124. dimension.  Also, if you write a period after an abbreviation within a
  125. sentence, you should write `@:' after the period to prevent TeX from
  126. inserting extra whitespace.  *Note Spacing After Colons and Periods:
  127. Controlling Spacing.)
  128.  
  129. 
  130. File: texi.info,  Node: Dots Bullets,  Next: TeX and copyright,  Prev: dmn,  Up: Insertions
  131.  
  132. Inserting Ellipsis, Dots, and Bullets
  133. =====================================
  134.  
  135.    An "ellipsis" (a line of dots) is not typeset as a string of
  136. periods, so a special command is used for ellipsis in Texinfo.  The
  137. `@bullet' command is special, too.  Each of these commands is followed
  138. by a pair of braces, `{}', without any whitespace between the name of
  139. the command and the braces.  (You need to use braces with these
  140. commands because you can use them next to other text; without the
  141. braces, the formatters would be confused.  *Note @-Command Syntax:
  142. Command Syntax, for further information.)
  143.  
  144. * Menu:
  145.  
  146. * dots::                        How to insert dots ...
  147. * bullet::                      How to insert a bullet.
  148.  
  149. 
  150. File: texi.info,  Node: dots,  Next: bullet,  Up: Dots Bullets
  151.  
  152. `@dots'{}
  153. ---------
  154.  
  155.    Use the `@dots{}' command to generate an ellipsis, which is three
  156. dots in a row, appropriately spaced, like this: `...'.  Do not simply
  157. write three periods in the input file; that would work for the Info
  158. file output, but would produce the wrong amount of space between the
  159. periods in the printed manual.
  160.  
  161. 
  162. File: texi.info,  Node: bullet,  Prev: dots,  Up: Dots Bullets
  163.  
  164. `@bullet'{}
  165. -----------
  166.  
  167.    Use the `@bullet{}' command to generate a large round dot, or the
  168. closest possible thing to one.  In Info, an asterisk is used.
  169.  
  170.    Here is a bullet: *
  171.  
  172.    When you use `@bullet' in `@itemize', you do not need to type the
  173. braces, because `@itemize' supplies them.  *Note itemize::.
  174.  
  175. 
  176. File: texi.info,  Node: TeX and copyright,  Next: minus,  Prev: Dots Bullets,  Up: Insertions
  177.  
  178. Inserting TeX and the Copyright Symbol
  179. ======================================
  180.  
  181.    The logo `TeX' is typeset in a special fashion and it needs an
  182. @-command.  The copyright symbol, `(C)', is also special.  Each of
  183. these commands is followed by a pair of braces, `{}', without any
  184. whitespace between the name of the command and the braces.
  185.  
  186. * Menu:
  187.  
  188. * tex::                         How to insert the TeX logo.
  189. * copyright symbol::            How to use `@copyright'{}.
  190.  
  191. 
  192. File: texi.info,  Node: tex,  Next: copyright symbol,  Up: TeX and copyright
  193.  
  194. `@TeX'{}
  195. --------
  196.  
  197.    Use the `@TeX{}' command to generate `TeX'.  In a printed manual,
  198. this is a special logo that is different from three ordinary letters.
  199. In Info, it just looks like `TeX'.  The `@TeX{}' command is unique
  200. among Texinfo commands in that the T and the X are in upper case.
  201.  
  202. 
  203. File: texi.info,  Node: copyright symbol,  Prev: tex,  Up: TeX and copyright
  204.  
  205. `@copyright'{}
  206. --------------
  207.  
  208.    Use the `@copyright{}' command to generate `(C)'.  In a printed
  209. manual, this is a `c' inside a circle, and in Info, this is `(C)'.
  210.  
  211. 
  212. File: texi.info,  Node: minus,  Prev: TeX and copyright,  Up: Insertions
  213.  
  214. `@minus'{}: Inserting a Minus Sign
  215. ==================================
  216.  
  217.    Use the `@minus{}' command to generate a minus sign.  In a
  218. fixed-width font, this is a single hyphen, but in a proportional font,
  219. the symbol is the customary length for a minus sign--a little longer
  220. than a hyphen.
  221.  
  222.    You can compare the two forms:
  223.  
  224.      `-' is a minus sign generated with `@minus{}',
  225.      
  226.      `-' is a hyphen generated with the character `-'.
  227.  
  228. In the fixed-width font used by Info, `@minus{}' is the same as a
  229. hyphen.
  230.  
  231.    You should not use `@minus{}' inside `@code' or `@example' because
  232. the width distinction is not made in the fixed-width font they use.
  233.  
  234.    When you use `@minus' to specify the mark beginning each entry in an
  235. itemized list, you do not need to type the braces (*note itemize::.).
  236.  
  237. 
  238. File: texi.info,  Node: Glyphs,  Next: Breaks,  Prev: Insertions,  Up: Top
  239.  
  240. Glyphs for Examples
  241. *******************
  242.  
  243.    In Texinfo, code is often illustrated in examples that are delimited
  244. by `@example' and `@end example', or by `@lisp' and `@end lisp'.  In
  245. such examples, you can indicate the results of evaluation or an
  246. expansion using `=>' or `==>'.  Likewise, there are commands to insert
  247. glyphs to indicate printed output, error messages, equivalence of
  248. expressions, and the location of point.
  249.  
  250.    The glyph-insertion commands do not need to be used within an
  251. example, but most often they are.  Every  glyph-insertion command is
  252. followed by a pair of left- and right-hand braces.
  253.  
  254. * Menu:
  255.  
  256. * Glyphs Summary::
  257. * result::                      How to show the result of expression.
  258. * expansion::                   How to indicate an expansion.
  259. * Print Glyph::                 How to indicate printed output.
  260. * Error Glyph::                 How to indicate an error message.
  261. * Equivalence::                 How to indicate equivalence.
  262. * Point Glyph::                 How to indicate the location of point.
  263.  
  264. 
  265. File: texi.info,  Node: Glyphs Summary,  Next: result,  Up: Glyphs
  266.  
  267. Glyphs Summary
  268. ==============
  269.  
  270.    Here are the different glyph commands:
  271.  
  272. =>
  273.      `@result{}' points to the result of an expression.
  274.  
  275. ==>
  276.      `@expansion{}' shows the results of a macro expansion.
  277.  
  278. -|
  279.      `@print{}' indicates printed output.
  280.  
  281. error-->
  282.      `@error{}' indicates that the following text is an error message.
  283.  
  284. ==
  285.      `@equiv{}' indicates the exact equivalence of two forms.
  286.  
  287. -!-
  288.      `@point{}' shows the location of point.
  289.  
  290. 
  291. File: texi.info,  Node: result,  Next: expansion,  Prev: Glyphs Summary,  Up: Glyphs
  292.  
  293. =>: Indicating Evaluation
  294. =========================
  295.  
  296.    Use the `@result{}' command to indicate the result of evaluating an
  297. expression.
  298.  
  299.    The `@result{}' command is displayed as `=>' in Info and as a double
  300. stemmed arrow in the printed output.
  301.  
  302.    Thus, the following,
  303.  
  304.      (cdr '(1 2 3))
  305.           => (2 3)
  306.  
  307. may be read as "`(cdr '(1 2 3))' evaluates to `(2 3)'".
  308.  
  309. 
  310. File: texi.info,  Node: expansion,  Next: Print Glyph,  Prev: result,  Up: Glyphs
  311.  
  312. ==>: Indicating an Expansion
  313. ============================
  314.  
  315.    When an expression is a macro call, it expands into a new expression.
  316. You can indicate the result of the expansion with the `@expansion{}'
  317. command.
  318.  
  319.    The `@expansion{}' command is displayed as `==>' in Info and as a
  320. long arrow with a flat base in the printed output.
  321.  
  322.    For example, the following
  323.  
  324.      @lisp
  325.      (third '(a b c))
  326.           @expansion{} (car (cdr (cdr '(a b c))))
  327.           @result{} c
  328.      @end lisp
  329.  
  330. produces
  331.  
  332.      (third '(a b c))
  333.           ==> (car (cdr (cdr '(a b c))))
  334.           => c
  335.  
  336. which may be read as:
  337.  
  338.      `(third '(a b c))' expands to `(car (cdr (cdr '(a b c))))'; the
  339.      result of evaluating the expression is `c'.
  340.  
  341. Often, as in this case, an example looks better if the `@expansion{}'
  342. and `@result{}' commands are indented five spaces.
  343.  
  344. 
  345. File: texi.info,  Node: Print Glyph,  Next: Error Glyph,  Prev: expansion,  Up: Glyphs
  346.  
  347. -|: Indicating Printed Output
  348. =============================
  349.  
  350.    Sometimes an expression will print output during its execution.  You
  351. can indicate the printed output with the `@print{}' command.
  352.  
  353.    The `@print{}' command is displayed as `-|' in Info and similarly,
  354. as a horizontal dash butting against a vertical bar, in the printed
  355. output.
  356.  
  357.    In the following example, the printed text is indicated with `-|',
  358. and the value of the expression follows on the last line.
  359.  
  360.      (progn (print 'foo) (print 'bar))
  361.           -| foo
  362.           -| bar
  363.           => bar
  364.  
  365. In a Texinfo source file, this example is written as follows:
  366.  
  367.      @lisp
  368.      (progn (print 'foo) (print 'bar))
  369.           @print{} foo
  370.           @print{} bar
  371.           @result{} bar
  372.      @end lisp
  373.  
  374. 
  375. File: texi.info,  Node: Error Glyph,  Next: Equivalence,  Prev: Print Glyph,  Up: Glyphs
  376.  
  377. error-->: Indicating an Error Message
  378. =====================================
  379.  
  380.    A piece of code may cause an error when you evaluate it.  You can
  381. designate the error message with the `@error{}' command.
  382.  
  383.    The `@error{}' command is displayed as `error-->' in Info and as the
  384. word `error' in a box in the printed output.
  385.  
  386.    Thus,
  387.  
  388.      @lisp
  389.      (+ 23 'x)
  390.      @error{} Wrong type argument: integer-or-marker-p, x
  391.      @end lisp
  392.  
  393. produces
  394.  
  395.      (+ 23 'x)
  396.      error--> Wrong type argument: integer-or-marker-p, x
  397.  
  398. This indicates that the following error message is printed when you
  399. evaluate the expression:
  400.  
  401.      Wrong type argument: integer-or-marker-p, x
  402.  
  403.    Note that `error-->' itself is not part of the error message.
  404.  
  405. 
  406. File: texi.info,  Node: Equivalence,  Next: Point Glyph,  Prev: Error Glyph,  Up: Glyphs
  407.  
  408. ==: Indicating Equivalence
  409. ==========================
  410.  
  411.    Sometimes two expressions produce identical results.  You can
  412. indicate the exact equivalence of two forms with the `@equiv{}' command.
  413.  
  414.    The `@equiv{}' command is displayed as `==' in Info and as a three
  415. parallel horizontal lines in the printed output.
  416.  
  417.    Thus,
  418.  
  419.      @lisp
  420.      (make-sparse-keymap) @equiv{} (list 'keymap)
  421.      @end lisp
  422.  
  423. produces
  424.  
  425.      (make-sparse-keymap) == (list 'keymap)
  426.  
  427. This indicates that evaluating `(make-sparse-keymap)' produces
  428. identical results to evaluating `(list 'keymap)'.
  429.  
  430. 
  431. File: texi.info,  Node: Point Glyph,  Prev: Equivalence,  Up: Glyphs
  432.  
  433. Indicating Point in a Buffer
  434. ============================
  435.  
  436.    Sometimes you need to show an example of text in an Emacs buffer.  In
  437. such examples, the convention is to include the entire contents of the
  438. buffer in question between two lines of dashes containing the buffer
  439. name.
  440.  
  441.    You can use the `@point{}' command to show the location of point in
  442. the text in the buffer.  (The symbol for point, of course, is not part
  443. of the text in the buffer; it indicates the place *between* two
  444. characters where point is located.)
  445.  
  446.    The `@point{}' command is displayed as `-!-' in Info and as a small
  447. five pointed star in the printed output.
  448.  
  449.    The following example shows the contents of buffer `foo' before and
  450. after evaluating a Lisp command to insert the word `changed'.
  451.  
  452.      ---------- Buffer: foo ----------
  453.      This is the -!-contents of foo.
  454.      ---------- Buffer: foo ----------
  455.  
  456.      (insert "changed ")
  457.           => nil
  458.      ---------- Buffer: foo ----------
  459.      This is the changed -!-contents of foo.
  460.      ---------- Buffer: foo ----------
  461.  
  462.    In a Texinfo source file, the example is written like this:
  463.  
  464.      @example
  465.      ---------- Buffer: foo ----------
  466.      This is the @point{}contents of foo.
  467.      ---------- Buffer: foo ----------
  468.      
  469.      (insert "changed ")
  470.           @result{} nil
  471.      ---------- Buffer: foo ----------
  472.      This is the changed @point{}contents of foo.
  473.      ---------- Buffer: foo ----------
  474.      @end example
  475.  
  476. 
  477. File: texi.info,  Node: Breaks,  Next: Definition Commands,  Prev: Glyphs,  Up: Top
  478.  
  479. Making and Preventing Breaks
  480. ****************************
  481.  
  482.    Usually, a Texinfo file is processed both by TeX and by one of the
  483. Info formatting commands.  Line, paragraph, or page breaks sometimes
  484. occur in the `wrong' place in one or other form of output.  You must
  485. ensure that text looks right both in the printed manual and in the Info
  486. file.
  487.  
  488.    For example, in a printed manual, page breaks may occur awkwardly in
  489. the middle of an example; to prevent this, you can hold text together
  490. using a grouping command that keeps the text from being split across
  491. two pages.  Conversely, you may want to force a page break where none
  492. would occur normally.  Fortunately, problems like these do not often
  493. arise.  When they do, use the break, break prevention, or pagination
  494. commands.
  495.  
  496. * Menu:
  497.  
  498. * Break Commands::              Cause and prevent splits.
  499. * Line Breaks::                 How to force a single line to use two lines.
  500. * w::                           How to prevent unwanted line breaks.
  501. * sp::                          How to insert blank lines.
  502. * page::                        How to force the start of a new page.
  503. * group::                       How to prevent unwanted page breaks.
  504. * need::                        Another way to prevent unwanted page breaks.
  505.  
  506. 
  507. File: texi.info,  Node: Break Commands,  Next: Line Breaks,  Up: Breaks
  508.  
  509. The Break Commands
  510. ==================
  511.  
  512.    The break commands create line and paragraph breaks:
  513.  
  514. `@*'
  515.      Force a line break.
  516.  
  517. `@sp N'
  518.      Skip N blank lines.
  519.  
  520.    The line-break-prevention command holds text together all on one
  521. line:
  522.  
  523. `@w{TEXT}'
  524.      Prevent TEXT from being split and hyphenated across two lines.
  525.  
  526.    The pagination commands apply only to printed output, since Info
  527. files do not have pages.
  528.  
  529. `@page'
  530.      Start a new page in the printed manual.
  531.  
  532. `@group'
  533.      Hold text together that must appear on one printed page.
  534.  
  535. `@need MILS'
  536.      Start a new printed page if not enough space on this one.
  537.  
  538. 
  539. File: texi.info,  Node: Line Breaks,  Next: w,  Prev: Break Commands,  Up: Breaks
  540.  
  541. `@*': Generate Line Breaks
  542. ==========================
  543.  
  544.    The `@*' command forces a line break in both the printed manual and
  545. in Info.
  546.  
  547.    For example,
  548.  
  549.      This line @* is broken @*in two places.
  550.  
  551. produces
  552.  
  553.      This line
  554.       is broken
  555.      in two places.
  556.  
  557. (Note that the space after the first `@*' command is faithfully carried
  558. down to the next line.)
  559.  
  560.    The `@*' command is often used in a file's copyright page:
  561.  
  562.      This is edition 2.0 of the Texinfo documentation,@*
  563.      and is for ...
  564.  
  565. In this case, the `@*' command keeps TeX from stretching the line
  566. across the whole page in an ugly manner.
  567.  
  568.      *Please note:* Do not write braces after an `@*' command; they are
  569.      not needed.
  570.  
  571.      Do not write an `@refill' command at the end of a paragraph
  572.      containing an `@*' command; it will cause the paragraph to be
  573.      refilled after the line break occurs, negating the effect of the
  574.      line break.
  575.  
  576. 
  577. File: texi.info,  Node: w,  Next: sp,  Prev: Line Breaks,  Up: Breaks
  578.  
  579. `@w'{TEXT}: Prevent Line Breaks
  580. ===============================
  581.  
  582.    `@w{TEXT}' outputs TEXT and prohibits line breaks within TEXT.
  583.  
  584.    You can use the `@w' command to prevent TeX from automatically
  585. hyphenating a long name or phrase that accidentally falls near the end
  586. of a line.
  587.  
  588.      You can copy GNU software from @w{@file{prep.ai.mit.edu}}.
  589.  
  590. produces
  591.  
  592.      You can copy GNU software from `prep.ai.mit.edu'.
  593.  
  594.    In the Texinfo file, you must write the `@w' command and its
  595. argument (all the affected text) all on one line.
  596.  
  597.      *Caution:* Do not write an `@refill' command at the end of a
  598.      paragraph containing an `@w' command; it will cause the paragraph
  599.      to be refilled and may thereby negate the effect of the `@w'
  600.      command.
  601.  
  602. 
  603. File: texi.info,  Node: sp,  Next: page,  Prev: w,  Up: Breaks
  604.  
  605. `@sp' N: Insert Blank Lines
  606. ===========================
  607.  
  608.    A line beginning with and containing only `@sp N' generates N blank
  609. lines of space in both the printed manual and the Info file.  `@sp'
  610. also forces a paragraph break.  For example,
  611.  
  612.      @sp 2
  613.  
  614. generates two blank lines.
  615.  
  616.    The `@sp' command is most often used in the title page.
  617.  
  618. 
  619. File: texi.info,  Node: page,  Next: group,  Prev: sp,  Up: Breaks
  620.  
  621. `@page': Start a New Page
  622. =========================
  623.  
  624.    A line containing only `@page' starts a new page in a printed
  625. manual.  The command has no effect on Info files since they are not
  626. paginated.  An `@page' command is often used in the `@titlepage'
  627. section of a Texinfo file to start the copyright page.
  628.  
  629. 
  630. File: texi.info,  Node: group,  Next: need,  Prev: page,  Up: Breaks
  631.  
  632. `@group': Prevent Page Breaks
  633. =============================
  634.  
  635.    The `@group' command (on a line by itself) is used inside an
  636. `@example' or similar construct to begin an unsplittable vertical
  637. group, which will appear entirely on one page in the printed output.
  638. The group is terminated by a line containing only `@end group'.  These
  639. two lines produce no output of their own, and in the Info file output
  640. they have no effect at all.
  641.  
  642.    Although `@group' would make sense conceptually in a wide variety of
  643. contexts, its current implementation works reliably only within
  644. `@example' and variants, and within `@display', `@format', `@flushleft'
  645. and `@flushright'.  *Note Quotations and Examples::.  (What all these
  646. commands have in common is that each line of input produces a line of
  647. output.)  In other contexts, `@group' can cause anomalous vertical
  648. spacing.
  649.  
  650.    This formatting requirement means that you should write:
  651.  
  652.      @example
  653.      @group
  654.      ...
  655.      @end group
  656.      @end example
  657.  
  658. with the `@group' and `@end group' commands inside the `@example' and
  659. `@end example' commands.
  660.  
  661.    The `@group' command is most often used to hold an example together
  662. on one page.  In this Texinfo manual, more than 100 examples contain
  663. text that is enclosed between `@group' and `@end group'.
  664.  
  665.    If you forget to end a group, you may get strange and unfathomable
  666. error messages when you run TeX.  This is because TeX keeps trying to
  667. put the rest of the Texinfo file onto the one page and does not start
  668. to generate error messages until it has processed considerable text.
  669. It is a good rule of thumb to look for a missing `@end group' if you
  670. get incomprehensible error messages in TeX.
  671.  
  672. 
  673. File: texi.info,  Node: need,  Prev: group,  Up: Breaks
  674.  
  675. `@need MILS': Prevent Page Breaks
  676. =================================
  677.  
  678.    A line containing only `@need N' starts a new page in a printed
  679. manual if fewer than N mils (thousandths of an inch) remain on the
  680. current page.  Do not use braces around the argument N.  The `@need'
  681. command has no effect on Info files since they are not paginated.
  682.  
  683.    This paragraph is preceded by an `@need' command that tells TeX to
  684. start a new page if fewer than 800 mils (eight-tenths inch) remain on
  685. the page.  It looks like this:
  686.  
  687.      @need 800
  688.      This paragraph is preceded by ...
  689.  
  690.    The `@need' command is useful for preventing orphans (single lines
  691. at the bottoms of printed pages).
  692.  
  693. 
  694. File: texi.info,  Node: Definition Commands,  Next: Footnotes,  Prev: Breaks,  Up: Top
  695.  
  696. Definition Commands
  697. *******************
  698.  
  699.    The `@deffn' command and the other "definition commands" enable you
  700. to describe functions, variables, macros, commands, user options,
  701. special forms and other such artifacts in a uniform format.
  702.  
  703.    In the Info file, a definition causes the entity
  704. category--`Function', `Variable', or whatever--to appear at the
  705. beginning of the first line of the definition, followed by the entity's
  706. name and arguments.  In the printed manual, the command causes TeX to
  707. print the entity's name and its arguments on the left margin and print
  708. the category next to the right margin.  In both output formats, the
  709. body of the definition is indented.  Also, the name of the entity is
  710. entered into the appropriate index: `@deffn' enters the name into the
  711. index of functions, `@defvr' enters it into the index of variables, and
  712. so on.
  713.  
  714.    A manual need not and should not contain more than one definition for
  715. a given name.  An appendix containing a summary should use `@table'
  716. rather than the definition commands.
  717.  
  718. * Menu:
  719.  
  720. * Def Cmd Template::            How to structure a description using a
  721.                                   definition command.
  722. * Optional Arguments::          How to handle optional and repeated arguments.
  723. * deffnx::                      How to group two or more `first' lines.
  724. * Def Cmds in Detail::          All the definition commands.
  725. * Def Cmd Conventions::         Conventions for writing definitions.
  726. * Sample Function Definition::
  727.  
  728. 
  729. File: texi.info,  Node: Def Cmd Template,  Next: Optional Arguments,  Up: Definition Commands
  730.  
  731. The Template for a Definition
  732. =============================
  733.  
  734.    The `@deffn' command is used for definitions of entities that
  735. resemble functions.  To write a definition using the `@deffn' command,
  736. write the `@deffn' command at the beginning of a line and follow it on
  737. the same line by the category of the entity, the name of the entity
  738. itself, and its arguments (if any).  Then write the body of the
  739. definition on succeeding lines.  (You may embed examples in the body.)
  740. Finally, end the definition with an `@end deffn' command written on a
  741. line of its own.  (The other definition commands follow the same
  742. format.)
  743.  
  744.    The template for a definition looks like this:
  745.  
  746.      @deffn CATEGORY NAME ARGUMENTS...
  747.      BODY-OF-DEFINITION
  748.      @end deffn
  749.  
  750. For example,
  751.  
  752.      @deffn Command forward-word count
  753.      This command moves point forward @var{count} words
  754.      (or backward if @var{count} is negative). ...
  755.      @end deffn
  756.  
  757. produces
  758.  
  759.       - Command: forward-word COUNT
  760.           This function moves point forward COUNT words (or backward if
  761.           COUNT is negative). ...
  762.  
  763.    Capitalize the category name like a title.  If the name of the
  764. category contains spaces, as in the phrase `Interactive Command', write
  765. braces around it.  For example:
  766.  
  767.      @deffn {Interactive Command} isearch-forward
  768.      ...
  769.      @end deffn
  770.  
  771. Otherwise, the second word will be mistaken for the name of the entity.
  772.  
  773.    Some of the definition commands are more general than others.  The
  774. `@deffn' command, for example, is the general definition command for
  775. functions and the like--for entities that may take arguments.  When you
  776. use this command, you specify the category to which the entity belongs.
  777. The `@deffn' command possesses three predefined, specialized
  778. variations, `@defun', `@defmac', and `@defspec', that specify the
  779. category for you: "Function", "Macro", and "Special Form" respectively.
  780. The `@defvr' command also is accompanied by several predefined,
  781. specialized variations for describing particular kinds of variables.
  782.  
  783.    The template for a specialized definition, such as `@defun', is
  784. similar to the template for a generalized definition, except that you
  785. do not need to specify the category:
  786.  
  787.      @defun NAME ARGUMENTS...
  788.      BODY-OF-DEFINITION
  789.      @end defun
  790.  
  791. Thus,
  792.  
  793.      @defun buffer-end flag
  794.      This function returns @code{(point-min)} if @var{flag}
  795.      is less than 1, @code{(point-max)} otherwise.
  796.      ...
  797.      @end defun
  798.  
  799. produces
  800.  
  801.       - Function: buffer-end FLAG
  802.           This function returns `(point-min)' if FLAG is less than 1,
  803.           `(point-max)' otherwise.  ...
  804.  
  805. *Note Sample Function Definition: Sample Function Definition, for a
  806. more detailed example of a function definition, including the use of
  807. `@example' inside the definition.
  808.  
  809.    The other specialized commands work like `@defun'.
  810.  
  811. 
  812. File: texi.info,  Node: Optional Arguments,  Next: deffnx,  Prev: Def Cmd Template,  Up: Definition Commands
  813.  
  814. Optional and Repeated Arguments
  815. ===============================
  816.  
  817.    Some entities take optional or repeated arguments, which may be
  818. specified by a distinctive glyph that uses square brackets and
  819. ellipses.  For example, a special form often breaks its argument list
  820. into separate arguments in more complicated ways than a straightforward
  821. function.
  822.  
  823.    An argument enclosed within square brackets is optional.  Thus,
  824. [OPTIONAL-ARG] means that OPTIONAL-ARG is optional.  An argument
  825. followed by an ellipsis is optional and may be repeated more than once.
  826. Thus, REPEATED-ARGS... stands for zero or more arguments.  Parentheses
  827. are used when several arguments are grouped into additional levels of
  828. list structure in Lisp.
  829.  
  830.    Here is the `@defspec' line of an example of an imaginary special
  831. form:
  832.  
  833.       - Special Form: foobar (VAR [FROM TO [INC]]) BODY...
  834.  
  835. In this example, the arguments FROM and TO are optional, but must both
  836. be present or both absent.  If they are present, INC may optionally be
  837. specified as well.  These arguments are grouped with the argument VAR
  838. into a list, to distinguish them from BODY, which includes all
  839. remaining elements of the form.
  840.  
  841.    In a Texinfo source file, this `@defspec' line is written like this
  842. (except it would not be split over two lines, as it is in this example).
  843.  
  844.      @defspec foobar (@var{var} [@var{from} @var{to}
  845.           [@var{inc}]]) @var{body}@dots{}
  846.  
  847. The function is listed in the Command and Variable Index under `foobar'.
  848.  
  849. 
  850. File: texi.info,  Node: deffnx,  Next: Def Cmds in Detail,  Prev: Optional Arguments,  Up: Definition Commands
  851.  
  852. Two or More `First' Lines
  853. =========================
  854.  
  855.    To create two or more `first' or header lines for a definition,
  856. follow the first `@deffn' line by a line beginning with `@deffnx'.  The
  857. `@deffnx' command works exactly like `@deffn' except that it does not
  858. generate extra vertical white space between it and the preceding line.
  859.  
  860.    For example,
  861.  
  862.      @deffn {Interactive Command} isearch-forward
  863.      @deffnx {Interactive Command} isearch-backward
  864.      These two search commands are similar except ...
  865.      @end deffn
  866.  
  867. produces
  868.  
  869.  - Interactive Command: isearch-forward
  870.  - Interactive Command: isearch-backward
  871.      These two search commands are similar except ...
  872.  
  873.    Each of the other definition commands has an `x' form: `@defunx',
  874. `@defvrx', `@deftypefunx', etc.
  875.  
  876.    The `x' forms work just like `@itemx'; see *Note `@itemx': itemx.
  877.  
  878. 
  879. File: texi.info,  Node: Def Cmds in Detail,  Next: Def Cmd Conventions,  Prev: deffnx,  Up: Definition Commands
  880.  
  881. The Definition Commands
  882. =======================
  883.  
  884.    Texinfo provides more than a dozen definition commands, all of which
  885. are described in this section.
  886.  
  887.    The definition commands automatically enter the name of the entity in
  888. the appropriate index: for example, `@deffn', `@defun', and `@defmac'
  889. enter function names in the index of functions; `@defvr' and `@defvar'
  890. enter variable names in the index of variables.
  891.  
  892.    Although the examples that follow mostly illustrate Lisp, the
  893. commands can be used for other programming languages.
  894.  
  895. * Menu:
  896.  
  897. * Functions Commands::          Commands for functions and similar entities.
  898. * Variables Commands::          Commands for variables and similar entities.
  899. * Typed Functions::             Commands for functions in typed languages.
  900. * Typed Variables::             Commands for variables in typed languages.
  901. * Abstract Objects::            Commands for object-oriented programming.
  902. * Data Types::                  The definition command for data types.
  903.  
  904. 
  905. File: texi.info,  Node: Functions Commands,  Next: Variables Commands,  Up: Def Cmds in Detail
  906.  
  907. Functions and Similar Entities
  908. ------------------------------
  909.  
  910.    This section describes the commands for describing functions and
  911. similar entities:
  912.  
  913. `@deffn CATEGORY NAME ARGUMENTS...'
  914.      The `@deffn' command is the general definition command for
  915.      functions, interactive commands, and similar entities that may take
  916.      arguments.  You must choose a term to describe the category of
  917.      entity being defined; for example, "Function" could be used if the
  918.      entity is a function.  The `@deffn' command is written at the
  919.      beginning of a line and is followed on the same line by the
  920.      category of entity being described, the name of this particular
  921.      entity, and its arguments, if any.  Terminate the definition with
  922.      `@end deffn' on a line of its own.
  923.  
  924.      For example, here is a definition:
  925.  
  926.           @deffn Command forward-char nchars
  927.           Move point forward @var{nchars} characters.
  928.           @end deffn
  929.  
  930.      This shows a rather terse definition for a "command" named
  931.      `forward-char' with one argument, NCHARS.
  932.  
  933.      `@deffn' prints argument names such as NCHARS in italics or upper
  934.      case, as if `@var' had been used, because we think of these names
  935.      as metasyntactic variables--they stand for the actual argument
  936.      values.  Within the text of the description, write an argument name
  937.      explicitly with `@var' to refer to the value of the argument.  In
  938.      the example above, we used `@var{nchars}' in this way.
  939.  
  940.      The template for `@deffn' is:
  941.  
  942.           @deffn CATEGORY NAME ARGUMENTS...
  943.           BODY-OF-DEFINITION
  944.           @end deffn
  945.  
  946. `@defun NAME ARGUMENTS...'
  947.      The `@defun' command is the definition command for functions.
  948.      `@defun' is equivalent to `@deffn Function ...'.
  949.  
  950.      For example,
  951.  
  952.           @defun set symbol new-value
  953.           Change the value of the symbol @var{symbol}
  954.           to @var{new-value}.
  955.           @end defun
  956.  
  957.      shows a rather terse definition for a function `set' whose
  958.      arguments are SYMBOL and NEW-VALUE.  The argument names on the
  959.      `@defun' line automatically appear in italics or upper case as if
  960.      they were enclosed in `@var'.  Terminate the definition with `@end
  961.      defun' on a line of its own.
  962.  
  963.      The template is:
  964.  
  965.           @defun FUNCTION-NAME ARGUMENTS...
  966.           BODY-OF-DEFINITION
  967.           @end defun
  968.  
  969.      `@defun' creates an entry in the index of functions.
  970.  
  971. `@defmac NAME ARGUMENTS...'
  972.      The `@defmac' command is the definition command for macros.
  973.      `@defmac' is equivalent to `@deffn Macro ...' and works like
  974.      `@defun'.
  975.  
  976. `@defspec NAME ARGUMENTS...'
  977.      The `@defspec' command is the definition command for special
  978.      forms.  (In Lisp, a special form is an entity much like a
  979.      function.) `@defspec' is equivalent to `@deffn {Special Form} ...'
  980.      and works like `@defun'.
  981.  
  982. 
  983. File: texi.info,  Node: Variables Commands,  Next: Typed Functions,  Prev: Functions Commands,  Up: Def Cmds in Detail
  984.  
  985. Variables and Similar Entities
  986. ------------------------------
  987.  
  988.    Here are the commands for defining variables and similar entities:
  989.  
  990. `@defvr CATEGORY NAME'
  991.      The `@defvr' command is a general definition command for something
  992.      like a variable--an entity that records a value.  You must choose
  993.      a term to describe the category of entity being defined; for
  994.      example, "Variable" could be used if the entity is a variable.
  995.      Write the `@defvr' command at the beginning of a line and followed
  996.      it on the same line by the category of the entity and the name of
  997.      the entity.
  998.  
  999.      Capitalize the category name like a title.  If the name of the
  1000.      category contains spaces, as in the name `User Option', write
  1001.      braces around it.  Otherwise, the second word will be mistaken for
  1002.      the name of the entity, for example:
  1003.  
  1004.           @defvr {User Option} fill-column
  1005.           This buffer-local variable specifies
  1006.           the maximum width of filled lines.
  1007.           ...
  1008.           @end defvr
  1009.  
  1010.      Terminate the definition with `@end defvr' on a line of its own.
  1011.  
  1012.      The template is:
  1013.  
  1014.           @defvr CATEGORY NAME
  1015.           BODY-OF-DEFINITION
  1016.           @end defvr
  1017.  
  1018.      `@defvr' creates an entry in the index of variables for NAME.
  1019.  
  1020. `@defvar NAME'
  1021.      The `@defvar' command is the definition command for variables.
  1022.      `@defvar' is equivalent to `@defvr Variable ...'.
  1023.  
  1024.      For example:
  1025.  
  1026.           @defvar kill-ring
  1027.           ...
  1028.           @end defvar
  1029.  
  1030.      The template is:
  1031.  
  1032.           @defvar NAME
  1033.           BODY-OF-DEFINITION
  1034.           @end defvar
  1035.  
  1036.      `@defvar' creates an entry in the index of variables for NAME.
  1037.  
  1038. `@defopt NAME'
  1039.      The `@defopt' command is the definition command for user options.
  1040.      `@defopt' is equivalent to `@defvr {User Option} ...' and works
  1041.      like `@defvar'.
  1042.  
  1043. 
  1044. File: texi.info,  Node: Typed Functions,  Next: Typed Variables,  Prev: Variables Commands,  Up: Def Cmds in Detail
  1045.  
  1046. Functions in Typed Languages
  1047. ----------------------------
  1048.  
  1049.    The `@deftypefn' command and its variations are for describing
  1050. functions in C or any other language in which you must declare types of
  1051. variables and functions.
  1052.  
  1053. `@deftypefn CATEGORY DATA-TYPE NAME ARGUMENTS...'
  1054.      The `@deftypefn' command is the general definition command for
  1055.      functions and similar entities that may take arguments and that are
  1056.      typed.  The `@deftypefn' command is written at the beginning of a
  1057.      line and is followed on the same line by the category of entity
  1058.      being described, the type of the returned value, the name of this
  1059.      particular entity, and its arguments, if any.
  1060.  
  1061.      For example,
  1062.  
  1063.           @deftypefn {Library Function} int foobar
  1064.              (int @var{foo}, float @var{bar})
  1065.           ...
  1066.           @end deftypefn
  1067.  
  1068.      (where the text before the "...", shown above as two lines, would
  1069.      actually be a single line in a real Texinfo file) produces the
  1070.      following in Info:
  1071.  
  1072.           -- Library Function: int foobar (int FOO, float BAR)
  1073.           ...
  1074.  
  1075.      This means that `foobar' is a "library function" that returns an
  1076.      `int', and its arguments are FOO (an `int') and BAR (a `float').
  1077.  
  1078.      The argument names that you write in `@deftypefn' are not subject
  1079.      to an implicit `@var'--since the actual names of the arguments in
  1080.      `@deftypefn' are typically scattered among data type names and
  1081.      keywords, Texinfo cannot find them without help.  Instead, you
  1082.      must write `@var' explicitly around the argument names.  In the
  1083.      example above, the argument names are `foo' and `bar'.
  1084.  
  1085.      The template for `@deftypefn' is:
  1086.  
  1087.           @deftypefn CATEGORY DATA-TYPE NAME ARGUMENTS ...
  1088.           BODY-OF-DESCRIPTION
  1089.           @end deftypefn
  1090.  
  1091.      Note that if the CATEGORY or DATA TYPE is more than one word then
  1092.      it must be enclosed in braces to make it a single argument.
  1093.  
  1094.      If you are describing a procedure in a language that has packages,
  1095.      such as Ada, you might consider using `@deftypefn' in a manner
  1096.      somewhat contrary to the convention described in the preceding
  1097.      paragraphs.
  1098.  
  1099.      For example:
  1100.  
  1101.           @deftypefn stacks private push
  1102.                   (@var{s}:in out stack;
  1103.                   @var{n}:in integer)
  1104.           ...
  1105.           @end deftypefn
  1106.  
  1107.      (The `@deftypefn' arguments are shown split into three lines, but
  1108.      would be a single line in a real Texinfo file.)
  1109.  
  1110.      In this instance, the procedure is classified as belonging to the
  1111.      package `stacks' rather than classified as a `procedure' and its
  1112.      data type is described as `private'.  (The name of the procedure
  1113.      is `push', and its arguments are S and N.)
  1114.  
  1115.      `@deftypefn' creates an entry in the index of functions for NAME.
  1116.  
  1117. `@deftypefun DATA-TYPE NAME ARGUMENTS...'
  1118.      The `@deftypefun' command is the specialized definition command
  1119.      for functions in typed languages.  The command is equivalent to
  1120.      `@deftypefn Function ...'.
  1121.  
  1122.      Thus,
  1123.  
  1124.           @deftypefun int foobar (int @var{foo}, float @var{bar})
  1125.           ...
  1126.           @end deftypefun
  1127.  
  1128.      produces the following in Info:
  1129.  
  1130.           -- Function: int foobar (int FOO, float BAR)
  1131.           ...
  1132.  
  1133.      The template is:
  1134.  
  1135.           @deftypefun TYPE NAME ARGUMENTS...
  1136.           BODY-OF-DESCRIPTION
  1137.           @end deftypefun
  1138.  
  1139.      `@deftypefun' creates an entry in the index of functions for NAME.
  1140.  
  1141. 
  1142. File: texi.info,  Node: Typed Variables,  Next: Abstract Objects,  Prev: Typed Functions,  Up: Def Cmds in Detail
  1143.  
  1144. Variables in Typed Languages
  1145. ----------------------------
  1146.  
  1147.    Variables in typed languages are handled in a manner similar to
  1148. functions in typed languages.  *Note Typed Functions::.  The general
  1149. definition command `@deftypevr' corresponds to `@deftypefn' and the
  1150. specialized definition command `@deftypevar' corresponds to
  1151. `@deftypefun'.
  1152.  
  1153. `@deftypevr CATEGORY DATA-TYPE NAME'
  1154.      The `@deftypevr' command is the general definition command for
  1155.      something like a variable in a typed language--an entity that
  1156.      records a value.  You must choose a term to describe the category
  1157.      of the entity being defined; for example, "Variable" could be used
  1158.      if the entity is a variable.
  1159.  
  1160.      The `@deftypevr' command is written at the beginning of a line and
  1161.      is followed on the same line by the category of the entity being
  1162.      described, the data type, and the name of this particular entity.
  1163.  
  1164.      For example:
  1165.  
  1166.           @deftypevr {Global Flag} int enable
  1167.           ...
  1168.           @end deftypevr
  1169.  
  1170.      produces the following in Info:
  1171.  
  1172.           -- Global Flag: int enable
  1173.           ...
  1174.  
  1175.      The template is:
  1176.  
  1177.           @deftypevr CATEGORY DATA-TYPE NAME
  1178.           BODY-OF-DESCRIPTION
  1179.           @end deftypevr
  1180.  
  1181.      `@deftypevr' creates an entry in the index of variables for NAME.
  1182.  
  1183. `@deftypevar DATA-TYPE NAME'
  1184.      The `@deftypevar' command is the specialized definition command
  1185.      for variables in typed languages.  `@deftypevar' is equivalent to
  1186.      `@deftypevr Variable ...'.
  1187.  
  1188.      For example:
  1189.  
  1190.           @deftypevar int fubar
  1191.           ...
  1192.           @end deftypevar
  1193.  
  1194.      produces the following in Info:
  1195.  
  1196.           -- Variable: int fubar
  1197.           ...
  1198.  
  1199.      The template is:
  1200.  
  1201.           @deftypevar DATA-TYPE NAME
  1202.           BODY-OF-DESCRIPTION
  1203.           @end deftypevar
  1204.  
  1205.      `@deftypevar' creates an entry in the index of variables for NAME.
  1206.  
  1207. 
  1208. File: texi.info,  Node: Abstract Objects,  Next: Data Types,  Prev: Typed Variables,  Up: Def Cmds in Detail
  1209.  
  1210. Object-Oriented Programming
  1211. ---------------------------
  1212.  
  1213.    Here are the commands for formatting descriptions about abstract
  1214. objects, such as are used in object-oriented programming.  A class is a
  1215. defined type of abstract object.  An instance of a class is a
  1216. particular object that has the type of the class.  An instance variable
  1217. is a variable that belongs to the class but for which each instance has
  1218. its own value.
  1219.  
  1220.    In a definition, if the name of a class is truly a name defined in
  1221. the programming system for a class, then you should write an `@code'
  1222. around it.  Otherwise, it is printed in the usual text font.
  1223.  
  1224. `@defcv CATEGORY CLASS NAME'
  1225.      The `@defcv' command is the general definition command for
  1226.      variables associated with classes in object-oriented programming.
  1227.      The `@defcv' command is followed by three arguments: the category
  1228.      of thing being defined, the class to which it belongs, and its
  1229.      name.  Thus,
  1230.  
  1231.           @defcv {Class Option} Window border-pattern
  1232.           ...
  1233.           @end defcv
  1234.  
  1235.      illustrates how you would write the first line of a definition of
  1236.      the `border-pattern' class option of the class `Window'.
  1237.  
  1238.      The template is
  1239.  
  1240.           @defcv CATEGORY CLASS NAME
  1241.           ...
  1242.           @end defcv
  1243.  
  1244.      `@defcv' creates an entry in the index of variables.
  1245.  
  1246. `@defivar CLASS NAME'
  1247.      The `@defivar' command is the definition command for instance
  1248.      variables in object-oriented programming.  `@defivar' is
  1249.      equivalent to `@defcv {Instance Variable} ...'
  1250.  
  1251.      The template is:
  1252.  
  1253.           @defivar CLASS INSTANCE-VARIABLE-NAME
  1254.           BODY-OF-DEFINITION
  1255.           @end defivar
  1256.  
  1257.      `@defivar' creates an entry in the index of variables.
  1258.  
  1259. `@defop CATEGORY CLASS NAME ARGUMENTS...'
  1260.      The `@defop' command is the general definition command for
  1261.      entities that may resemble methods in object-oriented programming.
  1262.      These entities take arguments, as functions do, but are associated
  1263.      with particular classes of objects.
  1264.  
  1265.      For example, some systems have constructs called "wrappers" that
  1266.      are associated with classes as methods are, but that act more like
  1267.      macros than like functions.  You could use `@defop Wrapper' to
  1268.      describe one of these.
  1269.  
  1270.      Sometimes it is useful to distinguish methods and "operations".
  1271.      You can think of an operation as the specification for a method.
  1272.      Thus, a window system might specify that all window classes have a
  1273.      method named `expose'; we would say that this window system
  1274.      defines an `expose' operation on windows in general.  Typically,
  1275.      the operation has a name and also specifies the pattern of
  1276.      arguments; all methods that implement the operation must accept
  1277.      the same arguments, since applications that use the operation do
  1278.      so without knowing which method will implement it.
  1279.  
  1280.      Often it makes more sense to document operations than methods.  For
  1281.      example, window application developers need to know about the
  1282.      `expose' operation, but need not be concerned with whether a given
  1283.      class of windows has its own method to implement this operation.
  1284.      To describe this operation, you would write:
  1285.  
  1286.           @defop Operation windows expose
  1287.  
  1288.      The `@defop' command is written at the beginning of a line and is
  1289.      followed on the same line by the overall name of the category of
  1290.      operation, the name of the class of the operation, the name of the
  1291.      operation, and its arguments, if any.
  1292.  
  1293.      The template is:
  1294.  
  1295.           @defop CATEGORY CLASS NAME ARGUMENTS...
  1296.           BODY-OF-DEFINITION
  1297.           @end defop
  1298.  
  1299.      `@defop' creates an entry, such as ``expose' on `windows'', in the
  1300.      index of functions.
  1301.  
  1302. `@defmethod CLASS NAME ARGUMENTS...'
  1303.      The `@defmethod' command is the definition command for methods in
  1304.      object-oriented programming.  A method is a kind of function that
  1305.      implements an operation for a particular class of objects and its
  1306.      subclasses.  In the Lisp Machine, methods actually were functions,
  1307.      but they were usually defined with `defmethod'.
  1308.  
  1309.      `@defmethod' is equivalent to `@defop Method ...'.  The command is
  1310.      written at the beginning of a line and is followed by the name of
  1311.      the class of the method, the name of the method, and its
  1312.      arguments, if any.
  1313.  
  1314.      For example,
  1315.  
  1316.           @defmethod `bar-class' bar-method argument
  1317.           ...
  1318.           @end defmethod
  1319.  
  1320.      illustrates the definition for a method called `bar-method' of the
  1321.      class `bar-class'.  The method takes an argument.
  1322.  
  1323.      The template is:
  1324.  
  1325.           @defmethod CLASS METHOD-NAME ARGUMENTS...
  1326.           BODY-OF-DEFINITION
  1327.           @end defmethod
  1328.  
  1329.      `@defmethod' creates an entry in the index of functions, such as
  1330.      ``bar-method' on `bar-class''.
  1331.  
  1332. 
  1333. File: texi.info,  Node: Data Types,  Prev: Abstract Objects,  Up: Def Cmds in Detail
  1334.  
  1335. Data Types
  1336. ----------
  1337.  
  1338.    Here is the command for data types:
  1339.  
  1340. `@deftp CATEGORY NAME ATTRIBUTES...'
  1341.      The `@deftp' command is the generic definition command for data
  1342.      types.  The command is written at the beginning of a line and is
  1343.      followed on the same line by the category, by the name of the type
  1344.      (which is a word like `int' or `float'), and then by names of
  1345.      attributes of objects of that type.  Thus, you could use this
  1346.      command for describing `int' or `float', in which case you could
  1347.      use `data type' as the category.  (A data type is a category of
  1348.      certain objects for purposes of deciding which operations can be
  1349.      performed on them.)
  1350.  
  1351.      In Lisp, for example,  "pair" names a particular data type, and an
  1352.      object of that type has two slots called the CAR and the CDR.
  1353.      Here is how you would write the first line of a definition of
  1354.      `pair'.
  1355.  
  1356.           @deftp {Data type} pair car cdr
  1357.           ...
  1358.           @end deftp
  1359.  
  1360.      The template is:
  1361.  
  1362.           @deftp CATEGORY NAME-OF-TYPE ATTRIBUTES...
  1363.           BODY-OF-DEFINITION
  1364.           @end deftp
  1365.  
  1366.      `@deftp' creates an entry in the index of data types.
  1367.  
  1368. 
  1369. File: texi.info,  Node: Def Cmd Conventions,  Next: Sample Function Definition,  Prev: Def Cmds in Detail,  Up: Definition Commands
  1370.  
  1371. Conventions for Writing Definitions
  1372. ===================================
  1373.  
  1374.    When you write a definition using `@deffn', `@defun', or one of the
  1375. other definition commands, please take care to use arguments that
  1376. indicate the meaning, as with the COUNT argument to the `forward-word'
  1377. function.  Also, if the name of an argument contains the name of a
  1378. type, such as INTEGER, take care that the argument actually is of that
  1379. type.
  1380.  
  1381. 
  1382. File: texi.info,  Node: Sample Function Definition,  Prev: Def Cmd Conventions,  Up: Definition Commands
  1383.  
  1384. A Sample Function Definition
  1385. ============================
  1386.  
  1387.    A function definition uses the `@defun' and `@end defun' commands.
  1388. The name of the function follows immediately after the `@defun' command
  1389. and it is followed, on the same line, by the parameter list.
  1390.  
  1391.    Here is a definition from `The GNU Emacs Lisp Reference Manual'.
  1392. (*Note Calling Functions: (elisp)Calling Functions.)
  1393.  
  1394.       - Function: apply FUNCTION &rest ARGUMENTS
  1395.           `apply' calls FUNCTION with ARGUMENTS, just like `funcall'
  1396.           but with one difference: the last of ARGUMENTS is a list of
  1397.           arguments to give to FUNCTION, rather than a single argument.
  1398.           We also say that this list is "appended" to the other
  1399.           arguments.
  1400.  
  1401.           `apply' returns the result of calling FUNCTION.  As with
  1402.           `funcall', FUNCTION must either be a Lisp function or a
  1403.           primitive function; special forms and macros do not make
  1404.           sense in `apply'.
  1405.  
  1406.                (setq f 'list)
  1407.                     => list
  1408.                (apply f 'x 'y 'z)
  1409.                error--> Wrong type argument: listp, z
  1410.                (apply '+ 1 2 '(3 4))
  1411.                     => 10
  1412.                (apply '+ '(1 2 3 4))
  1413.                     => 10
  1414.                
  1415.                (apply 'append '((a b c) nil (x y z) nil))
  1416.                     => (a b c x y z)
  1417.  
  1418.           An interesting example of using `apply' is found in the
  1419.           description of `mapcar'.
  1420.  
  1421.    In the Texinfo source file, this example looks like this:
  1422.  
  1423.      @defun apply function &rest arguments
  1424.      
  1425.      @code{apply} calls @var{function} with
  1426.      @var{arguments}, just like @code{funcall} but with one
  1427.      difference: the last of @var{arguments} is a list of
  1428.      arguments to give to @var{function}, rather than a single
  1429.      argument.  We also say that this list is @dfn{appended}
  1430.      to the other arguments.
  1431.      
  1432.      @code{apply} returns the result of calling
  1433.      @var{function}.  As with @code{funcall},
  1434.      @var{function} must either be a Lisp function or a
  1435.      primitive function; special forms and macros do not make
  1436.      sense in @code{apply}.
  1437.      
  1438.      @example
  1439.      (setq f 'list)
  1440.           @result{} list
  1441.      (apply f 'x 'y 'z)
  1442.      @error{} Wrong type argument: listp, z
  1443.      (apply '+ 1 2 '(3 4))
  1444.           @result{} 10
  1445.      (apply '+ '(1 2 3 4))
  1446.           @result{} 10
  1447.      
  1448.      (apply 'append '((a b c) nil (x y z) nil))
  1449.           @result{} (a b c x y z)
  1450.      @end example
  1451.      
  1452.      An interesting example of using @code{apply} is found
  1453.      in the description of @code{mapcar}.@refill
  1454.      @end defun
  1455.  
  1456. In this manual, this function is listed in the Command and Variable
  1457. Index under `apply'.
  1458.  
  1459.    Ordinary variables and user options are described using a format like
  1460. that for functions except that variables do not take arguments.
  1461.  
  1462.