Function: texinfo-mode

texinfo-mode is an autoloaded, interactive and byte-compiled function defined in texinfo.el.gz.

Signature

(texinfo-mode)

Documentation

Major mode for editing Texinfo files.

  It has these extra commands:
" texinfo-insert-quote
C-c . texinfo-to-environment-bounds
C-c / texinfo-insert-@end
C-c C-c C-b texinfo-previous-environment-end
C-c C-c C-d texinfo-start-menu-description
C-c C-c C-e texinfo-insert-@emph
C-c C-c C-f texinfo-next-environment-end
C-c C-c C-n texinfo-next-environment-start
C-c C-c C-p texinfo-previous-environment-start
C-c C-c C-s texinfo-insert-@strong
C-c C-c c texinfo-insert-@code
C-c C-c d texinfo-insert-@dfn
C-c C-c e texinfo-insert-@end
C-c C-c f texinfo-insert-@file
C-c C-c i texinfo-insert-@item
C-c C-c k texinfo-insert-@kbd
C-c C-c m texinfo-insert-@email
C-c C-c n texinfo-insert-@node
C-c C-c o texinfo-insert-@noindent
C-c C-c q texinfo-insert-@quotation
C-c C-c r texinfo-insert-dwim-@ref
C-c C-c s texinfo-insert-@samp
C-c C-c t texinfo-insert-@table
C-c C-c u texinfo-insert-@uref
C-c C-c v texinfo-insert-@var
C-c C-c x texinfo-insert-@example
C-c C-e C-b texinfo-format-buffer
C-c C-e C-r texinfo-format-region
C-c C-o texinfo-insert-block
C-c C-s texinfo-show-structure
C-c C-t C-b texinfo-tex-buffer
C-c C-t C-d texinfo-delete-from-print-queue
C-c C-t C-k tex-kill-job
C-c C-t C-l tex-recenter-output-buffer
C-c C-t C-p texinfo-tex-print
C-c C-t C-q tex-show-print-queue
C-c C-t C-r texinfo-tex-region
C-c C-t C-v texinfo-tex-view
C-c C-t C-x texinfo-quit-job
C-c C-t TAB texinfo-texindex
C-c C-u C-a texinfo-all-menus-update
C-c C-u C-e texinfo-every-node-update
C-c C-u C-n texinfo-update-node
C-c C-u RET texinfo-make-menu
C-c C-u m texinfo-master-menu
C-c RET C-b makeinfo-buffer
C-c RET C-k kill-compilation
C-c RET C-l makeinfo-recenter-compilation-buffer
C-c RET C-r makeinfo-region
C-c ] up-list
C-c { texinfo-insert-braces
C-c } up-list
M-RET texinfo-insert-@item

  These are files that are used as input for TeX to make printed manuals
and also to be turned into Info files with M-x makeinfo-buffer (makeinfo-buffer) or the makeinfo program. These files must be written in a very restricted and modified version of TeX input format.

  Editing commands are like text-mode except that the syntax table is
set up so expression commands skip Texinfo bracket groups. To see what the Info version of a region of the Texinfo file will look like, use M-x makeinfo-region (makeinfo-region), which runs makeinfo on the current region.

  You can show the structure of a Texinfo file with M-x texinfo-show-structure (texinfo-show-structure).
This command shows the structure of a Texinfo file by listing the lines with the @-sign commands for @chapter, @section, and the like. These lines are displayed in another window called the *Occur* window. In that window, you can position the cursor over one of the lines and use M-x occur-mode-goto-occurrence (occur-mode-goto-occurrence), to jump to the corresponding spot in the Texinfo file.

  In addition, Texinfo mode provides commands that insert various
frequently used @-sign commands into the buffer. You can use these commands to save keystrokes. And you can insert balanced braces with M-x texinfo-insert-braces (texinfo-insert-braces) and later use the command M-x up-list (up-list) to move forward past the closing brace.

Also, Texinfo mode provides functions for automatically creating or updating menus and node pointers. These functions

  * insert the Next, Previous and Up pointers of a node,
  * insert or update the menu for a section, and
  * create a master menu for a Texinfo source file.

Here are the functions:

    texinfo-update-node M-x texinfo-update-node (texinfo-update-node)
    texinfo-every-node-update M-x texinfo-every-node-update (texinfo-every-node-update)
    texinfo-sequential-node-update

    texinfo-make-menu M-x texinfo-make-menu (texinfo-make-menu)
    texinfo-all-menus-update M-x texinfo-all-menus-update (texinfo-all-menus-update)
    texinfo-master-menu

    texinfo-indent-menu-description (column &optional region-p)

The texinfo-column-for-description variable specifies the column to which menu descriptions are indented.

Passed an argument (a prefix argument, if interactive), the texinfo-update-node and texinfo-make-menu functions do their jobs in the region.

To use the updating commands, you must structure your Texinfo file hierarchically, such that each @node line, with the exception of the Top node, is accompanied by some kind of section line, such as an
@chapter or @section line.

If the file has a top node, it must be called top or Top and be the first node in the file.

Entering Texinfo mode calls the value of text-mode-hook, and then the value of texinfo-mode-hook.

Probably introduced at or before Emacs version 19.29.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/texinfo.el.gz
;;;###autoload
(define-derived-mode texinfo-mode text-mode "Texinfo"
  "Major mode for editing Texinfo files.

  It has these extra commands:
\\{texinfo-mode-map}

  These are files that are used as input for TeX to make printed manuals
and also to be turned into Info files with \\[makeinfo-buffer] or
the `makeinfo' program.  These files must be written in a very restricted and
modified version of TeX input format.

  Editing commands are like `text-mode' except that the syntax table is
set up so expression commands skip Texinfo bracket groups.  To see
what the Info version of a region of the Texinfo file will look like,
use \\[makeinfo-region], which runs `makeinfo' on the current region.

  You can show the structure of a Texinfo file with \\[texinfo-show-structure].
This command shows the structure of a Texinfo file by listing the
lines with the @-sign commands for @chapter, @section, and the like.
These lines are displayed in another window called the *Occur* window.
In that window, you can position the cursor over one of the lines and
use \\[occur-mode-goto-occurrence], to jump to the corresponding spot
in the Texinfo file.

  In addition, Texinfo mode provides commands that insert various
frequently used @-sign commands into the buffer.  You can use these
commands to save keystrokes.  And you can insert balanced braces with
\\[texinfo-insert-braces] and later use the command \\[up-list] to
move forward past the closing brace.

Also, Texinfo mode provides functions for automatically creating or
updating menus and node pointers.  These functions

  * insert the `Next', `Previous' and `Up' pointers of a node,
  * insert or update the menu for a section, and
  * create a master menu for a Texinfo source file.

Here are the functions:

    `texinfo-update-node'                \\[texinfo-update-node]
    `texinfo-every-node-update'          \\[texinfo-every-node-update]
    `texinfo-sequential-node-update'

    `texinfo-make-menu'                  \\[texinfo-make-menu]
    `texinfo-all-menus-update'           \\[texinfo-all-menus-update]
    `texinfo-master-menu'

    `texinfo-indent-menu-description' (column &optional region-p)

The `texinfo-column-for-description' variable specifies the column to
which menu descriptions are indented.

Passed an argument (a prefix argument, if interactive), the
`texinfo-update-node' and `texinfo-make-menu' functions do their jobs
in the region.

To use the updating commands, you must structure your Texinfo file
hierarchically, such that each `@node' line, with the exception of the
Top node, is accompanied by some kind of section line, such as an
`@chapter' or `@section' line.

If the file has a `top' node, it must be called `top' or `Top' and
be the first node in the file.

Entering Texinfo mode calls the value of `text-mode-hook', and then the
value of `texinfo-mode-hook'."
  (setq-local page-delimiter
	      (concat "^@node [ \t]*[Tt]op\\|^@\\("
		      texinfo-chapter-level-regexp
		      "\\)\\>"))
  (setq-local require-final-newline mode-require-final-newline)
  (setq-local indent-tabs-mode nil)
  ;; This is used in 'texinfo--fill-paragraph'.
  (setq-local fill-paragraph-separate (default-value 'paragraph-separate))
  (setq-local paragraph-separate
              (concat "@[a-zA-Z]*[ \n]\\|" paragraph-separate))
  (setq-local paragraph-start (concat "@[a-zA-Z]*[ \n]\\|"
				      paragraph-start))
  (setq-local fill-paragraph-function 'texinfo--fill-paragraph)
  (setq-local sentence-end-base "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
  (setq-local fill-column 70)
  (setq-local beginning-of-defun-function #'texinfo--beginning-of-defun)
  (setq-local end-of-defun-function #'texinfo--end-of-defun)
  (setq-local comment-start "@c ")
  (setq-local comment-start-skip "@c +\\|@comment +")
  (setq-local words-include-escapes t)
  (setq-local imenu-generic-expression texinfo-imenu-generic-expression)
  (setq imenu-case-fold-search nil)
  (setq font-lock-defaults
	'(texinfo-font-lock-keywords nil nil nil backward-paragraph))
  (setq-local syntax-propertize-function texinfo-syntax-propertize-function)
  (setq-local add-log-current-defun-function #'texinfo-current-defun-name)

  ;; Pairs settings
  (when (boundp 'electric-pair-pairs)
    (setq-local electric-pair-pairs
                (cons
                 ;; `` '' pairs
                 '("\\(?:^\\|[[:space:]]\\)``"
                   . "''")
                 electric-pair-pairs)))

  ;; Outline settings.
  (setq-local outline-heading-alist
	      ;; We should merge `outline-heading-alist' and
	      ;; `texinfo-section-list'.  But in the mean time, let's
	      ;; just generate one from the other.
	      (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
		      texinfo-section-list))
  (setq-local outline-regexp
	      (concat (regexp-opt (mapcar #'car outline-heading-alist) t)
		      "\\>"))

  (setq-local tex-start-of-header "%\\*\\*start")
  (setq-local tex-end-of-header "%\\*\\*end")
  (setq-local tex-first-line-header-regexp "^\\\\input")
  (setq-local tex-trailer "@bye\n")

  ;; Prevent skeleton.el from adding a newline to each inserted
  ;; skeleton.  Those which do want a newline do that explicitly in
  ;; their define-skeleton form.
  (setq-local skeleton-end-newline nil)

  ;; Prevent filling certain lines, in addition to ones specified by
  ;; the user.
  (setq-local auto-fill-inhibit-regexp
	      (let ((prevent-filling "^@\\(def\\|multitable\\)"))
		(if (null auto-fill-inhibit-regexp)
		    prevent-filling
		  (concat auto-fill-inhibit-regexp "\\|" prevent-filling))))

  ;; Set up Flymake support.
  (add-hook 'flymake-diagnostic-functions #'texinfo-flymake nil t))