; ChangeLog.2: Fix last entry
[emacs.git] / lisp / textmodes / texinfo.el
Commit [+]AuthorDateLineData
e739cc85 Kenichi Handa2009-08-18 01:21:01 +00001;;; texinfo.el --- major mode for editing Texinfo files -*- coding: utf-8 -*-
be010748 Richard M. Stallman1995-10-30 17:35:01 +00002
7e09ef09 Paul Eggert2015-01-01 14:26:41 -08003;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2015 Free Software
ab422c4d Paul Eggert2013-01-01 09:11:05 +00004;; Foundation, Inc.
e926e412 Robert J. Chassell1990-12-14 21:08:30 +00005
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +00006;; Author: Robert J. Chassell
07e77e36 Stefan Monnier2000-10-10 19:35:00 +00007;; Date: [See date below for texinfo-version]
34dc21db Glenn Morris2014-02-09 17:34:22 -08008;; Maintainer: emacs-devel@gnu.org
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +00009;; Keywords: maint, tex, docs
eea8d4ef Eric S. Raymond1992-07-22 02:58:21 +000010
be010748 Richard M. Stallman1995-10-30 17:35:01 +000011;; This file is part of GNU Emacs.
952d72ff Robert J. Chassell1990-06-28 21:32:49 +000012
1fecc8fe Glenn Morris2008-05-06 04:34:22 +000013;; GNU Emacs is free software: you can redistribute it and/or modify
952d72ff Robert J. Chassell1990-06-28 21:32:49 +000014;; it under the terms of the GNU General Public License as published by
1fecc8fe
GM
Glenn Morris2008-05-06 04:34:22 +000015;; the Free Software Foundation, either version 3 of the License, or
16;; (at your option) any later version.
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +000017
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
1fecc8fe Glenn Morris2008-05-06 04:34:22 +000024;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
952d72ff Robert J. Chassell1990-06-28 21:32:49 +000025
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +000026;;; Todo:
27
28;; - facemenu support.
76b7c637 Juanma Barranquero2003-07-13 17:15:47 +000029;; - command completion.
8fe6d67f Stefan Monnier2001-10-25 03:54:21 +000030
e8af40ee
PJ
Pavel Janík2001-07-16 12:23:00 +000031;;; Commentary:
32
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +000033;;; Code:
34
a464a6c7 Stefan Monnier2012-07-11 19:13:41 -040035(eval-when-compile (require 'tex-mode))
92eadba5
CY
Chong Yidong2012-12-01 12:09:55 +080036(declare-function tex-buffer "tex-mode" ())
37(declare-function tex-region "tex-mode" (beg end))
38(declare-function tex-send-command "tex-mode")
39(declare-function tex-recenter-output-buffer "tex-mode" (linenum))
40(declare-function tex-print "tex-mode" (&optional alt))
41(declare-function tex-view "tex-mode" ())
42(declare-function tex-shell-running "tex-mode" ())
43(declare-function tex-kill-job "tex-mode" ())
44
366fb0ab Juanma Barranquero2005-08-31 10:32:55 +000045(defvar outline-heading-alist)
08f9e254 Dave Love2000-12-06 19:34:15 +000046
58b9840b
EZ
Eli Zaretskii2014-06-20 11:47:10 +030047(defvar skeleton-end-newline)
48
cd482e05 Richard M. Stallman1997-04-12 02:51:38 +000049(defgroup texinfo nil
dbc868a1 Juanma Barranquero2005-07-04 03:45:56 +000050 "Texinfo Mode."
8ec3bce0 Juri Linkov2005-11-17 07:40:11 +000051 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
cd482e05
RS
Richard M. Stallman1997-04-12 02:51:38 +000052 :group 'docs)
53
9768eaa7 Eli Zaretskii2000-12-02 15:33:30 +000054;;;###autoload
aaa448c9 Dan Nicolaescu2009-11-11 19:24:20 +000055(defcustom texinfo-open-quote (purecopy "``")
2db33a18 Stefan Monnier2007-09-10 04:02:09 +000056 "String inserted by typing \\[texinfo-insert-quote] to open a quotation."
9768eaa7
EZ
Eli Zaretskii2000-12-02 15:33:30 +000057 :type 'string
58 :group 'texinfo)
59
60;;;###autoload
aaa448c9 Dan Nicolaescu2009-11-11 19:24:20 +000061(defcustom texinfo-close-quote (purecopy "''")
2db33a18 Stefan Monnier2007-09-10 04:02:09 +000062 "String inserted by typing \\[texinfo-insert-quote] to close a quotation."
9768eaa7
EZ
Eli Zaretskii2000-12-02 15:33:30 +000063 :type 'string
64 :group 'texinfo)
65
630dd250
SJ
Simon Josefsson2003-12-30 10:59:36 +000066(defcustom texinfo-mode-hook nil
67 "Normal hook run when entering Texinfo mode."
68 :type 'hook
69 :options '(turn-on-auto-fill flyspell-mode)
70 :group 'texinfo)
71
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +000072\f
73;;; Autoloads:
74
75(autoload 'makeinfo-region
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +000076 "makeinfo"
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +000077 "Make Info file from region of current Texinfo file, and switch to it.
78
79This command does not offer the `next-error' feature since it would
80apply to a temporary file, not the original; use the `makeinfo-buffer'
81command to gain use of `next-error'."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +000082 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +000083
84(autoload 'makeinfo-buffer
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +000085 "makeinfo"
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +000086 "Make Info file from current buffer.
87
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +000088Use the \\[next-error] command to move to the next error
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +000089\(if there are errors\)."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +000090 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +000091
92(autoload 'kill-compilation
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +000093 "compile"
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +000094 "Kill the process made by the \\[compile] command."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +000095 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +000096
97(autoload 'makeinfo-recenter-compilation-buffer
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +000098 "makeinfo"
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +000099 "Redisplay `*compilation*' buffer so most recent output can be seen.
100The last line of the buffer is displayed on
101line LINE of the window, or centered if LINE is nil."
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +0000102 t nil)
103
104(autoload 'texinfo-update-node
105 "texnfo-upd"
106 "Without any prefix argument, update the node in which point is located.
107Non-nil argument (prefix, if interactive) means update the nodes in the
108marked region.
109
110The functions for creating or updating nodes and menus, and their
111keybindings, are:
112
08f9e254
DL
Dave Love2000-12-06 19:34:15 +0000113 `texinfo-update-node' (&optional region-p) \\[texinfo-update-node]
114 `texinfo-every-node-update' () \\[texinfo-every-node-update]
115 `texinfo-sequential-node-update' (&optional region-p)
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000116
08f9e254
DL
Dave Love2000-12-06 19:34:15 +0000117 `texinfo-make-menu' (&optional region-p) \\[texinfo-make-menu]
118 `texinfo-all-menus-update' () \\[texinfo-all-menus-update]
119 `texinfo-master-menu' ()
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000120
08f9e254 Dave Love2000-12-06 19:34:15 +0000121 `texinfo-indent-menu-description' (column &optional region-p)
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +0000122
123The `texinfo-column-for-description' variable specifies the column to
124which menu descriptions are indented. Its default value is 32."
125 t nil)
126
127(autoload 'texinfo-every-node-update
128 "texnfo-upd"
129 "Update every node in a Texinfo file."
130 t nil)
131
132(autoload 'texinfo-sequential-node-update
133 "texnfo-upd"
134 "Update one node (or many) in a Texinfo file with sequential pointers.
135
136This function causes the `Next' or `Previous' pointer to point to the
137immediately preceding or following node, even if it is at a higher or
138lower hierarchical level in the document. Continually pressing `n' or
139`p' takes you straight through the file.
140
141Without any prefix argument, update the node in which point is located.
142Non-nil argument (prefix, if interactive) means update the nodes in the
143marked region.
144
145This command makes it awkward to navigate among sections and
146subsections; it should be used only for those documents that are meant
147to be read like a novel rather than a reference, and for which the
148Info `g*' command is inadequate."
149 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000150
151(autoload 'texinfo-make-menu
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000152 "texnfo-upd"
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000153 "Without any prefix argument, make or update a menu.
154Make the menu for the section enclosing the node found following point.
155
156Non-nil argument (prefix, if interactive) means make or update menus
157for nodes within or part of the marked region.
158
159Whenever a menu exists, and is being updated, the descriptions that
160are associated with node names in the pre-existing menu are
161incorporated into the new menu. Otherwise, the nodes' section titles
162are inserted as descriptions."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000163 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000164
165(autoload 'texinfo-all-menus-update
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000166 "texnfo-upd"
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000167 "Update every regular menu in a Texinfo file.
168Remove pre-existing master menu, if there is one.
169
170If called with a non-nil argument, this function first updates all the
171nodes in the buffer before updating the menus."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000172 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000173
174(autoload 'texinfo-master-menu
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000175 "texnfo-upd"
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000176 "Make a master menu for a whole Texinfo file.
177Non-nil argument (prefix, if interactive) means first update all
178existing nodes and menus. Remove pre-existing master menu, if there is one.
179
180This function creates a master menu that follows the top node. The
181master menu includes every entry from all the other menus. It
182replaces any existing ordinary menu that follows the top node.
183
184If called with a non-nil argument, this function first updates all the
185menus in the buffer (incorporating descriptions from pre-existing
186menus) before it constructs the master menu.
187
188The function removes the detailed part of an already existing master
9687a051 Karl Heuer1996-01-04 23:50:14 +0000189menu. This action depends on the pre-existing master menu using the
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000190standard `texinfo-master-menu-header'.
191
192The master menu has the following format, which is adapted from the
193recommendation in the Texinfo Manual:
194
195 * The first part contains the major nodes in the Texinfo file: the
196 nodes for the chapters, chapter-like sections, and the major
197 appendices. This includes the indices, so long as they are in
198 chapter-like sections, such as unnumbered sections.
199
200 * The second and subsequent parts contain a listing of the other,
201 lower level menus, in order. This way, an inquirer can go
202 directly to a particular node if he or she is searching for
203 specific information.
204
205Each of the menus in the detailed node listing is introduced by the
206title of the section containing the menu."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000207 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000208
209(autoload 'texinfo-indent-menu-description
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +0000210 "texnfo-upd"
211 "Indent every description in menu following point to COLUMN.
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000212Non-nil argument (prefix, if interactive) means indent every
213description in every menu in the region. Does not indent second and
214subsequent lines of a multi-line description."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000215 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000216
217(autoload 'texinfo-insert-node-lines
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000218 "texnfo-upd"
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000219 "Insert missing `@node' lines in region of Texinfo file.
220Non-nil argument (prefix, if interactive) means also to insert the
221section titles as node names; and also to insert the section titles as
222node names in pre-existing @node lines that lack names."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000223 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000224
225(autoload 'texinfo-start-menu-description
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +0000226 "texnfo-upd"
227 "In this menu entry, insert the node's section title as a description.
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000228Position point at beginning of description ready for editing.
229Do not insert a title if the line contains an existing description.
230
231You will need to edit the inserted text since a useful description
232complements the node name rather than repeats it as a title does."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000233 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000234
235(autoload 'texinfo-multiple-files-update
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000236 "texnfo-upd"
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000237 "Update first node pointers in each file included in OUTER-FILE;
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000238create or update main menu in the outer file that refers to such nodes.
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000239This does not create or update menus or pointers within the included files.
240
241With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
242insert a master menu in OUTER-FILE. This does not create or update
243menus or pointers within the included files.
244
245With optional UPDATE-EVERYTHING argument (numeric prefix arg, if
246interactive), update all the menus and all the `Next', `Previous', and
247`Up' pointers of all the files included in OUTER-FILE before inserting
248a master menu in OUTER-FILE.
249
250The command also updates the `Top' level node pointers of OUTER-FILE.
251
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000252Notes:
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000253
254 * this command does NOT save any files--you must save the
255 outer file and any modified, included files.
256
257 * except for the `Top' node, this command does NOT handle any
258 pre-existing nodes in the outer file; hence, indices must be
259 enclosed in an included file.
260
261Requirements:
262
263 * each of the included files must contain exactly one highest
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000264 hierarchical level node,
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000265 * this highest node must be the first node in the included file,
266 * each highest hierarchical level node must be of the same type.
267
268Thus, normally, each included file contains one, and only one,
269chapter."
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000270 t nil)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000271
272\f
e5167999
ER
Eric S. Raymond1992-07-16 21:47:34 +0000273;;; Code:
274
c678a343 Richard M. Stallman1993-05-16 21:14:05 +0000275;;; Don't you dare insert any `require' calls at top level in this file--rms.
e67adf46 Richard M. Stallman1993-05-16 21:11:54 +0000276
eedd2812
SM
Stefan Monnier2000-10-01 00:30:52 +0000277(defvar texinfo-section-list
278 '(("top" 1)
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000279 ("chapter" 2)
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000280 ("section" 3)
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000281 ("subsection" 4)
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000282 ("subsubsection" 5)
f412245b
SM
Stefan Monnier2003-03-14 22:29:13 +0000283 ("unnumbered" 2)
284 ("unnumberedsec" 3)
285 ("unnumberedsubsec" 4)
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000286 ("unnumberedsubsubsec" 5)
f412245b
SM
Stefan Monnier2003-03-14 22:29:13 +0000287 ("appendix" 2)
288 ("appendixsec" 3)
76b7c637 Juanma Barranquero2003-07-13 17:15:47 +0000289 ("appendixsection" 3)
f412245b Stefan Monnier2003-03-14 22:29:13 +0000290 ("appendixsubsec" 4)
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000291 ("appendixsubsubsec" 5)
f412245b
SM
Stefan Monnier2003-03-14 22:29:13 +0000292 ("majorheading" 2)
293 ("chapheading" 2)
294 ("heading" 3)
295 ("subheading" 4)
eedd2812
SM
Stefan Monnier2000-10-01 00:30:52 +0000296 ("subsubheading" 5))
297 "Alist of sectioning commands and their relative level.")
298
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000299;;; Syntax table
1de2ada0 Richard M. Stallman1993-05-19 16:52:19 +0000300
2db33a18
SM
Stefan Monnier2007-09-10 04:02:09 +0000301(defvar texinfo-mode-syntax-table
302 (let ((st (make-syntax-table)))
303 (modify-syntax-entry ?\" "." st)
304 (modify-syntax-entry ?\\ "." st)
305 (modify-syntax-entry ?@ "\\" st)
306 (modify-syntax-entry ?\^q "\\" st)
307 (modify-syntax-entry ?\[ "(]" st)
308 (modify-syntax-entry ?\] ")[" st)
309 (modify-syntax-entry ?{ "(}" st)
310 (modify-syntax-entry ?} "){" st)
311 (modify-syntax-entry ?\n ">" st)
312 (modify-syntax-entry ?\' "w" st)
313 st))
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000314
e4cfb70d Karl Heuer1995-07-28 00:24:14 +0000315;; Written by Wolfgang Bangerth <zcg51122@rpool1.rus.uni-stuttgart.de>
9687a051 Karl Heuer1996-01-04 23:50:14 +0000316;; To override this example, set either `imenu-generic-expression'
e4cfb70d
KH
Karl Heuer1995-07-28 00:24:14 +0000317;; or `imenu-create-index-function'.
318(defvar texinfo-imenu-generic-expression
08f9e254 Dave Love2000-12-06 19:34:15 +0000319 '((nil "^@\\(node\\|anchor\\)[ \t]+\\([^,\n]*\\)" 2)
e4cfb70d Karl Heuer1995-07-28 00:24:14 +0000320 ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1))
887a2f77 Karl Berry2004-01-20 01:28:15 +0000321 "Imenu generic expression for Texinfo mode. See `imenu-generic-expression'.")
e4cfb70d Karl Heuer1995-07-28 00:24:14 +0000322
cf38dd42
SM
Stefan Monnier2010-09-11 01:13:42 +0200323(defconst texinfo-syntax-propertize-function
324 (syntax-propertize-rules
325 ("\\(@\\)c\\(omment\\)?\\>" (1 "<"))
326 ("^\\(@\\)ignore\\>" (1 "< b"))
327 ("^@end ignore\\(\n\\)" (1 "> b")))
e3721db1
SM
Stefan Monnier2000-04-17 11:45:39 +0000328 "Syntactic keywords to catch comment delimiters in `texinfo-mode'.")
329
8fe6d67f Stefan Monnier2001-10-25 03:54:21 +0000330(defconst texinfo-environments
db95369b Juanma Barranquero2003-02-04 13:30:45 +0000331 '("cartouche" "copying" "defcv" "deffn" "defivar" "defmac"
25bbfb31
AM
Arni Magnusson2011-03-07 20:42:40 -0800332 "defmethod" "defop" "defopt" "defspec" "deftp" "deftypecv"
333 "deftypefn" "deftypefun" "deftypeivar" "deftypemethod"
334 "deftypeop" "deftypevar" "deftypevr" "defun" "defvar"
e1a68e89
JB
Juanma Barranquero2002-10-29 07:52:32 +0000335 "defvr" "description" "detailmenu" "direntry" "display"
336 "documentdescription" "enumerate" "example" "flushleft"
25bbfb31 Arni Magnusson2011-03-07 20:42:40 -0800337 "flushright" "format" "ftable" "group" "html" "ifclear" "ifset"
e1a68e89
JB
Juanma Barranquero2002-10-29 07:52:32 +0000338 "ifhtml" "ifinfo" "ifnothtml" "ifnotinfo" "ifnotplaintext"
339 "ifnottex" "ifplaintext" "iftex" "ignore" "itemize" "lisp"
340 "macro" "menu" "multitable" "quotation" "smalldisplay"
341 "smallexample" "smallformat" "smalllisp" "table" "tex"
342 "titlepage" "verbatim" "vtable")
887a2f77 Karl Berry2004-01-20 01:28:15 +0000343 "List of Texinfo environments.")
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000344
345(defconst texinfo-environment-regexp
346 (concat "^@" (regexp-opt (cons "end" texinfo-environments) t) "\\>")
887a2f77 Karl Berry2004-01-20 01:28:15 +0000347 "Regexp for environment-like Texinfo list commands.
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000348Subexpression 1 is what goes into the corresponding `@end' statement.")
349
e639491a Miles Bader2005-06-10 10:46:19 +0000350(defface texinfo-heading
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000351 '((t (:inherit font-lock-function-name-face)))
3ec0e903
LK
Lute Kamstra2005-05-27 13:09:37 +0000352 "Face used for section headings in `texinfo-mode'."
353 :group 'texinfo)
49c539a1 Glenn Morris2009-09-01 07:46:01 +0000354(define-obsolete-face-alias 'texinfo-heading-face 'texinfo-heading "22.1")
e639491a Miles Bader2005-06-10 10:46:19 +0000355(defvar texinfo-heading-face 'texinfo-heading)
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000356
0ece5f43 Richard M. Stallman1994-10-07 10:05:49 +0000357(defvar texinfo-font-lock-keywords
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000358 `(;; All but the first had an OVERRIDE of t.
dd7366bf Simon Marshall1996-01-25 10:40:02 +0000359 ;; It didn't seem to be any better, and it's slower--simon.
5762abec Karl Heuer1999-08-16 04:04:27 +0000360 ;; Robert J. Chassell <bob@gnu.org> says remove this line.
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +0000361 ;;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t)
362 ("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000363 ("^\\*\\([^\n:]*\\)" 1 font-lock-function-name-face t) ;menu items
364 ("@\\(emph\\|i\\|sc\\){\\([^}]+\\)" 2 'italic)
365 ("@\\(strong\\|b\\){\\([^}]+\\)" 2 'bold)
366 ("@\\(kbd\\|key\\|url\\|uref\\){\\([^}]+\\)" 2 font-lock-string-face)
e38af9bd
EZ
Eli Zaretskii2001-04-11 08:02:51 +0000367 ;; The following two groups have an OVERRIDE of `keep' because
368 ;; their arguments frequently include a @@, and we don't want that
369 ;; to overwrite the normal fontification of the argument.
370 ("@\\(file\\|email\\){\\([^}]+\\)" 2 font-lock-string-face keep)
0cf452f3 Eli Zaretskii1999-09-14 10:15:51 +0000371 ("@\\(samp\\|code\\|var\\|math\\|env\\|command\\|option\\){\\([^}]+\\)"
e38af9bd
EZ
Eli Zaretskii2001-04-11 08:02:51 +0000372 2 font-lock-variable-name-face keep)
373 ("@\\(cite\\|x?ref\\|pxref\\|dfn\\|inforef\\){\\([^}]+\\)"
374 2 font-lock-constant-face)
375 ("@\\(anchor\\){\\([^}]+\\)" 2 font-lock-type-face)
376 ("@\\(dmn\\|acronym\\|value\\){\\([^}]+\\)" 2 font-lock-builtin-face)
8fe6d67f Stefan Monnier2001-10-25 03:54:21 +0000377 ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face keep)
28736082
SM
Stefan Monnier2002-07-07 20:14:28 +0000378 ;; (,texinfo-environment-regexp
379 ;; 1 (texinfo-clone-environment (match-beginning 1) (match-end 1)) keep)
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000380 (,(concat "^@" (regexp-opt (mapcar 'car texinfo-section-list) t)
08f9e254 Dave Love2000-12-06 19:34:15 +0000381 ".*\n") 0 texinfo-heading-face t))
887a2f77 Karl Berry2004-01-20 01:28:15 +0000382 "Additional expressions to highlight in Texinfo mode.")
491f6f0f Richard M. Stallman1996-03-05 21:42:17 +0000383
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000384(defun texinfo-clone-environment (start end)
385 (let ((endp nil))
386 (save-excursion
387 (ignore-errors
388 (goto-char start)
389 (when (looking-at "end\\Sw+\\(\\sw+\\)")
390 (setq endp t start (match-beginning 1) end (match-end 1)))
391 (unless (get-char-property start 'text-clones)
392 (if endp
393 (texinfo-last-unended-begin)
394 (forward-word 1)
395 (texinfo-next-unmatched-end))
396 (skip-syntax-forward "^w")
28736082
SM
Stefan Monnier2002-07-07 20:14:28 +0000397 (when (looking-at
398 (concat (regexp-quote (buffer-substring start end)) "\\>"))
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000399 (text-clone-create start end 'spread "\\w*")))))))
400
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000401\f
402;;; Keybindings
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000403
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000404;;; Keys common both to Texinfo mode and to TeX shell.
405
406(defun texinfo-define-common-keys (keymap)
407 "Define the keys both in Texinfo mode and in the texinfo-tex-shell."
408 (define-key keymap "\C-c\C-t\C-k" 'tex-kill-job)
409 (define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-job)
410 (define-key keymap "\C-c\C-t\C-l" 'tex-recenter-output-buffer)
411 (define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-print-queue)
412 (define-key keymap "\C-c\C-t\C-q" 'tex-show-print-queue)
413 (define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print)
24e519d8 Richard M. Stallman1997-01-02 20:49:15 +0000414 (define-key keymap "\C-c\C-t\C-v" 'texinfo-tex-view)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000415 (define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex)
416
417 (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
418 (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
419
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000420;; Mode documentation displays commands in reverse order
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000421;; from how they are listed in the texinfo-mode-map.
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000422
2db33a18
SM
Stefan Monnier2007-09-10 04:02:09 +0000423(defvar texinfo-mode-map
424 (let ((map (make-sparse-keymap)))
425
426 ;; bindings for `texnfo-tex.el'
427 (texinfo-define-common-keys map)
428
429 (define-key map "\"" 'texinfo-insert-quote)
430
431 ;; bindings for `makeinfo.el'
432 (define-key map "\C-c\C-m\C-k" 'kill-compilation)
433 (define-key map "\C-c\C-m\C-l"
434 'makeinfo-recenter-compilation-buffer)
435 (define-key map "\C-c\C-m\C-r" 'makeinfo-region)
436 (define-key map "\C-c\C-m\C-b" 'makeinfo-buffer)
437
438 ;; bindings for `texinfmt.el'
439 (define-key map "\C-c\C-e\C-r" 'texinfo-format-region)
440 (define-key map "\C-c\C-e\C-b" 'texinfo-format-buffer)
441
442 ;; AUCTeX-like bindings
443 (define-key map "\e\r" 'texinfo-insert-@item)
444
445 ;; bindings for updating nodes and menus
446
447 (define-key map "\C-c\C-um" 'texinfo-master-menu)
448
449 (define-key map "\C-c\C-u\C-m" 'texinfo-make-menu)
450 (define-key map "\C-c\C-u\C-n" 'texinfo-update-node)
451 (define-key map "\C-c\C-u\C-e" 'texinfo-every-node-update)
452 (define-key map "\C-c\C-u\C-a" 'texinfo-all-menus-update)
453
454 (define-key map "\C-c\C-s" 'texinfo-show-structure)
455
456 (define-key map "\C-c}" 'up-list)
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500457 ;; FIXME: This is often used for "close block" aka texinfo-insert-@end.
2db33a18 Stefan Monnier2007-09-10 04:02:09 +0000458 (define-key map "\C-c]" 'up-list)
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500459 (define-key map "\C-c/" 'texinfo-insert-@end)
2db33a18
SM
Stefan Monnier2007-09-10 04:02:09 +0000460 (define-key map "\C-c{" 'texinfo-insert-braces)
461
462 ;; bindings for inserting strings
463 (define-key map "\C-c\C-o" 'texinfo-insert-block)
464 (define-key map "\C-c\C-c\C-d" 'texinfo-start-menu-description)
465 (define-key map "\C-c\C-c\C-s" 'texinfo-insert-@strong)
466 (define-key map "\C-c\C-c\C-e" 'texinfo-insert-@emph)
467
468 (define-key map "\C-c\C-cv" 'texinfo-insert-@var)
469 (define-key map "\C-c\C-cu" 'texinfo-insert-@uref)
470 (define-key map "\C-c\C-ct" 'texinfo-insert-@table)
471 (define-key map "\C-c\C-cs" 'texinfo-insert-@samp)
472 (define-key map "\C-c\C-cq" 'texinfo-insert-@quotation)
473 (define-key map "\C-c\C-co" 'texinfo-insert-@noindent)
474 (define-key map "\C-c\C-cn" 'texinfo-insert-@node)
475 (define-key map "\C-c\C-cm" 'texinfo-insert-@email)
476 (define-key map "\C-c\C-ck" 'texinfo-insert-@kbd)
477 (define-key map "\C-c\C-ci" 'texinfo-insert-@item)
478 (define-key map "\C-c\C-cf" 'texinfo-insert-@file)
479 (define-key map "\C-c\C-cx" 'texinfo-insert-@example)
480 (define-key map "\C-c\C-ce" 'texinfo-insert-@end)
481 (define-key map "\C-c\C-cd" 'texinfo-insert-@dfn)
482 (define-key map "\C-c\C-cc" 'texinfo-insert-@code)
483 map))
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000484
eedd2812
SM
Stefan Monnier2000-10-01 00:30:52 +0000485(easy-menu-define texinfo-mode-menu
486 texinfo-mode-map
487 "Menu used for `texinfo-mode'."
488 '("Texinfo"
489 ["Insert block" texinfo-insert-block t]
490 ;; ["Insert node" texinfo-insert-@node t]
491 "----"
003dd635
SM
Stefan Monnier2000-10-03 18:33:10 +0000492 ["Update All" (lambda () (interactive) (texinfo-master-menu t))
493 :keys "\\[universal-argument] \\[texinfo-master-menu]"]
eedd2812
SM
Stefan Monnier2000-10-01 00:30:52 +0000494 ["Update every node" texinfo-every-node-update t]
495 ["Update node" texinfo-update-node t]
496 ["Make Master menu" texinfo-master-menu t]
497 ["Make menu" texinfo-make-menu t]
498 ["Update all menus" texinfo-all-menus-update t]
499 "----"
500 ["Show structure" texinfo-show-structure t]
501 ["Format region" texinfo-format-region t]
502 ["Format buffer" texinfo-format-buffer t]
503 ["Makeinfo region" makeinfo-region t]
504 ["Makeinfo buffer" makeinfo-buffer t]))
505
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000506\f
a11609d8
SM
Stefan Monnier2000-12-08 16:31:50 +0000507(defun texinfo-filter (section list)
508 (let (res)
509 (dolist (x list) (if (eq section (cadr x)) (push (car x) res)))
510 res))
511
512(defvar texinfo-chapter-level-regexp
513 (regexp-opt (texinfo-filter 2 texinfo-section-list))
514 "Regular expression matching just the Texinfo chapter level headings.")
515
ba03d0d9
CY
Chong Yidong2012-12-01 12:57:07 +0800516(defun texinfo-current-defun-name ()
517 "Return the name of the Texinfo node at point, or nil."
9dffb5b6
CY
Chong Yidong2012-12-01 13:09:12 +0800518 (save-excursion
519 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t)
520 (match-string-no-properties 1))))
ba03d0d9 Chong Yidong2012-12-01 12:57:07 +0800521
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000522;;; Texinfo mode
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000523
f9f9507e Jim Blandy1991-05-09 21:50:55 +0000524;;;###autoload
e3721db1 Stefan Monnier2000-04-17 11:45:39 +0000525(define-derived-mode texinfo-mode text-mode "Texinfo"
d5aa8b02 Robert J. Chassell1990-07-27 16:01:02 +0000526 "Major mode for editing Texinfo files.
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000527
528 It has these extra commands:
529\\{texinfo-mode-map}
530
d5aa8b02 Robert J. Chassell1990-07-27 16:01:02 +0000531 These are files that are used as input for TeX to make printed manuals
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000532and also to be turned into Info files with \\[makeinfo-buffer] or
533the `makeinfo' program. These files must be written in a very restricted and
d5aa8b02 Robert J. Chassell1990-07-27 16:01:02 +0000534modified version of TeX input format.
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000535
536 Editing commands are like text-mode except that the syntax table is
d5aa8b02
RC
Robert J. Chassell1990-07-27 16:01:02 +0000537set up so expression commands skip Texinfo bracket groups. To see
538what the Info version of a region of the Texinfo file will look like,
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000539use \\[makeinfo-region], which runs `makeinfo' on the current region.
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000540
d5aa8b02
RC
Robert J. Chassell1990-07-27 16:01:02 +0000541 You can show the structure of a Texinfo file with \\[texinfo-show-structure].
542This command shows the structure of a Texinfo file by listing the
543lines with the @-sign commands for @chapter, @section, and the like.
544These lines are displayed in another window called the *Occur* window.
545In that window, you can position the cursor over one of the lines and
546use \\[occur-mode-goto-occurrence], to jump to the corresponding spot
547in the Texinfo file.
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000548
d5aa8b02 Robert J. Chassell1990-07-27 16:01:02 +0000549 In addition, Texinfo mode provides commands that insert various
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000550frequently used @-sign commands into the buffer. You can use these
551commands to save keystrokes. And you can insert balanced braces with
552\\[texinfo-insert-braces] and later use the command \\[up-list] to
553move forward past the closing brace.
554
d5aa8b02 Robert J. Chassell1990-07-27 16:01:02 +0000555Also, Texinfo mode provides functions for automatically creating or
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000556updating menus and node pointers. These functions
557
558 * insert the `Next', `Previous' and `Up' pointers of a node,
559 * insert or update the menu for a section, and
d5aa8b02 Robert J. Chassell1990-07-27 16:01:02 +0000560 * create a master menu for a Texinfo source file.
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000561
562Here are the functions:
563
564 texinfo-update-node \\[texinfo-update-node]
565 texinfo-every-node-update \\[texinfo-every-node-update]
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000566 texinfo-sequential-node-update
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000567
568 texinfo-make-menu \\[texinfo-make-menu]
569 texinfo-all-menus-update \\[texinfo-all-menus-update]
570 texinfo-master-menu
571
572 texinfo-indent-menu-description (column &optional region-p)
573
574The `texinfo-column-for-description' variable specifies the column to
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000575which menu descriptions are indented.
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000576
577Passed an argument (a prefix argument, if interactive), the
578`texinfo-update-node' and `texinfo-make-menu' functions do their jobs
579in the region.
580
d5aa8b02 Robert J. Chassell1990-07-27 16:01:02 +0000581To use the updating commands, you must structure your Texinfo file
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000582hierarchically, such that each `@node' line, with the exception of the
d5aa8b02 Robert J. Chassell1990-07-27 16:01:02 +0000583Top node, is accompanied by some kind of section line, such as an
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000584`@chapter' or `@section' line.
585
586If the file has a `top' node, it must be called `top' or `Top' and
587be the first node in the file.
588
e3721db1
SM
Stefan Monnier2000-04-17 11:45:39 +0000589Entering Texinfo mode calls the value of `text-mode-hook', and then the
590value of `texinfo-mode-hook'."
92eadba5
CY
Chong Yidong2012-12-01 12:09:55 +0800591 (setq-local page-delimiter
592 (concat "^@node [ \t]*[Tt]op\\|^@\\("
593 texinfo-chapter-level-regexp
594 "\\)\\>"))
595 (setq-local require-final-newline mode-require-final-newline)
596 (setq-local indent-tabs-mode nil)
597 (setq-local paragraph-separate
ba03d0d9
CY
Chong Yidong2012-12-01 12:57:07 +0800598 (concat "\b\\|@[a-zA-Z]*[ \n]\\|"
599 paragraph-separate))
600 (setq-local paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|"
601 paragraph-start))
92eadba5
CY
Chong Yidong2012-12-01 12:09:55 +0800602 (setq-local sentence-end-base "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
603 (setq-local fill-column 70)
604 (setq-local comment-start "@c ")
605 (setq-local comment-start-skip "@c +\\|@comment +")
606 (setq-local words-include-escapes t)
607 (setq-local imenu-generic-expression texinfo-imenu-generic-expression)
c0b08eb0 Dave Love1997-12-12 17:10:08 +0000608 (setq imenu-case-fold-search nil)
e3721db1 Stefan Monnier2000-04-17 11:45:39 +0000609 (setq font-lock-defaults
cf38dd42 Stefan Monnier2010-09-11 01:13:42 +0200610 '(texinfo-font-lock-keywords nil nil nil backward-paragraph))
92eadba5
CY
Chong Yidong2012-12-01 12:09:55 +0800611 (setq-local syntax-propertize-function texinfo-syntax-propertize-function)
612 (setq-local parse-sexp-lookup-properties t)
ba03d0d9 Chong Yidong2012-12-01 12:57:07 +0800613 (setq-local add-log-current-defun-function #'texinfo-current-defun-name)
f412245b
SM
Stefan Monnier2003-03-14 22:29:13 +0000614
615 ;; Outline settings.
92eadba5
CY
Chong Yidong2012-12-01 12:09:55 +0800616 (setq-local outline-heading-alist
617 ;; We should merge `outline-heading-alist' and
618 ;; `texinfo-section-list'. But in the mean time, let's
619 ;; just generate one from the other.
620 (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
621 texinfo-section-list))
622 (setq-local outline-regexp
623 (concat (regexp-opt (mapcar 'car outline-heading-alist) t)
624 "\\>"))
625
626 (setq-local tex-start-of-header "%\\*\\*start")
627 (setq-local tex-end-of-header "%\\*\\*end")
628 (setq-local tex-first-line-header-regexp "^\\\\input")
629 (setq-local tex-trailer "@bye\n")
630
58b9840b
EZ
Eli Zaretskii2014-06-20 11:47:10 +0300631 ;; Prevent skeleton.el from adding a newline to each inserted
632 ;; skeleton. Those which do want a newline do that explicitly in
633 ;; their define-skeleton form.
634 (setq-local skeleton-end-newline nil)
635
92eadba5
CY
Chong Yidong2012-12-01 12:09:55 +0800636 ;; Prevent filling certain lines, in addition to ones specified by
637 ;; the user.
638 (setq-local auto-fill-inhibit-regexp
639 (let ((prevent-filling "^@\\(def\\|multitable\\)"))
640 (if (null auto-fill-inhibit-regexp)
641 prevent-filling
642 (concat auto-fill-inhibit-regexp "\\|" prevent-filling)))))
db95369b Juanma Barranquero2003-02-04 13:30:45 +0000643
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000644
645\f
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000646;;; Insert string commands
647
d7fa3319
SM
Stefan Monnier2000-11-10 11:55:06 +0000648(defvar texinfo-block-default "example")
649
e3721db1
SM
Stefan Monnier2000-04-17 11:45:39 +0000650(define-skeleton texinfo-insert-block
651 "Create a matching pair @<cmd> .. @end <cmd> at point.
652Puts point on a blank line between them."
d7fa3319
SM
Stefan Monnier2000-11-10 11:55:06 +0000653 (setq texinfo-block-default
654 (completing-read (format "Block name [%s]: " texinfo-block-default)
f412245b Stefan Monnier2003-03-14 22:29:13 +0000655 texinfo-environments
d7fa3319 Stefan Monnier2000-11-10 11:55:06 +0000656 nil nil nil nil texinfo-block-default))
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500657 \n "@" str
658 ;; Blocks that take parameters: all the def* blocks take parameters,
659 ;; plus a few others.
660 (if (or (string-match "\\`def" str)
661 (member str '("table" "ftable" "vtable")))
662 '(nil " " -))
58b9840b Eli Zaretskii2014-06-20 11:47:10 +0300663 \n _ \n "@end " str \n \n)
e3721db1 Stefan Monnier2000-04-17 11:45:39 +0000664
eedd2812
SM
Stefan Monnier2000-10-01 00:30:52 +0000665(defun texinfo-inside-macro-p (macro &optional bound)
666 "Non-nil if inside a macro matching the regexp MACRO."
08f9e254
DL
Dave Love2000-12-06 19:34:15 +0000667 (condition-case nil
668 (save-excursion
669 (save-restriction
670 (narrow-to-region bound (point))
671 (while (progn
672 (up-list -1)
673 (not (condition-case nil
674 (save-excursion
675 (backward-sexp 1)
676 (looking-at macro))
a11609d8 Stefan Monnier2000-12-08 16:31:50 +0000677 (scan-error nil)))))
08f9e254 Dave Love2000-12-06 19:34:15 +0000678 t))
a11609d8 Stefan Monnier2000-12-08 16:31:50 +0000679 (scan-error nil)))
eedd2812
SM
Stefan Monnier2000-10-01 00:30:52 +0000680
681(defun texinfo-inside-env-p (env &optional bound)
682 "Non-nil if inside an environment matching the regexp @ENV."
683 (save-excursion
684 (and (re-search-backward (concat "@\\(end\\s +\\)?" env) bound t)
a11609d8 Stefan Monnier2000-12-08 16:31:50 +0000685 (not (match-end 1)))))
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000686
ffa5b3a3 Stefan Monnier2003-06-08 01:17:04 +0000687(defvar texinfo-enable-quote-macros "@\\(code\\|samp\\|kbd\\)\\>")
8d43bd30
EZ
Eli Zaretskii2012-12-07 17:52:40 +0200688(defvar texinfo-enable-quote-envs
689 '("example\\>" "smallexample\\>" "lisp\\>"))
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000690(defun texinfo-insert-quote (&optional arg)
887a2f77 Karl Berry2004-01-20 01:28:15 +0000691 "Insert the appropriate quote mark for Texinfo.
dfc2ef11 Paul Eggert2015-05-28 00:06:14 -0700692Usually inserts the value of `texinfo-open-quote' (normally \\=`\\=`) or
875a5d0e Paul Eggert2015-08-24 23:39:33 -0700693`texinfo-close-quote' (normally \\='\\='), depending on the context.
9768eaa7 Eli Zaretskii2000-12-02 15:33:30 +0000694With prefix argument or inside @code or @example, inserts a plain \"."
eedd2812
SM
Stefan Monnier2000-10-01 00:30:52 +0000695 (interactive "*P")
696 (let ((top (or (save-excursion (re-search-backward "@node\\>" nil t))
697 (point-min))))
9768eaa7 Eli Zaretskii2000-12-02 15:33:30 +0000698 (if (or arg
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000699 (= (preceding-char) ?\\)
700 (save-excursion
78151cd5
GM
Glenn Morris2008-12-02 03:36:25 +0000701 ;; Might be near the start of a (narrowed) buffer.
702 (ignore-errors (backward-char (length texinfo-open-quote)))
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000703 (when (or (looking-at texinfo-open-quote)
704 (looking-at texinfo-close-quote))
705 (delete-char (length texinfo-open-quote))
706 t))
f412245b
SM
Stefan Monnier2003-03-14 22:29:13 +0000707 (texinfo-inside-macro-p texinfo-enable-quote-macros top)
708 (let ((in-env nil))
709 (dolist (env texinfo-enable-quote-envs in-env)
710 (if (texinfo-inside-env-p env top)
711 (setq in-env t)))))
eedd2812 Stefan Monnier2000-10-01 00:30:52 +0000712 (self-insert-command (prefix-numeric-value arg))
9768eaa7 Eli Zaretskii2000-12-02 15:33:30 +0000713 (insert
083654ee
GM
Glenn Morris2008-12-02 03:34:19 +0000714 (if (or (bobp)
715 (memq (char-syntax (preceding-char)) '(?\( ?> ?\s)))
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000716 texinfo-open-quote
717 texinfo-close-quote)))))
db95369b Juanma Barranquero2003-02-04 13:30:45 +0000718
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +0000719;; The following texinfo-insert-@end command not only inserts a SPC
720;; after the @end, but tries to find out what belongs there. It is
721;; not very smart: it does not understand nested lists.
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000722
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000723(defun texinfo-last-unended-begin ()
724 (while (and (re-search-backward texinfo-environment-regexp)
725 (looking-at "@end"))
726 (texinfo-last-unended-begin)))
727
728(defun texinfo-next-unmatched-end ()
729 (while (and (re-search-forward texinfo-environment-regexp)
730 (save-excursion
731 (goto-char (match-beginning 0))
732 (not (looking-at "@end"))))
733 (texinfo-next-unmatched-end)))
734
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500735(define-skeleton texinfo-insert-@end
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000736 "Insert the matching `@end' for the last Texinfo command that needs one."
8fe6d67f
SM
Stefan Monnier2001-10-25 03:54:21 +0000737 (ignore-errors
738 (save-excursion
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500739 (backward-word 1)
8fe6d67f Stefan Monnier2001-10-25 03:54:21 +0000740 (texinfo-last-unended-begin)
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500741 (or (match-string 1) '-)))
58b9840b Eli Zaretskii2014-06-20 11:47:10 +0300742 \n "@end " str \n \n)
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500743
744(define-skeleton texinfo-insert-braces
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000745 "Make a pair of braces and be poised to type inside of them.
746Use \\[up-list] to move forward out of the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500747 nil
748 "{" _ "}")
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000749
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500750(define-skeleton texinfo-insert-@code
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000751 "Insert a `@code{...}' command in a Texinfo buffer.
752A numeric argument says how many words the braces should surround.
753The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500754 nil
755 "@code{" _ "}")
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000756
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500757(define-skeleton texinfo-insert-@dfn
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000758 "Insert a `@dfn{...}' command in a Texinfo buffer.
759A numeric argument says how many words the braces should surround.
760The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500761 nil
762 "@dfn{" _ "}")
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000763
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500764(define-skeleton texinfo-insert-@email
af9eaa5e
GM
Gerd Moellmann2000-04-17 15:23:08 +0000765 "Insert a `@email{...}' command in a Texinfo buffer.
766A numeric argument says how many words the braces should surround.
767The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500768 nil
769 "@email{" _ "}")
af9eaa5e Gerd Moellmann2000-04-17 15:23:08 +0000770
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500771(define-skeleton texinfo-insert-@emph
af9eaa5e
GM
Gerd Moellmann2000-04-17 15:23:08 +0000772 "Insert a `@emph{...}' command in a Texinfo buffer.
773A numeric argument says how many words the braces should surround.
774The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500775 nil
776 "@emph{" _ "}")
af9eaa5e Gerd Moellmann2000-04-17 15:23:08 +0000777
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500778(define-skeleton texinfo-insert-@example
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000779 "Insert the string `@example' in a Texinfo buffer."
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500780 nil
58b9840b Eli Zaretskii2014-06-20 11:47:10 +0300781 \n "@example" \n \n)
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000782
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500783(define-skeleton texinfo-insert-@file
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000784 "Insert a `@file{...}' command in a Texinfo buffer.
785A numeric argument says how many words the braces should surround.
786The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500787 nil
788 "@file{" _ "}")
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000789
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500790(define-skeleton texinfo-insert-@item
235de372
EZ
Eli Zaretskii2004-02-21 13:51:34 +0000791 "Insert the string `@item' in a Texinfo buffer.
792If in a table defined by @table, follow said string with a space.
793Otherwise, follow with a newline."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500794 nil
795 \n "@item"
235de372
EZ
Eli Zaretskii2004-02-21 13:51:34 +0000796 (if (equal (ignore-errors
797 (save-excursion
798 (texinfo-last-unended-begin)
799 (match-string 1)))
800 "table")
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500801 " " '\n)
802 _ \n)
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000803
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500804(define-skeleton texinfo-insert-@kbd
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000805 "Insert a `@kbd{...}' command in a Texinfo buffer.
806A numeric argument says how many words the braces should surround.
807The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500808 nil
809 "@kbd{" _ "}")
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000810
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500811(define-skeleton texinfo-insert-@node
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000812 "Insert the string `@node' in a Texinfo buffer.
481b0db7
RC
Robert J. Chassell2002-04-29 12:59:26 +0000813Insert a comment on the following line indicating the order of
814arguments to @node. Insert a carriage return after the comment line.
815Leave point after `@node'."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500816 nil
817 \n "@node " _ \n)
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000818
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500819(define-skeleton texinfo-insert-@noindent
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000820 "Insert the string `@noindent' in a Texinfo buffer."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500821 nil
822 \n "@noindent" \n)
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000823
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500824(define-skeleton texinfo-insert-@quotation
af9eaa5e Gerd Moellmann2000-04-17 15:23:08 +0000825 "Insert the string `@quotation' in a Texinfo buffer."
58b9840b Eli Zaretskii2014-06-20 11:47:10 +0300826 \n "@quotation" \n _ \n)
af9eaa5e Gerd Moellmann2000-04-17 15:23:08 +0000827
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500828(define-skeleton texinfo-insert-@samp
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000829 "Insert a `@samp{...}' command in a Texinfo buffer.
830A numeric argument says how many words the braces should surround.
831The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500832 nil
833 "@samp{" _ "}")
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000834
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500835(define-skeleton texinfo-insert-@strong
af9eaa5e
GM
Gerd Moellmann2000-04-17 15:23:08 +0000836 "Insert a `@strong{...}' command in a Texinfo buffer.
837A numeric argument says how many words the braces should surround.
838The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500839 nil
840 "@strong{" _ "}")
af9eaa5e Gerd Moellmann2000-04-17 15:23:08 +0000841
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500842(define-skeleton texinfo-insert-@table
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000843 "Insert the string `@table' in a Texinfo buffer."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500844 nil
845 \n "@table " _ \n)
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000846
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500847(define-skeleton texinfo-insert-@var
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000848 "Insert a `@var{}' command in a Texinfo buffer.
849A numeric argument says how many words the braces should surround.
850The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500851 nil
852 "@var{" _ "}")
af9eaa5e Gerd Moellmann2000-04-17 15:23:08 +0000853
61f91c04 Stefan Monnier2010-12-10 09:10:08 -0500854(define-skeleton texinfo-insert-@uref
08f9e254 Dave Love2000-12-06 19:34:15 +0000855 "Insert a `@uref{}' command in a Texinfo buffer.
af9eaa5e
GM
Gerd Moellmann2000-04-17 15:23:08 +0000856A numeric argument says how many words the braces should surround.
857The default is not to surround any existing words with the braces."
61f91c04
SM
Stefan Monnier2010-12-10 09:10:08 -0500858 nil
859 "@uref{" _ "}")
4fb0a34c Eli Zaretskii2000-11-15 13:57:50 +0000860(defalias 'texinfo-insert-@url 'texinfo-insert-@uref)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000861\f
862;;; Texinfo file structure
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000863
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +0000864(defun texinfo-show-structure (&optional nodes-too)
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000865 "Show the structure of a Texinfo file.
d5aa8b02
RC
Robert J. Chassell1990-07-27 16:01:02 +0000866List the lines in the file that begin with the @-sign commands for
867@chapter, @section, and the like.
868
869With optional argument (prefix if interactive), list both the lines
870with @-sign commands for @chapter, @section, and the like, and list
871@node lines.
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000872
873Lines with structuring commands beginning in them are displayed in
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000874another buffer named `*Occur*'. In that buffer, you can move point to
db95369b Juanma Barranquero2003-02-04 13:30:45 +0000875one of those lines and then use
aae61ef3 Robert J. Chassell2001-12-25 16:16:22 +0000876\\<occur-mode-map>\\[occur-mode-goto-occurrence],
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000877to jump to the corresponding spot in the Texinfo source file."
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000878
879 (interactive "P")
aae61ef3 Robert J. Chassell2001-12-25 16:16:22 +0000880 ;; First, remember current location
ffa5b3a3 Stefan Monnier2003-06-08 01:17:04 +0000881 (let (current-location)
aae61ef3
RC
Robert J. Chassell2001-12-25 16:16:22 +0000882 (save-excursion
883 (end-of-line) ; so as to find section on current line
db95369b Juanma Barranquero2003-02-04 13:30:45 +0000884 (if (re-search-backward
aae61ef3
RC
Robert J. Chassell2001-12-25 16:16:22 +0000885 ;; do not require `texinfo-section-types-regexp' in texnfo-upd.el
886 "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)"
887 nil t)
888 (setq current-location
889 (progn
890 (beginning-of-line)
891 (buffer-substring (point) (progn (end-of-line) (point)))))
ffa5b3a3 Stefan Monnier2003-06-08 01:17:04 +0000892 ;; else point is located before any section command.
aae61ef3
RC
Robert J. Chassell2001-12-25 16:16:22 +0000893 (setq current-location "tex")))
894 ;; Second, create and format an *Occur* buffer
895 (save-excursion
896 (goto-char (point-min))
4ae1fdf6
SM
Stefan Monnier2004-01-21 03:09:06 +0000897 (occur (concat "^\\(?:" (if nodes-too "@node\\>\\|")
898 outline-regexp "\\)")))
aae61ef3 Robert J. Chassell2001-12-25 16:16:22 +0000899 (pop-to-buffer "*Occur*")
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000900 (goto-char (point-min))
aae61ef3
RC
Robert J. Chassell2001-12-25 16:16:22 +0000901 (let ((inhibit-read-only t))
902 (flush-lines "-----")
903 ;; Now format the "*Occur*" buffer to show the structure.
904 ;; Thanks to ceder@signum.se (Per Cederqvist)
905 (goto-char (point-max))
906 (let (level)
907 (while (re-search-backward "^ *[0-9]*:@\\(\\sw+\\)" nil 0)
908 (goto-char (1- (match-beginning 1)))
909 (setq level
910 (or (cadr (assoc (match-string 1) texinfo-section-list)) 2))
911 (indent-to-column (+ (current-column) (* 4 (- level 2))))
912 (beginning-of-line))))
913 ;; Third, go to line corresponding to location in source file
db95369b Juanma Barranquero2003-02-04 13:30:45 +0000914 ;; potential bug: two exactly similar `current-location' lines ...
aae61ef3
RC
Robert J. Chassell2001-12-25 16:16:22 +0000915 (goto-char (point-min))
916 (re-search-forward current-location nil t)
917 (beginning-of-line)
918 ))
919
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000920\f
921;;; The tex and print function definitions:
922
cd482e05 Richard M. Stallman1997-04-12 02:51:38 +0000923(defcustom texinfo-texi2dvi-command "texi2dvi"
2db33a18 Stefan Monnier2007-09-10 04:02:09 +0000924 "Command used by `texinfo-tex-buffer' to run TeX and texindex on a buffer."
cd482e05
RS
Richard M. Stallman1997-04-12 02:51:38 +0000925 :type 'string
926 :group 'texinfo)
bb946175 Richard M. Stallman1993-11-11 07:52:56 +0000927
cd482e05 Richard M. Stallman1997-04-12 02:51:38 +0000928(defcustom texinfo-tex-command "tex"
2db33a18 Stefan Monnier2007-09-10 04:02:09 +0000929 "Command used by `texinfo-tex-region' to run TeX on a region."
cd482e05
RS
Richard M. Stallman1997-04-12 02:51:38 +0000930 :type 'string
931 :group 'texinfo)
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000932
cd482e05 Richard M. Stallman1997-04-12 02:51:38 +0000933(defcustom texinfo-texindex-command "texindex"
2db33a18 Stefan Monnier2007-09-10 04:02:09 +0000934 "Command used by `texinfo-texindex' to sort unsorted index files."
cd482e05
RS
Richard M. Stallman1997-04-12 02:51:38 +0000935 :type 'string
936 :group 'texinfo)
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000937
cd482e05 Richard M. Stallman1997-04-12 02:51:38 +0000938(defcustom texinfo-delete-from-print-queue-command "lprm"
2db33a18 Stefan Monnier2007-09-10 04:02:09 +0000939 "Command string used to delete a job from the line printer queue.
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000940Command is used by \\[texinfo-delete-from-print-queue] based on
941number provided by a previous \\[tex-show-print-queue]
cd482e05
RS
Richard M. Stallman1997-04-12 02:51:38 +0000942command."
943 :type 'string
944 :group 'texinfo)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000945
946(defvar texinfo-tex-trailer "@bye"
947 "String appended after a region sent to TeX by `texinfo-tex-region'.")
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000948
949(defun texinfo-tex-region (beg end)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000950 "Run TeX on the current region.
951This works by writing a temporary file (`tex-zap-file') in the directory
952that is the value of `tex-directory', then running TeX on that file.
953
954The first line of the buffer is copied to the
1433a222
CZ
Christopher Zaborsky1992-11-10 20:01:10 +0000955temporary file; and if the buffer has a header, it is written to the
956temporary file before the region itself. The buffer's header is all lines
957between the strings defined by `tex-start-of-header' and `tex-end-of-header'
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000958inclusive. The header must start in the first 100 lines.
959
960The value of `texinfo-tex-trailer' is appended to the temporary file after the region."
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000961 (interactive "r")
e67adf46 Richard M. Stallman1993-05-16 21:11:54 +0000962 (require 'tex-mode)
24e519d8 Richard M. Stallman1997-01-02 20:49:15 +0000963 (let ((tex-command texinfo-tex-command)
3654a351 Andreas Schwab1998-12-14 10:17:50 +0000964 (tex-trailer texinfo-tex-trailer))
24e519d8 Richard M. Stallman1997-01-02 20:49:15 +0000965 (tex-region beg end)))
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000966
967(defun texinfo-tex-buffer ()
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000968 "Run TeX on visited file, once or twice, to make a correct `.dvi' file."
969 (interactive)
97c6c316 Richard M. Stallman1993-08-10 08:24:55 +0000970 (require 'tex-mode)
3654a351
AS
Andreas Schwab1998-12-14 10:17:50 +0000971 (let ((tex-command texinfo-texi2dvi-command)
972 ;; Disable tex-start-options-string. texi2dvi would not
973 ;; understand anything specified here.
974 (tex-start-options-string ""))
24e519d8 Richard M. Stallman1997-01-02 20:49:15 +0000975 (tex-buffer)))
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000976
977(defun texinfo-texindex ()
978 "Run `texindex' on unsorted index files.
979The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
980This runs the shell command defined by `texinfo-texindex-command'."
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000981 (interactive)
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000982 (require 'tex-mode)
79183f1a Richard M. Stallman1993-11-20 22:21:58 +0000983 (tex-send-command texinfo-texindex-command (concat tex-zap-file ".??"))
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +0000984 ;; alternatively
985 ;; (send-string "tex-shell"
986 ;; (concat texinfo-texindex-command
987 ;; " " tex-zap-file ".??" "\n"))
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +0000988 (tex-recenter-output-buffer nil))
952d72ff
RC
Robert J. Chassell1990-06-28 21:32:49 +0000989
990(defun texinfo-tex-print ()
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +0000991 "Print `.dvi' file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
992This runs the shell command defined by `tex-dvi-print-command'."
952d72ff Robert J. Chassell1990-06-28 21:32:49 +0000993 (interactive)
e67adf46 Richard M. Stallman1993-05-16 21:11:54 +0000994 (require 'tex-mode)
24e519d8
RS
Richard M. Stallman1997-01-02 20:49:15 +0000995 (tex-print))
996
997(defun texinfo-tex-view ()
998 "View `.dvi' file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
999This runs the shell command defined by `tex-dvi-view-command'."
1000 (interactive)
1001 (require 'tex-mode)
1002 (tex-view))
952d72ff Robert J. Chassell1990-06-28 21:32:49 +00001003
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +00001004(defun texinfo-quit-job ()
1005 "Quit currently running TeX job, by sending an `x' to it."
1006 (interactive)
1007 (if (not (get-process "tex-shell"))
1008 (error "No TeX shell running"))
79183f1a Richard M. Stallman1993-11-20 22:21:58 +00001009 (tex-send-command "x"))
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +00001010;; alternatively:
1011;; save-excursion
1012;; (set-buffer (get-buffer "*tex-shell*"))
1013;; (goto-char (point-max))
1014;; (insert "x")
1015;; (comint-send-input)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +00001016
1017(defun texinfo-delete-from-print-queue (job-number)
1018 "Delete job from the line printer spooling queue.
1019You are prompted for the job number (use a number shown by a previous
5ccb13ff Richard M. Stallman1997-05-24 21:18:25 +00001020\\[tex-show-print-queue] command)."
c6cc04e9 Richard M. Stallman1993-06-25 06:41:54 +00001021 (interactive "nPrinter job number for deletion: ")
97c6c316 Richard M. Stallman1993-08-10 08:24:55 +00001022 (require 'tex-mode)
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +00001023 (if (tex-shell-running)
1024 (tex-kill-job)
1025 (tex-start-shell))
79183f1a Richard M. Stallman1993-11-20 22:21:58 +00001026 (tex-send-command texinfo-delete-from-print-queue-command job-number)
5ccb13ff
RS
Richard M. Stallman1997-05-24 21:18:25 +00001027 ;; alternatively
1028 ;; (send-string "tex-shell"
1029 ;; (concat
1030 ;; texinfo-delete-from-print-queue-command
1031 ;; " "
1032 ;; job-number"\n"))
c6cc04e9
RS
Richard M. Stallman1993-06-25 06:41:54 +00001033 (tex-recenter-output-buffer nil))
1034
49116ac0
JB
Jim Blandy1992-03-16 20:39:07 +00001035(provide 'texinfo)
1036
d501f516 Eric S. Raymond1992-05-30 20:24:49 +00001037;;; texinfo.el ends here