home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / tinfo210.lzh / TINFO210 / ELISP / TEXINFO.EL < prev    next >
Lisp/Scheme  |  1991-09-27  |  22KB  |  604 lines

  1. ;;;; texinfo.el
  2.  
  3. ;;; Major mode for editing Texinfo files.
  4.  
  5. ;;; Version 2.08   26 September 1991
  6. ;;; Robert J. Chassell          
  7. ;;; Please send bug reports to:  bob@gnu.ai.mit.edu
  8.  
  9. ;; Copyright (C) 1985, 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
  10.  
  11.  
  12. ;;; This file is part of GNU Emacs.
  13.  
  14. ;; GNU Emacs is free software; you can redistribute it and/or modify
  15. ;; it under the terms of the GNU General Public License as published by
  16. ;; the Free Software Foundation; either version 1, or (at your option)
  17. ;; any later version.
  18.  
  19. ;; GNU Emacs is distributed in the hope that it will be useful,
  20. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22. ;; GNU General Public License for more details.
  23.  
  24. ;; You should have received a copy of the GNU General Public License
  25. ;; along with GNU Emacs; see the file COPYING.  If not, write to
  26. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  27.  
  28.  
  29. ;;; Autoloads
  30.  
  31. (autoload 'texinfo-format-region
  32.           "texinfmt"
  33.   "Convert the current region of the Texinfo file to Info format.
  34. This lets you see what that part of the file will look like in Info.
  35. The command is bound to \\[texinfo-format-region].  The text that is
  36. converted to Info is stored in a temporary buffer."
  37.           t nil)
  38.  
  39. (autoload 'texinfo-format-buffer
  40.           "texinfmt"
  41.   "Process the current buffer as texinfo code, into an Info file.
  42. The Info file output is generated in a buffer visiting the Info file
  43. names specified in the @setfilename command.
  44.  
  45. Non-nil argument (prefix, if interactive) means don't make tag table
  46. and don't split the file if large.  You can use Info-tagify and
  47. Info-split to do these manually."
  48.           t nil)
  49.  
  50. (autoload 'makeinfo-region
  51.           "makeinfo"
  52.   "Make Info file from region of current Texinfo source file.
  53.  
  54. The \\[next-error] command can be used to move to the next error \(if
  55. any are found\)."
  56.           t nil)
  57.  
  58. (autoload 'makeinfo-buffer
  59.           "makeinfo"
  60.   "Make Info file from current buffer.
  61.  
  62. The \\[next-error] command can be used to move to the next error 
  63. \(if any are found\)."
  64.           t nil)
  65.  
  66. (autoload 'kill-compilation
  67.           "compile"
  68.   "Kill the process made by the \\[compile] command."
  69.           t nil)
  70.  
  71. (autoload 'makeinfo-recenter-compilation-buffer
  72.           "makeinfo"
  73.   "Redisplay *compilation* buffer so that most recent output can be seen.
  74. The last line of the buffer is displayed on
  75. line LINE of the window, or centered if LINE is nil."
  76.           t nil)
  77.  
  78. (autoload 'texinfo-tex-region
  79.           "texnfo-tex"
  80.   "Run tex on the current region. 
  81.  
  82. A temporary file is written in the default directory, and tex is run
  83. in that directory.  The first line of the file is copied to the
  84. temporary file; and if the buffer has a header, it is written to the
  85. temporary file before the region itself.  The buffer's header is all
  86. lines between the strings defined by texinfo-start-of-header and
  87. texinfo-end-of-header inclusive.  The header must start in the first 100
  88. lines.  The value of texinfo-tex-trailer is appended to the temporary file
  89. after the region."
  90.           t nil)
  91.  
  92. (autoload 'texinfo-tex-buffer
  93.           "texnfo-tex"
  94.   "Run TeX on current buffer.
  95. After running TeX the first time, you may have to run \\[texinfo-texindex]
  96. and then \\[texinfo-tex-buffer] again."
  97.           t nil)
  98.  
  99. (autoload 'texinfo-kill-tex-job
  100.           "texnfo-tex"
  101.   "Kill the currently running TeX job."
  102.           t nil)
  103.  
  104. (autoload 'texinfo-recenter-tex-output-buffer
  105.           "texnfo-tex"
  106.   "Redisplay buffer of TeX job output so that most recent output can be seen.
  107. The last line of the buffer is displayed on
  108. line LINE of the window, or centered if LINE is nil."
  109.           t nil)
  110.  
  111. (autoload 'texinfo-delete-from-tex-print-queue
  112.           "texnfo-tex"
  113.   "Delete job from the line printer spooling queue.
  114. You are prompted for the job number (shown by a previous
  115. \\[texinfo-show-tex-print-queue] command."
  116.           t nil)
  117.  
  118. (autoload 'texinfo-show-tex-print-queue
  119.           "texnfo-tex"
  120.   "Show the print queue that \\[texinfo-tex-print] put your job on.
  121. Runs the shell command defined by texinfo-show-tex-queue-command."
  122.           t nil)
  123.  
  124. (autoload 'texinfo-tex-print
  125.           "texnfo-tex"
  126.   "Print .dvi file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
  127. Runs the shell command defined by texinfo-tex-dvi-print-command."
  128.           t nil)
  129.  
  130. (autoload 'texinfo-texindex
  131.           "texnfo-tex"
  132.   "Run texindex on unsorted index files.
  133. The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
  134. Runs the shell command defined by texinfo-texindex-command."
  135.           t nil)
  136.  
  137. (autoload 'texinfo-make-menu
  138.           "texnfo-upd"
  139.   "Without any prefix argument, make or update a menu.
  140. Make the menu for the section enclosing the node found following point.
  141.  
  142. Non-nil argument (prefix, if interactive) means make or update menus
  143. for nodes within or part of the marked region.
  144.  
  145. Whenever a menu exists, and is being updated, the descriptions that
  146. are associated with node names in the pre-existing menu are
  147. incorporated into the new menu.  Otherwise, the nodes' section titles
  148. are inserted as descriptions."
  149.           t nil)
  150.  
  151. (autoload 'texinfo-update-node
  152.           "texnfo-upd"
  153.   "Without any prefix argument, update the node in which point is located.
  154. Non-nil argument (prefix, if interactive) means update the nodes in the
  155. marked region.
  156.  
  157. The functions for creating or updating nodes and menus, and their
  158. keybindings, are:
  159.  
  160.     texinfo-update-node (&optional region-p)    \\[texinfo-update-node]
  161.     texinfo-every-node-update ()                \\[texinfo-every-node-update]
  162.     texinfo-sequential-node-update (&optional region-p)
  163.  
  164.     texinfo-make-menu (&optional region-p)      \\[texinfo-make-menu]
  165.     texinfo-all-menus-update ()                 \\[texinfo-all-menus-update]
  166.     texinfo-master-menu ()
  167.  
  168.     texinfo-indent-menu-description (column &optional region-p)
  169.  
  170. The `texinfo-column-for-description' variable specifies the column to
  171. which menu descriptions are indented. Its default value is 24."
  172.           t nil)
  173.  
  174. (autoload 'texinfo-every-node-update
  175.           "texnfo-upd"
  176.   "Update every node in a Texinfo file."
  177.           t nil)
  178.  
  179. (autoload 'texinfo-all-menus-update
  180.           "texnfo-upd"
  181.   "Update every regular menu in a Texinfo file.
  182. Remove pre-existing master menu, if there is one.
  183.  
  184. If called with a non-nil argument, this function first updates all the
  185. nodes in the buffer before updating the menus."
  186.           t nil)
  187.  
  188. (autoload 'texinfo-master-menu
  189.           "texnfo-upd"
  190.   "Make a master menu for a whole Texinfo file.
  191. Non-nil argument (prefix, if interactive) means first update all
  192. existing nodes and menus.  Remove pre-existing master menu, if there is one.
  193.  
  194. This function creates a master menu that follows the top node.  The
  195. master menu includes every entry from all the other menus.  It
  196. replaces any existing ordinary menu that follows the top node.
  197.  
  198. If called with a non-nil argument, this function first updates all the
  199. menus in the buffer (incorporating descriptions from pre-existing
  200. menus) before it constructs the master menu.
  201.  
  202. The function removes the detailed part of an already existing master
  203. menu.  This action depends on the pre-exisitng master menu using the
  204. standard `texinfo-master-menu-header'.
  205.  
  206. The master menu has the following format, which is adapted from the
  207. recommendation in the Texinfo Manual:
  208.  
  209.    * The first part contains the major nodes in the Texinfo file: the
  210.      nodes for the chapters, chapter-like sections, and the major
  211.      appendices.  This includes the indices, so long as they are in
  212.      chapter-like sections, such as unnumbered sections.
  213.  
  214.    * The second and subsequent parts contain a listing of the other,
  215.      lower level menus, in order.  This way, an inquirer can go
  216.      directly to a particular node if he or she is searching for
  217.      specific information.
  218.  
  219. Each of the menus in the detailed node listing is introduced by the
  220. title of the section containing the menu."
  221.           t nil)
  222.  
  223. (autoload 'texinfo-indent-menu-description
  224.           "texnfo-upd"
  225.   "Indent every description in menu following point to COLUMN.  
  226. Non-nil argument (prefix, if interactive) means indent every
  227. description in every menu in the region.  Does not indent second and
  228. subsequent lines of a multi-line description."
  229.           t nil)
  230.  
  231. (autoload 'texinfo-sequential-node-update
  232.           "texnfo-upd"
  233.   "Update one node (or many) in a Texinfo file with sequential pointers.
  234.  
  235. This function causes the `Next' or `Previous' pointer to point to the
  236. immediately preceding or following node, even if it is at a higher or
  237. lower hierarchical level in the document.  Continually pressing `n' or
  238. `p' takes you straight through the file.
  239.  
  240. Without any prefix argument, update the node in which point is located.
  241. Non-nil argument (prefix, if interactive) means update the nodes in the
  242. marked region.
  243.  
  244. This command makes it awkward to navigate among sections and
  245. subsections; it should be used only for those documents that are meant
  246. to be read like a novel rather than a reference, and for which the
  247. Info `g*' command is inadequate."
  248.           t nil)
  249.  
  250. (autoload 'texinfo-insert-node-lines
  251.           "texnfo-upd"
  252.   "Insert missing `@node' lines in region of Texinfo file.
  253. Non-nil argument (prefix, if interactive) means also to insert the
  254. section titles as node names; and also to insert the section titles as
  255. node names in pre-existing @node lines that lack names."
  256.           t nil)
  257.  
  258. (autoload 'texinfo-multiple-files-update
  259.           "texnfo-upd"
  260.   "Update first node pointers in each file included in OUTER-FILE;
  261. create or update main menu in the outer file that refers to such nodes. 
  262. This does not create or update menus or pointers within the included files.
  263.  
  264. With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
  265. insert a master menu in OUTER-FILE.  This does not create or update
  266. menus or pointers within the included files.
  267.  
  268. With optional UPDATE-EVERYTHING argument (numeric prefix arg, if
  269. interactive), update all the menus and all the `Next', `Previous', and
  270. `Up' pointers of all the files included in OUTER-FILE before inserting
  271. a master menu in OUTER-FILE.
  272.  
  273. The command also updates the `Top' level node pointers of OUTER-FILE.
  274.  
  275. Notes: 
  276.  
  277.   * this command does NOT save any files--you must save the
  278.     outer file and any modified, included files.
  279.  
  280.   * except for the `Top' node, this command does NOT handle any
  281.     pre-existing nodes in the outer file; hence, indices must be
  282.     enclosed in an included file.
  283.  
  284. Requirements:
  285.  
  286.   * each of the included files must contain exactly one highest
  287.     hierarchical level node, 
  288.   * this highest node must be the first node in the included file,
  289.   * each highest hierarchical level node must be of the same type.
  290.  
  291. Thus, normally, each included file contains one, and only one,
  292. chapter."
  293.           t nil)
  294.  
  295.  
  296. ;;; Syntax table
  297.  
  298. (defvar texinfo-mode-syntax-table nil)
  299.  
  300. (if texinfo-mode-syntax-table
  301.     nil
  302.   (setq texinfo-mode-syntax-table (make-syntax-table))
  303.   (modify-syntax-entry ?\" " " texinfo-mode-syntax-table)
  304.   (modify-syntax-entry ?\\ " " texinfo-mode-syntax-table)
  305.   (modify-syntax-entry ?@ "\\" texinfo-mode-syntax-table)
  306.   (modify-syntax-entry ?\^q "\\" texinfo-mode-syntax-table)
  307.   (modify-syntax-entry ?\[ "(]" texinfo-mode-syntax-table)
  308.   (modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table)
  309.   (modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table)
  310.   (modify-syntax-entry ?} "){" texinfo-mode-syntax-table)
  311.   (modify-syntax-entry ?\' "w" texinfo-mode-syntax-table))
  312.  
  313.  
  314. ;;; Keybindings
  315. (defvar texinfo-mode-map nil)
  316.  
  317. ;;; Keys common both to Texinfo mode and to TeX shell.
  318.  
  319. (defun texinfo-define-common-keys (keymap)
  320.   "Define the keys both in Texinfo mode and in the texinfo-tex-shell."
  321.   (define-key keymap "\C-c\C-t\C-k"    'texinfo-kill-tex-job)
  322.   (define-key keymap "\C-c\C-t\C-x"    'texinfo-quit-tex-job)
  323.   (define-key keymap "\C-c\C-t\C-l"    'texinfo-recenter-tex-output-buffer)
  324.   (define-key keymap "\C-c\C-t\C-d"    'texinfo-delete-from-tex-print-queue)
  325.   (define-key keymap "\C-c\C-t\C-q"    'texinfo-show-tex-print-queue)
  326.   (define-key keymap "\C-c\C-t\C-p"    'texinfo-tex-print)
  327.   (define-key keymap "\C-c\C-t\C-i"    'texinfo-texindex)
  328.  
  329.   (define-key keymap "\C-c\C-t\C-r"    'texinfo-tex-region)
  330.   (define-key keymap "\C-c\C-t\C-b"    'texinfo-tex-buffer))
  331.  
  332. ;; Mode documentation displays commands in reverse order 
  333. ;; from how they are listed in the texinfo-mode-map.
  334.  
  335. (if texinfo-mode-map
  336.     nil
  337.   (setq texinfo-mode-map (make-sparse-keymap))
  338.  
  339.   ;; bindings for `texnfo-tex.el'
  340.   (texinfo-define-common-keys texinfo-mode-map)
  341.  
  342.   ;; bindings for `texinfmt.el'
  343.   (define-key texinfo-mode-map "\C-c\C-e\C-r"    'texinfo-format-region)
  344.   (define-key texinfo-mode-map "\C-c\C-e\C-b"    'texinfo-format-buffer)
  345.  
  346.   ;; bindings for `makeinfo.el'
  347.   (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
  348.   (define-key texinfo-mode-map "\C-c\C-m\C-l" 
  349.     'makeinfo-recenter-compilation-buffer)
  350.   (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
  351.   (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
  352.  
  353.   ;; bindings for updating nodes and menus
  354.  
  355.   (define-key texinfo-mode-map "\C-c\C-um"   'texinfo-master-menu)
  356.  
  357.   (define-key texinfo-mode-map "\C-c\C-u\C-m"   'texinfo-make-menu)
  358.   (define-key texinfo-mode-map "\C-c\C-u\C-n"   'texinfo-update-node)
  359.   (define-key texinfo-mode-map "\C-c\C-u\C-e"   'texinfo-every-node-update)
  360.   (define-key texinfo-mode-map "\C-c\C-u\C-a"   'texinfo-all-menus-update)
  361.  
  362.   (define-key texinfo-mode-map "\C-c\C-s"     'texinfo-show-structure)
  363.  
  364.   (define-key texinfo-mode-map "\C-c\C-c}"    'up-list)
  365.   (define-key texinfo-mode-map "\C-c\C-c{"    'texinfo-insert-braces)
  366.  
  367.   ;; bindings for inserting strings
  368.  
  369.   (define-key texinfo-mode-map "\C-c\C-cv"    'texinfo-insert-@var)
  370.   (define-key texinfo-mode-map "\C-c\C-cs"    'texinfo-insert-@samp)
  371.   (define-key texinfo-mode-map "\C-c\C-co"    'texinfo-insert-@noindent)
  372.   (define-key texinfo-mode-map "\C-c\C-cn"    'texinfo-insert-@node)
  373.   (define-key texinfo-mode-map "\C-c\C-ck"    'texinfo-insert-@kbd)
  374.   (define-key texinfo-mode-map "\C-c\C-ci"    'texinfo-insert-@item)
  375.   (define-key texinfo-mode-map "\C-c\C-cx"    'texinfo-insert-@example)
  376.   (define-key texinfo-mode-map "\C-c\C-ce"    'texinfo-insert-@end)
  377.   (define-key texinfo-mode-map "\C-c\C-cd"    'texinfo-insert-@dfn)
  378.   (define-key texinfo-mode-map "\C-c\C-cc"    'texinfo-insert-@code))
  379.  
  380.  
  381. ;;; Texinfo mode
  382.  
  383. (defvar texinfo-chapter-level-regexp 
  384.   "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading"
  385.   "*Regexp matching chapter-level headings (but not the top node).")
  386.  
  387. (defun texinfo-mode ()
  388.   "Major mode for editing Texinfo files.
  389.  
  390.   It has these extra commands:
  391. \\{texinfo-mode-map}
  392.  
  393.   These are files that are used as input for TeX to make printed manuals
  394. and also to be turned into Info files by \\[texinfo-format-buffer] or
  395. `makeinfo'.  These files must be written in a very restricted and
  396. modified version of TeX input format.
  397.  
  398.   Editing commands are like text-mode except that the syntax table is
  399. set up so expression commands skip Texinfo bracket groups.  To see
  400. what the Info version of a region of the Texinfo file will look like,
  401. use \\[texinfo-format-region].  This command runs Info on the current region
  402. of the Texinfo file and formats it properly.
  403.  
  404.   You can show the structure of a Texinfo file with \\[texinfo-show-structure].
  405. This command shows the structure of a Texinfo file by listing the
  406. lines with the @-sign commands for @chapter, @section, and the like.
  407. These lines are displayed in another window called the *Occur* window.
  408. In that window, you can position the cursor over one of the lines and
  409. use \\[occur-mode-goto-occurrence], to jump to the corresponding spot
  410. in the Texinfo file.
  411.  
  412.   In addition, Texinfo mode provides commands that insert various
  413. frequently used @-sign commands into the buffer.  You can use these
  414. commands to save keystrokes.  And you can insert balanced braces with
  415. \\[texinfo-insert-braces] and later use the command \\[up-list] to
  416. move forward past the closing brace.
  417.  
  418. Also, Texinfo mode provides functions for automatically creating or
  419. updating menus and node pointers.  These functions
  420.  
  421.   * insert the `Next', `Previous' and `Up' pointers of a node,
  422.   * insert or update the menu for a section, and
  423.   * create a master menu for a Texinfo source file.
  424.  
  425. Here are the functions:
  426.  
  427.     texinfo-update-node                \\[texinfo-update-node]
  428.     texinfo-every-node-update          \\[texinfo-every-node-update]
  429.     texinfo-sequential-node-update 
  430.  
  431.     texinfo-make-menu                  \\[texinfo-make-menu]
  432.     texinfo-all-menus-update           \\[texinfo-all-menus-update]
  433.     texinfo-master-menu
  434.  
  435.     texinfo-indent-menu-description (column &optional region-p)
  436.  
  437. The `texinfo-column-for-description' variable specifies the column to
  438. which menu descriptions are indented. 
  439.  
  440. Passed an argument (a prefix argument, if interactive), the
  441. `texinfo-update-node' and `texinfo-make-menu' functions do their jobs
  442. in the region.
  443.  
  444. To use the updating commands, you must structure your Texinfo file
  445. hierarchically, such that each `@node' line, with the exception of the
  446. Top node, is accompanied by some kind of section line, such as an
  447. `@chapter' or `@section' line.
  448.  
  449. If the file has a `top' node, it must be called `top' or `Top' and
  450. be the first node in the file.
  451.  
  452. Entering Texinfo mode calls the value of text-mode-hook, and then the
  453. value of texinfo-mode-hook."
  454.   (interactive)
  455.   (text-mode)
  456.   (setq mode-name "Texinfo")
  457.   (setq major-mode 'texinfo-mode)
  458.   (use-local-map texinfo-mode-map)
  459.   (set-syntax-table texinfo-mode-syntax-table)
  460.   (make-local-variable 'page-delimiter)
  461.   (setq page-delimiter (concat "^@\\(" texinfo-chapter-level-regexp "\\)"))
  462.   (make-local-variable 'require-final-newline)
  463.   (setq require-final-newline t)
  464.   (make-local-variable 'indent-tabs-mode)
  465.   (setq indent-tabs-mode nil)
  466.   (make-local-variable 'paragraph-separate)
  467.   (setq paragraph-separate (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate))
  468.   (make-local-variable 'paragraph-start)
  469.   (setq paragraph-start (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start))
  470.   (make-local-variable 'fill-column)
  471.   (setq fill-column 72)
  472.   (make-local-variable 'comment-start)
  473.   (setq comment-start "@c ")
  474.   (make-local-variable 'comment-start-skip)
  475.   (setq comment-start-skip "@c +")
  476.   (make-local-variable 'words-include-escapes)
  477.   (setq words-include-escapes t)
  478.   (make-local-variable 'texinfo-start-of-header)
  479.   (setq texinfo-start-of-header "%**start")
  480.   (make-local-variable 'texinfo-end-of-header)
  481.   (setq texinfo-end-of-header "%**end")
  482.   (run-hooks 'text-mode-hook 'texinfo-mode-hook))
  483.  
  484.  
  485. ;;; Define start and end of header expressions 
  486.  
  487. ;; The start-of-header and end-of-header expressions are defined here
  488. ;; since they used by both by `texinfmt.el' and by `texnfo-tex.el',
  489. ;; only one of which is likely to be loaded at one time.
  490.  
  491. (defvar texinfo-start-of-header "%**start"
  492.   "String to mark start of header for texinfo-tex-region.")
  493.  
  494. (defvar texinfo-end-of-header "%**end"
  495.   "String to mark end of header for texinfo-tex-region.")
  496.  
  497.  
  498. ;;; Insert string commands
  499.  
  500. (defun texinfo-insert-@var ()
  501.   "Insert the string @var in a texinfo buffer."
  502.   (interactive)
  503.   (insert "@var{}")
  504.   (backward-char))
  505.  
  506. (defun texinfo-insert-@samp ()
  507.   "Insert the string @samp in a texinfo buffer."
  508.   (interactive)
  509.   (insert "@samp{}")
  510.   (backward-char))
  511.  
  512. (defun texinfo-insert-@noindent ()
  513.   "Insert the string @noindent in a texinfo buffer."
  514.   (interactive)
  515.   (insert "@noindent\n"))
  516.  
  517. (defun texinfo-insert-@node ()
  518.   "Insert the string @node in a texinfo buffer, 
  519. along with a comment indicating the arguments to @node."
  520.   (interactive)
  521.   (insert "@node \n@comment  node-name,  next,  previous,  up")
  522.   (forward-line -1)
  523.   (forward-char 6))
  524.  
  525. (defun texinfo-insert-@kbd ()
  526.   "Insert the string @kbd in a texinfo buffer."
  527.   (interactive)
  528.   (insert "@kbd{}")
  529.   (backward-char))
  530.  
  531. (defun texinfo-insert-@item ()
  532.   "Insert the string @item in a texinfo buffer."
  533.   (interactive)
  534.   (insert "@item")
  535.   (newline))
  536.  
  537. (defun texinfo-insert-@example ()
  538.   "Insert the string @example in a texinfo buffer."
  539.   (interactive)
  540.   (insert "@example\n"))
  541.  
  542. (defun texinfo-insert-@end ()
  543.   "Insert the string `@end ' (end followed by a space) in a texinfo buffer."
  544.   (interactive)
  545.   (insert "@end "))
  546.  
  547. (defun texinfo-insert-@dfn ()
  548.   "Insert the string @dfn in a texinfo buffer."
  549.   (interactive)
  550.   (insert "@dfn{}")
  551.   (backward-char))
  552.  
  553. (defun texinfo-insert-@code ()
  554.   "Insert the string @code in a texinfo buffer."
  555.   (interactive)
  556.   (insert "@code{}")
  557.   (backward-char))
  558.  
  559. (defun texinfo-insert-braces ()
  560.   "Make a pair of braces and be poised to type inside of them.
  561. Use \\[up-list] to move forward out of the braces."
  562.   (interactive)
  563.   (insert "{}")
  564.   (backward-char))
  565.  
  566.  
  567. ;;; Texinfo file structure
  568.  
  569. ; The following is defined in `texnfo-upd.el'
  570. ; (defvar texinfo-section-types-regexp
  571. ;   "^@\\(chapter \\|sect\\|sub\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)"
  572. ;   "Regexp matching chapter, section, other headings (but not the top node).")
  573.  
  574. (defun texinfo-show-structure (&optional nodes-too) 
  575.   "Show the structure of a Texinfo file.
  576. List the lines in the file that begin with the @-sign commands for
  577. @chapter, @section, and the like.
  578.  
  579. With optional argument (prefix if interactive), list both the lines
  580. with @-sign commands for @chapter, @section, and the like, and list
  581. @node lines.
  582.  
  583. Lines with structuring commands beginning in them are displayed in
  584. another window called the *Occur* window.  In that window, you can
  585. position the cursor over one of the lines and use
  586. \\[occur-mode-goto-occurrence], 
  587. to jump to the corresponding spot in the Texinfo file."
  588.  
  589.   (interactive "P")
  590.   (require 'texnfo-upd)
  591.   (save-excursion 
  592.     (goto-char (point-min))
  593.     (if nodes-too
  594.         (occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp))
  595.       (occur texinfo-section-types-regexp)))
  596.   (pop-to-buffer "*Occur*")
  597.   (goto-char (point-min))
  598.   (flush-lines "-----"))
  599.  
  600.  
  601. ;;; Place provide at end of file.
  602. (provide 'texinfo)
  603. ;;;;;;;;;;;;;;;; end texinfo.el ;;;;;;;;;;;;;;;;
  604.