📄 texinfo.el
字号:
;;; texinfo.el --- major mode for editing Texinfo files;; Copyright (C) 1985, '88, '89, '90, '91,;; '92, '93, '96, '97 Free Software Foundation, Inc.;; Author: Robert J. Chassell;; Date: [Set date below for texinfo-version];; Maintainer: bug-texinfo@prep.ai.mit.edu;; Keywords: maint, tex, docs;; This file is part of GNU Emacs.;; GNU Emacs is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 2, or (at your option);; any later version.;; GNU Emacs is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the;; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License;; along with GNU Emacs; see the file COPYING. If not, write to the;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.;;; Code:(defgroup texinfo nil "Texinfo Mode" :group 'docs)(defvar texinfo-version "2.37 of 24 May 1997")(defun texinfo-version (&optional here) "Show the version of texinfo.el in the minibuffer.If optional argument HERE is non-nil, insert info at point." (interactive "P") (let ((version-string (format "Version of \`texinfo.el\': %s" texinfo-version))) (if here (insert version-string) (if (interactive-p) (message "%s" version-string) version-string))));;; Autoloads:(autoload 'makeinfo-region "makeinfo" "Make Info file from region of current Texinfo file, and switch to it.This command does not offer the `next-error' feature since it wouldapply to a temporary file, not the original; use the `makeinfo-buffer'command to gain use of `next-error'." t nil)(autoload 'makeinfo-buffer "makeinfo" "Make Info file from current buffer.Use the \\[next-error] command to move to the next error\(if there are errors\)." t nil)(autoload 'kill-compilation "compile" "Kill the process made by the \\[compile] command." t nil)(autoload 'makeinfo-recenter-compilation-buffer "makeinfo" "Redisplay `*compilation*' buffer so most recent output can be seen.The last line of the buffer is displayed online LINE of the window, or centered if LINE is nil." t nil)(autoload 'texinfo-update-node "texnfo-upd" "Without any prefix argument, update the node in which point is located.Non-nil argument (prefix, if interactive) means update the nodes in themarked region.The functions for creating or updating nodes and menus, and theirkeybindings, are: texinfo-update-node (&optional region-p) \\[texinfo-update-node] texinfo-every-node-update () \\[texinfo-every-node-update] texinfo-sequential-node-update (&optional region-p) texinfo-make-menu (&optional region-p) \\[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 towhich menu descriptions are indented. Its default value is 32." t nil)(autoload 'texinfo-every-node-update "texnfo-upd" "Update every node in a Texinfo file." t nil)(autoload 'texinfo-sequential-node-update "texnfo-upd" "Update one node (or many) in a Texinfo file with sequential pointers.This function causes the `Next' or `Previous' pointer to point to theimmediately preceding or following node, even if it is at a higher orlower hierarchical level in the document. Continually pressing `n' or`p' takes you straight through the file.Without any prefix argument, update the node in which point is located.Non-nil argument (prefix, if interactive) means update the nodes in themarked region.This command makes it awkward to navigate among sections andsubsections; it should be used only for those documents that are meantto be read like a novel rather than a reference, and for which theInfo `g*' command is inadequate." t nil)(autoload 'texinfo-make-menu "texnfo-upd" "Without any prefix argument, make or update a menu.Make the menu for the section enclosing the node found following point.Non-nil argument (prefix, if interactive) means make or update menusfor nodes within or part of the marked region.Whenever a menu exists, and is being updated, the descriptions thatare associated with node names in the pre-existing menu areincorporated into the new menu. Otherwise, the nodes' section titlesare inserted as descriptions." t nil)(autoload 'texinfo-all-menus-update "texnfo-upd" "Update every regular menu in a Texinfo file.Remove pre-existing master menu, if there is one.If called with a non-nil argument, this function first updates all thenodes in the buffer before updating the menus." t nil)(autoload 'texinfo-master-menu "texnfo-upd" "Make a master menu for a whole Texinfo file.Non-nil argument (prefix, if interactive) means first update allexisting nodes and menus. Remove pre-existing master menu, if there is one.This function creates a master menu that follows the top node. Themaster menu includes every entry from all the other menus. Itreplaces any existing ordinary menu that follows the top node.If called with a non-nil argument, this function first updates all themenus in the buffer (incorporating descriptions from pre-existingmenus) before it constructs the master menu.The function removes the detailed part of an already existing mastermenu. This action depends on the pre-existing master menu using thestandard `texinfo-master-menu-header'.The master menu has the following format, which is adapted from therecommendation in the Texinfo Manual: * The first part contains the major nodes in the Texinfo file: the nodes for the chapters, chapter-like sections, and the major appendices. This includes the indices, so long as they are in chapter-like sections, such as unnumbered sections. * The second and subsequent parts contain a listing of the other, lower level menus, in order. This way, an inquirer can go directly to a particular node if he or she is searching for specific information.Each of the menus in the detailed node listing is introduced by thetitle of the section containing the menu." t nil)(autoload 'texinfo-indent-menu-description "texnfo-upd" "Indent every description in menu following point to COLUMN.Non-nil argument (prefix, if interactive) means indent everydescription in every menu in the region. Does not indent second andsubsequent lines of a multi-line description." t nil)(autoload 'texinfo-insert-node-lines "texnfo-upd" "Insert missing `@node' lines in region of Texinfo file.Non-nil argument (prefix, if interactive) means also to insert thesection titles as node names; and also to insert the section titles asnode names in pre-existing @node lines that lack names." t nil)(autoload 'texinfo-start-menu-description "texnfo-upd" "In this menu entry, insert the node's section title as a description.Position point at beginning of description ready for editing.Do not insert a title if the line contains an existing description.You will need to edit the inserted text since a useful descriptioncomplements the node name rather than repeats it as a title does." t nil)(autoload 'texinfo-multiple-files-update "texnfo-upd" "Update first node pointers in each file included in OUTER-FILE;create or update main menu in the outer file that refers to such nodes.This does not create or update menus or pointers within the included files.With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),insert a master menu in OUTER-FILE. This does not create or updatemenus or pointers within the included files.With optional UPDATE-EVERYTHING argument (numeric prefix arg, ifinteractive), update all the menus and all the `Next', `Previous', and`Up' pointers of all the files included in OUTER-FILE before insertinga master menu in OUTER-FILE.The command also updates the `Top' level node pointers of OUTER-FILE.Notes: * this command does NOT save any files--you must save the outer file and any modified, included files. * except for the `Top' node, this command does NOT handle any pre-existing nodes in the outer file; hence, indices must be enclosed in an included file.Requirements: * each of the included files must contain exactly one highest hierarchical level node, * this highest node must be the first node in the included file, * each highest hierarchical level node must be of the same type.Thus, normally, each included file contains one, and only one,chapter." t nil);;; Code:;;; Don't you dare insert any `require' calls at top level in this file--rms.;;; Syntax table(defvar texinfo-mode-syntax-table nil)(if texinfo-mode-syntax-table nil (setq texinfo-mode-syntax-table (make-syntax-table)) (modify-syntax-entry ?\" " " texinfo-mode-syntax-table) (modify-syntax-entry ?\\ " " texinfo-mode-syntax-table) (modify-syntax-entry ?@ "\\" texinfo-mode-syntax-table) (modify-syntax-entry ?\^q "\\" texinfo-mode-syntax-table) (modify-syntax-entry ?\[ "(]" texinfo-mode-syntax-table) (modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table) (modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table) (modify-syntax-entry ?} "){" texinfo-mode-syntax-table) (modify-syntax-entry ?\' "w" texinfo-mode-syntax-table));; Written by Wolfgang Bangerth <zcg51122@rpool1.rus.uni-stuttgart.de>;; To override this example, set either `imenu-generic-expression';; or `imenu-create-index-function'.(defvar texinfo-imenu-generic-expression '((nil "^@node[ \t]+\\([^,\n]*\\)" 1) ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1)) "Imenu generic expression for TexInfo mode. See `imenu-generic-expression'.")(defvar texinfo-font-lock-keywords '(;; All but the first 2 had an OVERRIDE of t. ;; It didn't seem to be any better, and it's slower--simon. ("^\\(@c\\|@comment\\)\\>.*" . font-lock-comment-face) ;comments ;; Robert J. Chassell <bob@gnu.ai.mit.edu> says remove this line. ;;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t) ("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands ("^\\*\\(.*\\)[\t ]*$" 1 font-lock-function-name-face t) ;menu items ("@\\(emph\\|strong\\|b\\|i\\){\\([^}]+\\)" 2 font-lock-comment-face) ("@\\(file\\|kbd\\|key\\|url\\|email\\){\\([^}]+\\)" 2 font-lock-string-face) ("@\\(samp\\|code\\|var\\|math\\){\\([^}]+\\)" 2 font-lock-variable-name-face) ("@\\(cite\\|xref\\|pxref\\){\\([^}]+\\)" 2 font-lock-reference-face) ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-function-name-face keep)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -