diff options
Diffstat (limited to 'lisp/textmodes/texinfo.el')
-rw-r--r-- | lisp/textmodes/texinfo.el | 337 |
1 files changed, 70 insertions, 267 deletions
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 7799cdb5529..11d60e1eb03 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -1,4 +1,4 @@ -;;; texinfo.el --- major mode for editing Texinfo files +;;; texinfo.el --- major mode for editing Texinfo files -*- lexical-binding: t; -*- ;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2021 Free Software ;; Foundation, Inc. @@ -54,220 +54,27 @@ ;;;###autoload (defcustom texinfo-open-quote (purecopy "``") "String inserted by typing \\[texinfo-insert-quote] to open a quotation." - :type 'string - :group 'texinfo) + :type 'string) ;;;###autoload (defcustom texinfo-close-quote (purecopy "''") "String inserted by typing \\[texinfo-insert-quote] to close a quotation." - :type 'string - :group 'texinfo) + :type 'string) (defcustom texinfo-mode-hook nil "Normal hook run when entering Texinfo mode." :type 'hook - :options '(turn-on-auto-fill flyspell-mode) - :group 'texinfo) + :options '(turn-on-auto-fill flyspell-mode)) ;;; 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 would -apply 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 on -line 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 the -marked region. - -The functions for creating or updating nodes and menus, and their -keybindings, 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 to -which 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 the -immediately preceding or following node, even if it is at a higher or -lower 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 the -marked region. - -This command makes it awkward to navigate among sections and -subsections; it should be used only for those documents that are meant -to be read like a novel rather than a reference, and for which the -Info `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 menus -for nodes within or part of the marked region. - -Whenever a menu exists, and is being updated, the descriptions that -are associated with node names in the pre-existing menu are -incorporated into the new menu. Otherwise, the nodes' section titles -are 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 the -nodes 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 all -existing nodes and menus. Remove pre-existing master menu, if there is one. - -This function creates a master menu that follows the top node. The -master menu includes every entry from all the other menus. It -replaces any existing ordinary menu that follows the top node. - -If called with a non-nil argument, this function first updates all the -menus in the buffer (incorporating descriptions from pre-existing -menus) before it constructs the master menu. - -The function removes the detailed part of an already existing master -menu. This action depends on the pre-existing master menu using the -standard `texinfo-master-menu-header'. - -The master menu has the following format, which is adapted from the -recommendation 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 the -title 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 every -description in every menu in the region. Does not indent second and -subsequent 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 the -section titles as node names; and also to insert the section titles as -node 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 description -complements 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 update -menus or pointers within the included files. - -With optional UPDATE-EVERYTHING argument (numeric prefix arg, if -interactive), update all the menus and all the `Next', `Previous', and -`Up' pointers of all the files included in OUTER-FILE before inserting -a 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) +(require 'texinfo-loaddefs) ;;; Code: @@ -349,8 +156,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") (defface texinfo-heading '((t (:inherit font-lock-function-name-face))) - "Face used for section headings in `texinfo-mode'." - :group 'texinfo) + "Face used for section headings in `texinfo-mode'.") (defvar texinfo-font-lock-keywords `(;; All but the first had an OVERRIDE of t. @@ -377,7 +183,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face keep) ;; (,texinfo-environment-regexp ;; 1 (texinfo-clone-environment (match-beginning 1) (match-end 1)) keep) - (,(concat "^@" (regexp-opt (mapcar 'car texinfo-section-list) t) + (,(concat "^@" (regexp-opt (mapcar #'car texinfo-section-list) t) ".*\n") 0 'texinfo-heading t)) "Additional expressions to highlight in Texinfo mode.") @@ -404,19 +210,21 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") ;;; Keys common both to Texinfo mode and to TeX shell. +(declare-function tex-show-print-queue "tex-mode" ()) + (defun texinfo-define-common-keys (keymap) "Define the keys both in Texinfo mode and in the texinfo-tex-shell." - (define-key keymap "\C-c\C-t\C-k" 'tex-kill-job) - (define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-job) - (define-key keymap "\C-c\C-t\C-l" 'tex-recenter-output-buffer) - (define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-print-queue) - (define-key keymap "\C-c\C-t\C-q" 'tex-show-print-queue) - (define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print) - (define-key keymap "\C-c\C-t\C-v" 'texinfo-tex-view) - (define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex) - - (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region) - (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer)) + (define-key keymap "\C-c\C-t\C-k" #'tex-kill-job) + (define-key keymap "\C-c\C-t\C-x" #'texinfo-quit-job) + (define-key keymap "\C-c\C-t\C-l" #'tex-recenter-output-buffer) + (define-key keymap "\C-c\C-t\C-d" #'texinfo-delete-from-print-queue) + (define-key keymap "\C-c\C-t\C-q" #'tex-show-print-queue) + (define-key keymap "\C-c\C-t\C-p" #'texinfo-tex-print) + (define-key keymap "\C-c\C-t\C-v" #'texinfo-tex-view) + (define-key keymap "\C-c\C-t\C-i" #'texinfo-texindex) + + (define-key keymap "\C-c\C-t\C-r" #'texinfo-tex-region) + (define-key keymap "\C-c\C-t\C-b" #'texinfo-tex-buffer)) ;; Mode documentation displays commands in reverse order ;; from how they are listed in the texinfo-mode-map. @@ -427,68 +235,68 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") ;; bindings for `texnfo-tex.el' (texinfo-define-common-keys map) - (define-key map "\"" 'texinfo-insert-quote) + (define-key map "\"" #'texinfo-insert-quote) ;; bindings for `makeinfo.el' - (define-key map "\C-c\C-m\C-k" 'kill-compilation) + (define-key map "\C-c\C-m\C-k" #'kill-compilation) (define-key map "\C-c\C-m\C-l" - 'makeinfo-recenter-compilation-buffer) - (define-key map "\C-c\C-m\C-r" 'makeinfo-region) - (define-key map "\C-c\C-m\C-b" 'makeinfo-buffer) + #'makeinfo-recenter-compilation-buffer) + (define-key map "\C-c\C-m\C-r" #'makeinfo-region) + (define-key map "\C-c\C-m\C-b" #'makeinfo-buffer) ;; bindings for `texinfmt.el' - (define-key map "\C-c\C-e\C-r" 'texinfo-format-region) - (define-key map "\C-c\C-e\C-b" 'texinfo-format-buffer) + (define-key map "\C-c\C-e\C-r" #'texinfo-format-region) + (define-key map "\C-c\C-e\C-b" #'texinfo-format-buffer) ;; AUCTeX-like bindings - (define-key map "\e\r" 'texinfo-insert-@item) + (define-key map "\e\r" #'texinfo-insert-@item) ;; bindings for updating nodes and menus - (define-key map "\C-c\C-um" 'texinfo-master-menu) + (define-key map "\C-c\C-um" #'texinfo-master-menu) - (define-key map "\C-c\C-u\C-m" 'texinfo-make-menu) - (define-key map "\C-c\C-u\C-n" 'texinfo-update-node) - (define-key map "\C-c\C-u\C-e" 'texinfo-every-node-update) - (define-key map "\C-c\C-u\C-a" 'texinfo-all-menus-update) + (define-key map "\C-c\C-u\C-m" #'texinfo-make-menu) + (define-key map "\C-c\C-u\C-n" #'texinfo-update-node) + (define-key map "\C-c\C-u\C-e" #'texinfo-every-node-update) + (define-key map "\C-c\C-u\C-a" #'texinfo-all-menus-update) - (define-key map "\C-c\C-s" 'texinfo-show-structure) + (define-key map "\C-c\C-s" #'texinfo-show-structure) - (define-key map "\C-c}" 'up-list) + (define-key map "\C-c}" #'up-list) ;; FIXME: This is often used for "close block" aka texinfo-insert-@end. - (define-key map "\C-c]" 'up-list) - (define-key map "\C-c/" 'texinfo-insert-@end) - (define-key map "\C-c{" 'texinfo-insert-braces) + (define-key map "\C-c]" #'up-list) + (define-key map "\C-c/" #'texinfo-insert-@end) + (define-key map "\C-c{" #'texinfo-insert-braces) ;; bindings for inserting strings - (define-key map "\C-c\C-o" 'texinfo-insert-block) - (define-key map "\C-c\C-c\C-d" 'texinfo-start-menu-description) - (define-key map "\C-c\C-c\C-s" 'texinfo-insert-@strong) - (define-key map "\C-c\C-c\C-e" 'texinfo-insert-@emph) - - (define-key map "\C-c\C-cv" 'texinfo-insert-@var) - (define-key map "\C-c\C-cu" 'texinfo-insert-@uref) - (define-key map "\C-c\C-ct" 'texinfo-insert-@table) - (define-key map "\C-c\C-cs" 'texinfo-insert-@samp) - (define-key map "\C-c\C-cr" 'texinfo-insert-dwim-@ref) - (define-key map "\C-c\C-cq" 'texinfo-insert-@quotation) - (define-key map "\C-c\C-co" 'texinfo-insert-@noindent) - (define-key map "\C-c\C-cn" 'texinfo-insert-@node) - (define-key map "\C-c\C-cm" 'texinfo-insert-@email) - (define-key map "\C-c\C-ck" 'texinfo-insert-@kbd) - (define-key map "\C-c\C-ci" 'texinfo-insert-@item) - (define-key map "\C-c\C-cf" 'texinfo-insert-@file) - (define-key map "\C-c\C-cx" 'texinfo-insert-@example) - (define-key map "\C-c\C-ce" 'texinfo-insert-@end) - (define-key map "\C-c\C-cd" 'texinfo-insert-@dfn) - (define-key map "\C-c\C-cc" 'texinfo-insert-@code) + (define-key map "\C-c\C-o" #'texinfo-insert-block) + (define-key map "\C-c\C-c\C-d" #'texinfo-start-menu-description) + (define-key map "\C-c\C-c\C-s" #'texinfo-insert-@strong) + (define-key map "\C-c\C-c\C-e" #'texinfo-insert-@emph) + + (define-key map "\C-c\C-cv" #'texinfo-insert-@var) + (define-key map "\C-c\C-cu" #'texinfo-insert-@uref) + (define-key map "\C-c\C-ct" #'texinfo-insert-@table) + (define-key map "\C-c\C-cs" #'texinfo-insert-@samp) + (define-key map "\C-c\C-cr" #'texinfo-insert-dwim-@ref) + (define-key map "\C-c\C-cq" #'texinfo-insert-@quotation) + (define-key map "\C-c\C-co" #'texinfo-insert-@noindent) + (define-key map "\C-c\C-cn" #'texinfo-insert-@node) + (define-key map "\C-c\C-cm" #'texinfo-insert-@email) + (define-key map "\C-c\C-ck" #'texinfo-insert-@kbd) + (define-key map "\C-c\C-ci" #'texinfo-insert-@item) + (define-key map "\C-c\C-cf" #'texinfo-insert-@file) + (define-key map "\C-c\C-cx" #'texinfo-insert-@example) + (define-key map "\C-c\C-ce" #'texinfo-insert-@end) + (define-key map "\C-c\C-cd" #'texinfo-insert-@dfn) + (define-key map "\C-c\C-cc" #'texinfo-insert-@code) ;; bindings for environment movement - (define-key map "\C-c." 'texinfo-to-environment-bounds) - (define-key map "\C-c\C-c\C-f" 'texinfo-next-environment-end) - (define-key map "\C-c\C-c\C-b" 'texinfo-previous-environment-end) - (define-key map "\C-c\C-c\C-n" 'texinfo-next-environment-start) - (define-key map "\C-c\C-c\C-p" 'texinfo-previous-environment-start) + (define-key map "\C-c." #'texinfo-to-environment-bounds) + (define-key map "\C-c\C-c\C-f" #'texinfo-next-environment-end) + (define-key map "\C-c\C-c\C-b" #'texinfo-previous-environment-end) + (define-key map "\C-c\C-c\C-n" #'texinfo-next-environment-start) + (define-key map "\C-c\C-c\C-p" #'texinfo-previous-environment-start) map)) (easy-menu-define texinfo-mode-menu @@ -628,7 +436,7 @@ value of `texinfo-mode-hook'." (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) + (concat (regexp-opt (mapcar #'car outline-heading-alist) t) "\\>")) (setq-local tex-start-of-header "%\\*\\*start") @@ -897,7 +705,7 @@ A numeric argument says how many words the braces should surround. The default is not to surround any existing words with the braces." nil "@uref{" _ "}") -(defalias 'texinfo-insert-@url 'texinfo-insert-@uref) +(defalias 'texinfo-insert-@url #'texinfo-insert-@uref) ;;; Texinfo file structure @@ -962,32 +770,27 @@ to jump to the corresponding spot in the Texinfo source file." (defcustom texinfo-texi2dvi-command "texi2dvi" "Command used by `texinfo-tex-buffer' to run TeX and texindex on a buffer." - :type 'string - :group 'texinfo) + :type 'string) (defcustom texinfo-texi2dvi-options "" "Command line options for `texinfo-texi2dvi-command'." :type 'string - :group 'texinfo :version "28.1") (defcustom texinfo-tex-command "tex" "Command used by `texinfo-tex-region' to run TeX on a region." - :type 'string - :group 'texinfo) + :type 'string) (defcustom texinfo-texindex-command "texindex" "Command used by `texinfo-texindex' to sort unsorted index files." - :type 'string - :group 'texinfo) + :type 'string) (defcustom texinfo-delete-from-print-queue-command "lprm" "Command string used to delete a job from the line printer queue. Command is used by \\[texinfo-delete-from-print-queue] based on number provided by a previous \\[tex-show-print-queue] command." - :type 'string - :group 'texinfo) + :type 'string) (defvar texinfo-tex-trailer "@bye" "String appended after a region sent to TeX by `texinfo-tex-region'.") |