annotate lisp/textmodes/texinfmt.el @ 3946:535f1f575d04

(set-visited-file-name): Rename auto-save file only if it exists.
author Richard M. Stallman <rms@gnu.org>
date Thu, 01 Jul 1993 20:33:56 +0000
parents 507f64624555
children 0ab53cbfac0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1576
diff changeset
1 ;;; texinfmt.el --- convert Texinfo files to Info files.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
3 ;; Copyright (C) 1985, 1986, 1988, 1990 Free Software Foundation, Inc.
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
5 ;; Author: Robert J. Chassell <bob@gnu.ai.mit.edu>
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
6 ;; Version: 2.00
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
7 ;; Keywords: tex, help
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
8
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
10
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
14 ;; any later version.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
15
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
20
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
24
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
25 ;;; Commentary:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
26
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
27 ;; Updated May 1990 to correspond, more or less, to version 2.8 of
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
28 ;; texinfo.tex. NOTE: texinfmt.el is being phased out; it is being
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
29 ;; replaced by makeinfo.c, which is faster and provides better error
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
30 ;; checking.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
31 ;; Robert J. Chassell, bob@ai.mit.edu
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
32
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
33 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
34
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
35 (defvar texinfo-format-syntax-table nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
36
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
37 (defvar texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
38 (defvar texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
39 (defvar texinfo-cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
40 (defvar texinfo-pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
41 (defvar texinfo-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
42 (defvar texinfo-kindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
43 (defvar texinfo-last-node)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
44 (defvar texinfo-node-names)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
45
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
46 (if texinfo-format-syntax-table
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
47 nil
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
48 (setq texinfo-format-syntax-table (make-syntax-table))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
49 (modify-syntax-entry ?\" " " texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
50 (modify-syntax-entry ?\\ " " texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
51 (modify-syntax-entry ?@ "\\" texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
52 (modify-syntax-entry ?\^q "\\" texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
53 (modify-syntax-entry ?\[ "." texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
54 (modify-syntax-entry ?\] "." texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
55 (modify-syntax-entry ?\( "." texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
56 (modify-syntax-entry ?\) "." texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
57 (modify-syntax-entry ?{ "(}" texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
58 (modify-syntax-entry ?} "){" texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
59 (modify-syntax-entry ?\' "." texinfo-format-syntax-table))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
60
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 189
diff changeset
61 ;;;###autoload
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
62 (defun texinfo-format-buffer (&optional notagify)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
63 "Process the current buffer as texinfo code, into an Info file.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
64 The Info file output is generated in a buffer visiting the Info file
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
65 names specified in the @setfilename command.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
66
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
67 Non-nil argument (prefix, if interactive) means don't make tag table
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
68 and don't split the file if large. You can use Info-tagify and
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
69 Info-split to do these manually."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
70 (interactive "P")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
71 (let ((lastmessage "Formatting Info file..."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
72 (message lastmessage)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
73 (texinfo-format-buffer-1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
74 (if notagify
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
75 nil
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
76 (if (> (buffer-size) 30000)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
77 (progn
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
78 (message (setq lastmessage "Making tags table for Info file..."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
79 (Info-tagify)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
80 (if (> (buffer-size) 100000)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
81 (progn
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
82 (message (setq lastmessage "Splitting Info file..."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
83 (Info-split))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
84 (message (concat lastmessage
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
85 (if (interactive-p) "done. Now save it." "done.")))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
86
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
87
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
88 (defun texinfo-format-buffer-1 ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
89 (let (texinfo-format-filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
90 texinfo-example-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
91 texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
92 texinfo-command-end
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
93 texinfo-command-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
94 texinfo-last-node
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
95 texinfo-vindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
96 texinfo-findex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
97 texinfo-cindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
98 texinfo-pindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
99 texinfo-tindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
100 texinfo-kindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
101 texinfo-stack
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
102 texinfo-node-names
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
103 (texinfo-footnote-number 0)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
104 last-input-buffer
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
105 outfile
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
106 (fill-column fill-column)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
107 (input-buffer (current-buffer))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
108 (input-directory default-directory))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
109 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
110 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
111 (search-forward "@setfilename")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
112 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
113 (setq outfile (texinfo-parse-line-arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
114 (find-file outfile)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
115 (texinfo-mode)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
116 (set-syntax-table texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
117 (erase-buffer)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
118 (insert-buffer-substring input-buffer)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
119 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
120 (search-forward "@setfilename")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
121 (beginning-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
122 (delete-region (point-min) (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
123 ;; Remove @bye at end of file, if it is there.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
124 (goto-char (point-max))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
125 (if (search-backward "@bye" nil t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
126 (delete-region (point) (point-max)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
127 ;; Make sure buffer ends in a newline.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
128 (or (= (preceding-char) ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
129 (insert "\n"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
130 ;; Scan the whole buffer, converting to Info format.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
131 (texinfo-format-scan)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
132 ;; Return data for indices.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
133 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
134 (list outfile
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
135 texinfo-vindex texinfo-findex texinfo-cindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
136 texinfo-pindex texinfo-tindex texinfo-kindex)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
137
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
138 (defvar texinfo-region-buffer-name "*Info Region*"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
139 "*Name of the temporary buffer used by \\[texinfo-format-region].")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
140
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 189
diff changeset
141 ;;;###autoload
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
142 (defun texinfo-format-region (region-beginning region-ending)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
143 "Convert the current region of the Texinfo file to Info format.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
144 This lets you see what that part of the file will look like in Info.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
145 The command is bound to \\[texinfo-format-region]. The text that is
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
146 converted to Info is stored in a temporary buffer."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
147 (interactive "r")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
148 (message "Converting region to Info format...")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
149 (let (texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
150 texinfo-command-end
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
151 texinfo-command-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
152 texinfo-vindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
153 texinfo-findex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
154 texinfo-cindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
155 texinfo-pindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
156 texinfo-tindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
157 texinfo-kindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
158 texinfo-stack
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
159 texinfo-format-filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
160 texinfo-example-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
161 texinfo-last-node
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
162 texinfo-node-names
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
163 (texinfo-footnote-number 0)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
164 last-input-buffer
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
165 (fill-column fill-column)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
166 (input-buffer (current-buffer))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
167 (input-directory default-directory)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
168 filename-beginning
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
169 filename-ending)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
170
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
171 ;;; Find a buffer to use.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
172
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
173 (switch-to-buffer (get-buffer-create texinfo-region-buffer-name))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
174
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
175 ;; Insert the region into the buffer.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
176 (erase-buffer)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
177
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
178 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
179 (set-buffer input-buffer)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
180 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
181 (save-restriction
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
182 (widen)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
183 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
184 ;; Initialize the buffer with the filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
185 ;; or else explain that a filename is needed.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
186 (or (search-forward "@setfilename"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
187 (save-excursion (forward-line 100) (point)) t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
188 (error "The texinfo file needs a line saying: @setfilename <name>"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
189 (beginning-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
190 (setq filename-beginning (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
191 (forward-line 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
192 (setq filename-ending (point)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
193
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
194 ;; Insert the @setfilename line into the buffer.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
195 (insert-buffer-substring input-buffer
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
196 (min filename-beginning region-beginning)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
197 filename-ending)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
198
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
199 ;; Insert the region into the buffer.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
200 (insert-buffer-substring input-buffer
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
201 (max region-beginning filename-ending)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
202 region-ending)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
203
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
204 (texinfo-mode)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
205
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
206 ;; Install a syntax table useful for scanning command operands.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
207 (set-syntax-table texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
208
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
209 ;; If the region includes the effective end of the data,
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
210 ;; discard everything after that.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
211 (goto-char (point-max))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
212 (if (re-search-backward "^@bye" nil t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
213 (delete-region (point) (point-max)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
214 ;; Make sure buffer ends in a newline.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
215 (or (= (preceding-char) ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
216 (insert "\n"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
217
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
218 ;; Now convert for real.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
219 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
220 (texinfo-format-scan)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
221 (goto-char (point-min)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
222
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
223 (message "Done."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
224
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
225
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
226 ;; Perform those texinfo-to-info conversions that apply to the whole input
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
227 ;; uniformly.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
228 (defun texinfo-format-scan ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
229 ;; Convert left and right quotes to typewriter font quotes.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
230 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
231 (while (search-forward "``" nil t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
232 (replace-match "\""))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
233 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
234 (while (search-forward "''" nil t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
235 (replace-match "\""))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
236 ;; Scan for @-commands.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
237 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
238 (while (search-forward "@" nil t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
239 (if (looking-at "[@{}'` *]")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
240 ;; Handle a few special @-followed-by-one-char commands.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
241 (if (= (following-char) ?*)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
242 (progn
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
243 ;; remove command
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
244 (delete-region (1- (point)) (1+ (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
245 ;; insert return if not at end of line;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
246 ;; else line is already broken.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
247 (if (not (= (following-char) ?\n))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
248 (insert ?\n)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
249 ;; The other characters are simply quoted. Delete the @.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
250 (delete-char -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
251 (forward-char 1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
252 ;; @ is followed by a command-word; find the end of the word.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
253 (setq texinfo-command-start (1- (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
254 (if (= (char-syntax (following-char)) ?w)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
255 (forward-word 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
256 (forward-char 1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
257 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
258 ;; Call the handler for this command.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
259 (setq texinfo-command-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
260 (intern (buffer-substring (1+ texinfo-command-start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
261 texinfo-command-end)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
262 (let ((cmd (get texinfo-command-name 'texinfo-format)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
263 (if cmd (funcall cmd)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
264 (texinfo-unsupported)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
265 (cond (texinfo-stack
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
266 (goto-char (nth 2 (car texinfo-stack)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
267 (error "Unterminated @%s" (car (car texinfo-stack))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
268
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
269 (put 'begin 'texinfo-format 'texinfo-format-begin)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
270 (defun texinfo-format-begin ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
271 (texinfo-format-begin-end 'texinfo-format))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
272
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
273 (put 'end 'texinfo-format 'texinfo-format-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
274 (defun texinfo-format-end ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
275 (texinfo-format-begin-end 'texinfo-end))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
276
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
277 (defun texinfo-format-begin-end (prop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
278 (setq texinfo-command-name (intern (texinfo-parse-line-arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
279 (setq cmd (get texinfo-command-name prop))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
280 (if cmd (funcall cmd)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
281 (texinfo-unsupported)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
282
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
283 (defun texinfo-parse-line-arg ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
284 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
285 (let ((start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
286 (cond ((looking-at " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
287 (skip-chars-forward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
288 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
289 (end-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
290 (skip-chars-backward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
291 (setq texinfo-command-end (1+ (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
292 ((looking-at "{")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
293 (setq start (1+ (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
294 (forward-list 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
295 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
296 (forward-char -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
297 (t
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
298 (error "Invalid texinfo command arg format")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
299 (prog1 (buffer-substring start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
300 (if (eolp) (forward-char 1)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
301
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
302 (defun texinfo-parse-expanded-arg ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
303 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
304 (let ((start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
305 marker)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
306 (cond ((looking-at " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
307 (skip-chars-forward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
308 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
309 (end-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
310 (setq texinfo-command-end (1+ (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
311 ((looking-at "{")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
312 (setq start (1+ (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
313 (forward-list 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
314 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
315 (forward-char -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
316 (t
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
317 (error "Invalid texinfo command arg format")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
318 (setq marker (move-marker (make-marker) texinfo-command-end))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
319 (texinfo-format-expand-region start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
320 (setq texinfo-command-end (marker-position marker))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
321 (move-marker marker nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
322 (prog1 (buffer-substring start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
323 (if (eolp) (forward-char 1)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
324
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
325 (defun texinfo-format-expand-region (start end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
326 (save-restriction
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
327 (narrow-to-region start end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
328 (let (texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
329 texinfo-command-end
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
330 texinfo-command-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
331 texinfo-stack)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
332 (texinfo-format-scan))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
333 (goto-char (point-max))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
334
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
335 (defun texinfo-parse-arg-discard ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
336 (prog1 (texinfo-parse-line-arg)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
337 (texinfo-discard-command)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
338
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
339 (defun texinfo-discard-command ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
340 (delete-region texinfo-command-start texinfo-command-end))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
341
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
342 (defun texinfo-optional-braces-discard ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
343 "Discard braces following command, if any."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
344 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
345 (let ((start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
346 (cond ((looking-at "[ \t]*\n")) ; do nothing
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
347 ((looking-at "{") ; remove braces, if any
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
348 (forward-list 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
349 (setq texinfo-command-end (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
350 (t
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
351 (error
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
352 "Invalid `texinfo-optional-braces-discard' format \(need braces?\)")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
353 (delete-region texinfo-command-start texinfo-command-end)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
354
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
355 (defun texinfo-format-parse-line-args ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
356 (let ((start (1- (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
357 next beg end
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
358 args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
359 (skip-chars-forward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
360 (while (not (eolp))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
361 (setq beg (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
362 (re-search-forward "[\n,]")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
363 (setq next (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
364 (if (bolp) (setq next (1- next)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
365 (forward-char -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
366 (skip-chars-backward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
367 (setq end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
368 (setq args (cons (if (> end beg) (buffer-substring beg end))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
369 args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
370 (goto-char next)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
371 (skip-chars-forward " "))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
372 (if (eolp) (forward-char 1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
373 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
374 (nreverse args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
375
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
376 (defun texinfo-format-parse-args ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
377 (let ((start (1- (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
378 next beg end
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
379 args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
380 (search-forward "{")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
381 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
382 (texinfo-format-expand-region
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
383 (point)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
384 (save-excursion (up-list 1) (1- (point)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
385 (while (/= (preceding-char) ?\})
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
386 (skip-chars-forward " \t\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
387 (setq beg (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
388 (re-search-forward "[},]")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
389 (setq next (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
390 (forward-char -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
391 (skip-chars-backward " \t\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
392 (setq end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
393 (cond ((< beg end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
394 (goto-char beg)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
395 (while (search-forward "\n" end t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
396 (replace-match " "))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
397 (setq args (cons (if (> end beg) (buffer-substring beg end))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
398 args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
399 (goto-char next))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
400 (if (eolp) (forward-char 1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
401 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
402 (nreverse args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
403
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
404 (defun texinfo-format-parse-defun-args ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
405 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
406 (let ((start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
407 (end-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
408 (setq texinfo-command-end (1+ (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
409 (let ((marker (move-marker (make-marker) texinfo-command-end)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
410 (texinfo-format-expand-region start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
411 (setq texinfo-command-end (marker-position marker))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
412 (move-marker marker nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
413 (goto-char start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
414 (let ((args '())
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
415 beg end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
416 (skip-chars-forward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
417 (while (not (eolp))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
418 (cond ((looking-at "{")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
419 (setq beg (1+ (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
420 (forward-list 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
421 (setq end (1- (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
422 (t
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
423 (setq beg (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
424 (re-search-forward "[\n ]")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
425 (forward-char -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
426 (setq end (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
427 (setq args (cons (buffer-substring beg end) args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
428 (skip-chars-forward " "))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
429 (forward-char 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
430 (nreverse args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
431
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
432
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
433 ; 19 October 1990
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3456
diff changeset
434 ; @setfilename modified to work with include files; see @include
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
435 ; (defun texinfo-format-setfilename ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
436 ; (let ((arg (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
437 ; (setq texinfo-format-filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
438 ; (file-name-nondirectory (expand-file-name arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
439 ; (insert "Info file: "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
440 ; texinfo-format-filename ", -*-Text-*-\n"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
441 ; "produced by texinfo-format-buffer\nfrom "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
442 ; (if (buffer-file-name input-buffer)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
443 ; (concat "file: "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
444 ; (file-name-sans-versions
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
445 ; (file-name-nondirectory
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
446 ; (buffer-file-name input-buffer))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
447 ; (concat "buffer " (buffer-name input-buffer)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
448 ; "\n\n")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
449
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
450 (put 'setfilename 'texinfo-format 'texinfo-format-setfilename)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
451 (defun texinfo-format-setfilename ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
452 (let ((arg (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
453 (if (eq input-buffer last-input-buffer)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
454 nil ; only use first setfilename in buffer
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
455 (message "Formatting Info file: %s" arg)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
456 (setq texinfo-format-filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
457 (file-name-nondirectory (expand-file-name arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
458 (insert "Info file: "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
459 texinfo-format-filename ", -*-Text-*-\n"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
460 "produced by texinfo-format-buffer\nfrom "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
461 (if (buffer-file-name input-buffer)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
462 (concat "file: "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
463 (file-name-sans-versions
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
464 (file-name-nondirectory
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
465 (buffer-file-name input-buffer))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
466 (concat "buffer " (buffer-name input-buffer)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
467 "\n\n"))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
468
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
469 (put 'node 'texinfo-format 'texinfo-format-node)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
470 (defun texinfo-format-node ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
471 (let* ((args (texinfo-format-parse-line-args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
472 (name (nth 0 args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
473 (next (nth 1 args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
474 (prev (nth 2 args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
475 (up (nth 3 args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
476 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
477 (setq texinfo-last-node name)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
478 (let ((tem (downcase name)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
479 (if (assoc tem texinfo-node-names)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
480 (error "Duplicate node name: %s" name)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
481 (setq texinfo-node-names (cons (list tem) texinfo-node-names))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
482 (setq texinfo-footnote-number 0)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
483 (or (bolp)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
484 (insert ?\n))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
485 (insert "\^_\nFile: " texinfo-format-filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
486 " Node: " name)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
487 (if prev
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
488 (insert ", Prev: " prev))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
489 (if up
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
490 (insert ", Up: " up))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
491 (if next
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
492 (insert ", Next: " next))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
493 (insert ?\n)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
494
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
495 (put 'menu 'texinfo-format 'texinfo-format-menu)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
496 (defun texinfo-format-menu ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
497 (texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
498 (insert "* Menu:\n\n"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
499
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
500 (put 'menu 'texinfo-end 'texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
501 (defun texinfo-discard-line ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
502 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
503 (skip-chars-forward " \t")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
504 (or (eolp)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
505 (error "Extraneous text at end of command line."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
506 (goto-char texinfo-command-start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
507 (or (bolp)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
508 (error "Extraneous text at beginning of command line."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
509 (delete-region (point) (progn (forward-line 1) (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
510
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
511 ; @xref {NODE, FNAME, NAME, FILE, DOCUMENT}
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
512 ; -> *Note FNAME: (FILE)NODE
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
513 ; If FILE is missing,
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
514 ; *Note FNAME: NODE
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
515 ; If FNAME is empty and NAME is present
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
516 ; *Note NAME: Node
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
517 ; If both NAME and FNAME are missing
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
518 ; *Note NODE::
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
519 ; texinfo ignores the DOCUMENT argument.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
520 ; -> See section <xref to NODE> [NAME, else NODE], page <xref to NODE>
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
521 ; If FILE is specified, (FILE)NODE is used for xrefs.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
522 ; If fifth argument DOCUMENT is specified, produces
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
523 ; See section <xref to NODE> [NAME, else NODE], page <xref to NODE>
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
524 ; of DOCUMENT
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
525
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
526 ; @ref a reference that does not put `See' or `see' in
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
527 ; the hardcopy and is the same as @xref in Info
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
528 (put 'ref 'texinfo-format 'texinfo-format-xref)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
529
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
530 (put 'xref 'texinfo-format 'texinfo-format-xref)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
531 (defun texinfo-format-xref ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
532 (let ((args (texinfo-format-parse-args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
533 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
534 (insert "*Note ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
535 (let ((fname (or (nth 1 args) (nth 2 args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
536 (if (null (or fname (nth 3 args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
537 (insert (car args) "::")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
538 (insert (or fname (car args)) ": ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
539 (if (nth 3 args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
540 (insert "(" (nth 3 args) ")"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
541 (insert (car args))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
542
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
543 (put 'pxref 'texinfo-format 'texinfo-format-pxref)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
544 (defun texinfo-format-pxref ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
545 (texinfo-format-xref)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
546 (or (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
547 (forward-char -2)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
548 (looking-at "::"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
549 (insert ".")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
550
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
551 ;@inforef{NODE, FNAME, FILE}
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
552 ;Like @xref{NODE, FNAME,,FILE} in texinfo.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
553 ;In Tex, generates "See Info file FILE, node NODE"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
554 (put 'inforef 'texinfo-format 'texinfo-format-inforef)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
555 (defun texinfo-format-inforef ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
556 (let ((args (texinfo-format-parse-args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
557 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
558 (if (nth 1 args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
559 (insert "*Note " (nth 1 args) ": (" (nth 2 args) ")" (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
560 (insert "*Note " "(" (nth 2 args) ")" (car args) "::"))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
561
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
562 (put 'chapheading 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
563 (put 'ichapter 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
564 (put 'chapter 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
565 (put 'iappendix 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
566 (put 'appendix 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
567 (put 'iunnumbered 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
568 (put 'unnumbered 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
569 (defun texinfo-format-chapter ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
570 (texinfo-format-chapter-1 ?*))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
571
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
572 (put 'heading 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
573 (put 'isection 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
574 (put 'section 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
575 (put 'iappendixsection 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
576 (put 'appendixsection 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
577 (put 'iappendixsec 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
578 (put 'appendixsec 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
579 (put 'iunnumberedsec 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
580 (put 'unnumberedsec 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
581 (defun texinfo-format-section ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
582 (texinfo-format-chapter-1 ?=))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
583
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
584 (put 'subheading 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
585 (put 'isubsection 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
586 (put 'subsection 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
587 (put 'iappendixsubsec 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
588 (put 'appendixsubsec 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
589 (put 'iunnumberedsubsec 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
590 (put 'unnumberedsubsec 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
591 (defun texinfo-format-subsection ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
592 (texinfo-format-chapter-1 ?-))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
593
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
594 (put 'subsubheading 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
595 (put 'isubsubsection 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
596 (put 'subsubsection 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
597 (put 'iappendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
598 (put 'appendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
599 (put 'iunnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
600 (put 'unnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
601 (defun texinfo-format-subsubsection ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
602 (texinfo-format-chapter-1 ?.))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
603
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
604 (defun texinfo-format-chapter-1 (belowchar)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
605 (let ((arg (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
606 (message "Formatting: %s ... " arg) ; So we can see where we are.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
607 (insert ?\n arg ?\n "@SectionPAD " belowchar ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
608 (forward-line -2)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
609
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
610 (put 'SectionPAD 'texinfo-format 'texinfo-format-sectionpad)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
611 (defun texinfo-format-sectionpad ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
612 (let ((str (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
613 (forward-char -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
614 (let ((column (current-column)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
615 (forward-char 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
616 (while (> column 0)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
617 (insert str)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
618 (setq column (1- column))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
619 (insert ?\n)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
620
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
621 (put '\. 'texinfo-format 'texinfo-format-\.)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
622 (defun texinfo-format-\. ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
623 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
624 (insert "."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
625
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
626 (put '\: 'texinfo-format 'texinfo-format-\:)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
627 (defun texinfo-format-\: ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
628 (texinfo-discard-command))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
629
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
630 (put 'center 'texinfo-format 'texinfo-format-center)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
631 (defun texinfo-format-center ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
632 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
633 (let ((indent-tabs-mode nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
634 (center-line)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
635
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
636 (put 'sp 'texinfo-format 'texinfo-format-sp)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
637 (defun texinfo-format-sp ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
638 (let* ((arg (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
639 (num (read arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
640 (insert-char ?\n num)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
641
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
642 (put 'br 'texinfo-format 'texinfo-format-paragraph-break)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
643 (defun texinfo-format-paragraph-break ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
644 "Force a paragraph break.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
645 If used within a line, follow `@br' with braces."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
646 (texinfo-optional-braces-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
647 ;; insert one return if at end of line;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
648 ;; else insert two returns, to generate a blank line.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
649 (if (= (following-char) ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
650 (insert ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
651 (insert-char ?\n 2)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
652
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
653
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
654 ;;; @footnote
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
655
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
656 ; In Texinfo, footnotes are created with the `@footnote' command.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
657 ; This command is followed immediately by a left brace, then by the text of
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
658 ; the footnote, and then by a terminating right brace. The
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
659 ; template for a footnote is:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
660 ;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
661 ; @footnote{TEXT}
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
662 ;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
663 ; Info has two footnote styles:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
664 ;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
665 ; `End Node'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
666 ; In the "End Node" style, all the footnotes for a single node
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
667 ; are placed at the end of that node. The footnotes are
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
668 ; separated from the rest of the node by a line of dashes with
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
669 ; the word `Footnotes' within it.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
670 ;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
671 ; `Make Node'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
672 ; In the "Make Node" style, all the footnotes for a single node are
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
673 ; placed in an automatically constructed node of their own.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
674
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
675 (put 'footnote 'texinfo-format 'texinfo-format-footnote)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
676
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
677 (defvar texinfo-footnote-style 'MN "\
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
678 *Footnote style, either EN for end node or MN for make node.")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
679
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
680 (defvar texinfo-footnote-number)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
681
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
682 (defun texinfo-format-footnote ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
683 "Format a footnote in either `end node' or `make node' style.
1576
ddfd236e2c0c Dox fix.
Christopher Zaborsky <rogue@erratum.com>
parents: 841
diff changeset
684 The `texinfo-footnote-style' variable controls which style is used."
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
685 (setq texinfo-footnote-number (1+ texinfo-footnote-number))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
686 (cond ((eq texinfo-footnote-style 'EN) (texinfo-format-end-node))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
687 ((eq texinfo-footnote-style 'MN) (texinfo-format-make-node))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
688
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
689 (defun texinfo-format-make-node ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
690 "Format footnote in `MN', Make Node, style with notes in own node.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
691 The node is constructed automatically."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
692 (let* (start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
693 (arg (texinfo-parse-expanded-arg))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
694 (node-name-beginning
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
695 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
696 (re-search-backward
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
697 "^File: \\w+\\(\\w\\|\\s_\\|\\.\\)*[ \t]+Node:")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
698 (match-end 0)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
699 (node-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
700 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
701 (buffer-substring
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
702 (progn (goto-char node-name-beginning) ; skip over node command
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
703 (skip-chars-forward " \t") ; and over spaces
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
704 (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
705 (if (search-forward
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
706 ","
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
707 (save-excursion (end-of-line) (point)) t) ; bound search
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
708 (1- (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
709 (end-of-line) (point))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
710 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
711 (insert (format "(%d) (*note %s-Footnotes::)"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
712 texinfo-footnote-number node-name))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
713 (fill-paragraph nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
714 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
715 (if (re-search-forward "^@node" nil 'move)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
716 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
717
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
718 ;; two cases: for the first footnote, we must insert a node header;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
719 ;; for the second and subsequent footnotes, we need only insert
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
720 ;; the text of the footnote.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
721
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
722 (if (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
723 (re-search-backward
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
724 (concat node-name "-Footnotes, Up: ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
725 node-name-beginning
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
726 t))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
727 (progn ; already at least one footnote
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
728 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
729 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
730 (fill-region start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
731 ;; else not yet a footnote
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
732 (insert "\n\^_\nFile: " texinfo-format-filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
733 " Node: " node-name "-Footnotes, Up: " node-name "\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
734 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
735 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
736 (fill-region start (point))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
737
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
738 (defun texinfo-format-end-node ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
739 "Format footnote in `EN', End Node, style with notes at end of node."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
740 (let (start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
741 (arg (texinfo-parse-expanded-arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
742 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
743 (insert (format "(%d) " texinfo-footnote-number))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
744 (fill-paragraph nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
745 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
746 (if (search-forward "\n--------- Footnotes ---------\n" nil t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
747 (progn ; already have footnote, put new one before end of node
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
748 (if (re-search-forward "^@node" nil 'move)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
749 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
750 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
751 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
752 (fill-region start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
753 ;; else no prior footnote
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
754 (if (re-search-forward "^@node" nil 'move)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
755 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
756 (insert "\n--------- Footnotes ---------\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
757 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
758 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
759 (fill-region start (point))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
760
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
761
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
762 ;; @itemize pushes (itemize "COMMANDS" STARTPOS) on texinfo-stack.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
763 ;; @enumerate pushes (enumerate 0 STARTPOS).
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
764 ;; @item dispatches to the texinfo-item prop of the first elt of the list.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
765 ;; For itemize, this puts in and rescans the COMMANDS.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
766 ;; For enumerate, this increments the number and puts it in.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
767 ;; In either case, it puts a Backspace at the front of the line
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
768 ;; which marks it not to be indented later.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
769 ;; All other lines get indented by 5 when the @end is reached.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
770
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
771 (defun texinfo-push-stack (check arg)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
772 (setq texinfo-stack
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
773 (cons (list check arg texinfo-command-start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
774 texinfo-stack)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
775
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
776 (defun texinfo-pop-stack (check)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
777 (if (null texinfo-stack)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
778 (error "Unmatched @end %s" check))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
779 (if (not (eq (car (car texinfo-stack)) check))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
780 (error "@end %s matches @%s"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
781 check (car (car texinfo-stack))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
782 (prog1 (cdr (car texinfo-stack))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
783 (setq texinfo-stack (cdr texinfo-stack))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
784
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
785 (put 'itemize 'texinfo-format 'texinfo-itemize)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
786 (defun texinfo-itemize ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
787 (texinfo-push-stack 'itemize (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
788 (setq fill-column (- fill-column 5)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
789
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
790 (put 'itemize 'texinfo-end 'texinfo-end-itemize)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
791 (defun texinfo-end-itemize ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
792 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
793 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
794 (let ((stacktop
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
795 (texinfo-pop-stack 'itemize)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
796 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
797
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
798 (put 'enumerate 'texinfo-format 'texinfo-enumerate)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
799 (defun texinfo-enumerate ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
800 (texinfo-push-stack 'enumerate 0)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
801 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
802 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
803
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
804 (put 'enumerate 'texinfo-end 'texinfo-end-enumerate)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
805 (defun texinfo-end-enumerate ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
806 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
807 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
808 (let ((stacktop
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
809 (texinfo-pop-stack 'enumerate)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
810 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
811
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
812 (put 'table 'texinfo-format 'texinfo-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
813 (defun texinfo-table ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
814 (texinfo-push-stack 'table (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
815 (setq fill-column (- fill-column 5)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
816
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
817 (put 'ftable 'texinfo-format 'texinfo-ftable)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
818 (defun texinfo-ftable ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
819 (texinfo-push-stack 'table "@code")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
820 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
821 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
822
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
823 (put 'description 'texinfo-format 'texinfo-description)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
824 (defun texinfo-description ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
825 (texinfo-push-stack 'table "@asis")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
826 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
827 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
828
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
829 (put 'table 'texinfo-end 'texinfo-end-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
830 (put 'ftable 'texinfo-end 'texinfo-end-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
831 (put 'description 'texinfo-end 'texinfo-end-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
832 (defun texinfo-end-table ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
833 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
834 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
835 (let ((stacktop
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
836 (texinfo-pop-stack 'table)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
837 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
838
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
839 ;; At the @end, indent all the lines within the construct
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
840 ;; except those marked with backspace. FROM says where
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
841 ;; construct started.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
842 (defun texinfo-do-itemize (from)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
843 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
844 (while (progn (forward-line -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
845 (>= (point) from))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
846 (if (= (following-char) ?\b)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
847 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
848 (delete-char 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
849 (end-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
850 (delete-char 6))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
851 (if (not (looking-at "[ \t]*$"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
852 (save-excursion (insert " ")))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
853
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
854 (put 'item 'texinfo-format 'texinfo-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
855 (put 'itemx 'texinfo-format 'texinfo-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
856 (defun texinfo-item ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
857 (funcall (get (car (car texinfo-stack)) 'texinfo-item)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
858
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
859 (put 'itemize 'texinfo-item 'texinfo-itemize-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
860 (defun texinfo-itemize-item ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
861 (texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
862 (insert "\b " (nth 1 (car texinfo-stack)) " \n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
863 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
864
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
865 (put 'enumerate 'texinfo-item 'texinfo-enumerate-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
866 (defun texinfo-enumerate-item ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
867 (texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
868 (let ((next (1+ (car (cdr (car texinfo-stack))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
869 (setcar (cdr (car texinfo-stack)) next)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
870 (insert ?\b (format "%3d. " next) ?\n))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
871 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
872
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
873 (put 'table 'texinfo-item 'texinfo-table-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
874 (defun texinfo-table-item ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
875 (let ((arg (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
876 (itemfont (car (cdr (car texinfo-stack)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
877 (insert ?\b itemfont ?\{ arg "}\n \n"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
878 (forward-line -2))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
879
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
880
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
881 ; @ftable
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
882
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
883 ; The `@ftable' command is like the `@table' command but it also
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
884 ; inserts each item in the first column into the function index.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
885
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
886 (put 'ftable 'texinfo-format 'texinfo-ftable)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
887
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
888 ; The following function presumes that the first column of the table
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
889 ; should be in `@code' font; but the texinfo.tex source does not
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
890 ; presume this.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
891 ; (defun texinfo-ftable ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
892 ; (texinfo-push-stack 'ftable "@code")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
893 ; (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
894 ; (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
895
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
896 (defun texinfo-ftable ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
897 (texinfo-push-stack 'ftable (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
898 (setq fill-column (- fill-column 5)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
899
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
900 (put 'ftable 'texinfo-item 'texinfo-ftable-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
901 (defun texinfo-ftable-item ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
902 (let ((item (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
903 (itemfont (car (cdr (car texinfo-stack))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
904 (indexvar 'texinfo-findex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
905 (insert ?\b itemfont ?\{ item "}\n \n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
906 (set indexvar
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
907 (cons
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
908 (list item texinfo-last-node)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
909 (symbol-value indexvar)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
910 (forward-line -2)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
911
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
912 (put 'ftable 'texinfo-end 'texinfo-end-ftable)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
913 (defun texinfo-end-ftable ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
914 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
915 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
916 (let ((stacktop
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
917 (texinfo-pop-stack 'ftable)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
918 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
919
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
920
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
921 (put 'ifinfo 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
922 (put 'ifinfo 'texinfo-end 'texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
923
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
924 (put 'iftex 'texinfo-format 'texinfo-format-iftex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
925 (defun texinfo-format-iftex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
926 (delete-region texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
927 (progn (re-search-forward "@end iftex\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
928 (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
929
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
930 (put 'tex 'texinfo-format 'texinfo-format-tex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
931 (defun texinfo-format-tex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
932 (delete-region texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
933 (progn (re-search-forward "@end tex\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
934 (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
935
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
936 (put 'titlepage 'texinfo-format 'texinfo-format-titlepage)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
937 (defun texinfo-format-titlepage ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
938 (delete-region texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
939 (progn (search-forward "@end titlepage\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
940 (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
941
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
942 (put 'endtitlepage 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
943
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
944 ; @titlespec an alternative titling command; ignored by Info
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
945
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
946 (put 'titlespec 'texinfo-format 'texinfo-format-titlespec)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
947 (defun texinfo-format-titlespec ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
948 (delete-region texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
949 (progn (search-forward "@end titlespec\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
950 (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
951
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
952 (put 'endtitlespec 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
953
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
954 ; @today{}
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
955
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
956 (put 'today 'texinfo-format 'texinfo-format-today)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
957
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
958 ; Produces Day Month Year style of output. eg `1 Jan 1900'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
959 ; The `@today{}' command requires a pair of braces, like `@dots{}'.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
960 (defun texinfo-format-today ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
961 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
962 (insert (format "%s %s %s"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
963 (substring (current-time-string) 8 10)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
964 (substring (current-time-string) 4 7)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
965 (substring (current-time-string) -4))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
966
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
967
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
968 (put 'ignore 'texinfo-format 'texinfo-format-ignore)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
969 (defun texinfo-format-ignore ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
970 (delete-region texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
971 (progn (search-forward "@end ignore\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
972 (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
973
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
974 (put 'endignore 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
975
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
976 (put 'var 'texinfo-format 'texinfo-format-var)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
977 ; @sc a small caps font for TeX; formatted as `var' in Info
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
978 (put 'sc 'texinfo-format 'texinfo-format-var)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
979 (defun texinfo-format-var ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
980 (insert (upcase (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
981 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
982
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
983 ; various noops
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
984
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
985 (put 'asis 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
986 (put 'b 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
987 (put 't 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
988 (put 'i 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
989 (put 'r 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
990 (put 'titlefont 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
991 (put 'key 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
992 (put 'w 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
993 (defun texinfo-format-noop ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
994 (insert (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
995 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
996
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
997 (put 'code 'texinfo-format 'texinfo-format-code)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
998 (put 'samp 'texinfo-format 'texinfo-format-code)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
999 (put 'file 'texinfo-format 'texinfo-format-code)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1000 (put 'kbd 'texinfo-format 'texinfo-format-code)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1001 (put 'cite 'texinfo-format 'texinfo-format-code)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1002 (defun texinfo-format-code ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1003 (insert "`" (texinfo-parse-arg-discard) "'")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1004 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1005
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1006 (put 'emph 'texinfo-format 'texinfo-format-emph)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1007 (put 'strong 'texinfo-format 'texinfo-format-emph)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1008 (defun texinfo-format-emph ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1009 (insert "*" (texinfo-parse-arg-discard) "*")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1010 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1011
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1012 (put 'defn 'texinfo-format 'texinfo-format-defn)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1013 (put 'dfn 'texinfo-format 'texinfo-format-defn)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1014 (defun texinfo-format-defn ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1015 (insert "\"" (texinfo-parse-arg-discard) "\"")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1016 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1017
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1018 (put 'bullet 'texinfo-format 'texinfo-format-bullet)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1019 (defun texinfo-format-bullet ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1020 "Insert an asterisk.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1021 If used within a line, follow `@bullet' with braces."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1022 (texinfo-optional-braces-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1023 (insert "*"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1024
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1025 (put 'smallexample 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1026 (put 'smalllisp 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1027 (put 'example 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1028 (put 'quotation 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1029 (put 'lisp 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1030 (put 'display 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1031 (put 'format 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1032 (put 'flushleft 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1033 (defun texinfo-format-example ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1034 (texinfo-push-stack 'example nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1035 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1036 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1037
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1038 (put 'smallexample 'texinfo-end 'texinfo-end-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1039 (put 'example 'texinfo-end 'texinfo-end-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1040 (put 'quotation 'texinfo-end 'texinfo-end-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1041 (put 'lisp 'texinfo-end 'texinfo-end-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1042 (put 'display 'texinfo-end 'texinfo-end-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1043 (put 'format 'texinfo-end 'texinfo-end-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1044 (put 'flushleft 'texinfo-end 'texinfo-end-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1045 (defun texinfo-end-example ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1046 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1047 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1048 (let ((stacktop
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1049 (texinfo-pop-stack 'example)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1050 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1051
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1052 (put 'exdent 'texinfo-format 'texinfo-format-exdent)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1053 (defun texinfo-format-exdent ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1054 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1055 (delete-region (point)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1056 (progn
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1057 (skip-chars-forward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1058 (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1059 (insert ?\b)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1060 ;; Cancel out the deletion that texinfo-do-itemize
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1061 ;; is going to do at the end of this line.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1062 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1063 (end-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1064 (insert "\n ")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1065
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1066
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1067 ;; @flushright ... @end flushright
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1068
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1069 ; The @flushright command right justifies every line but leaves the
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1070 ; left end ragged.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1071
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1072 (put 'flushright 'texinfo-format 'texinfo-format-flushright)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1073 (defun texinfo-format-flushright ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1074 (texinfo-push-stack 'flushright nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1075 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1076
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1077 (put 'flushright 'texinfo-end 'texinfo-end-flushright)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1078 (defun texinfo-end-flushright ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1079 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1080
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1081 (let ((stacktop
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1082 (texinfo-pop-stack 'flushright)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1083
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1084 (texinfo-do-flushright (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1085
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1086 (defun texinfo-do-flushright (from)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1087 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1088 (while (progn (forward-line -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1089 (>= (point) from))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1090
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1091 (beginning-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1092 (insert
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1093 (make-string
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1094 (- fill-column
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1095 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1096 (end-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1097 (current-column)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1098 ? )))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1099
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1100
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1101 (put 'ctrl 'texinfo-format 'texinfo-format-ctrl)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1102 (defun texinfo-format-ctrl ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1103 (let ((str (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1104 (insert (logand 31 (aref str 0)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1105
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1106 (put 'TeX 'texinfo-format 'texinfo-format-TeX)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1107 (defun texinfo-format-TeX ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1108 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1109 (insert "TeX"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1110
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1111 (put 'copyright 'texinfo-format 'texinfo-format-copyright)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1112 (defun texinfo-format-copyright ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1113 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1114 (insert "(C)"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1115
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1116 (put 'minus 'texinfo-format 'texinfo-format-minus)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1117 (defun texinfo-format-minus ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1118 "Insert a minus sign.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1119 If used within a line, follow `@minus' with braces."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1120 (texinfo-optional-braces-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1121 (insert "-"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1122
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1123 (put 'dots 'texinfo-format 'texinfo-format-dots)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1124 (defun texinfo-format-dots ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1125 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1126 (insert "..."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1127
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1128 (put 'refill 'texinfo-format 'texinfo-format-refill)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1129 (defun texinfo-format-refill ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1130 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1131 (fill-paragraph nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1132
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1133
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1134 ;;; Index generation
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1135
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1136 (put 'vindex 'texinfo-format 'texinfo-format-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1137 (defun texinfo-format-vindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1138 (texinfo-index 'texinfo-vindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1139
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1140 (put 'cindex 'texinfo-format 'texinfo-format-cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1141 (defun texinfo-format-cindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1142 (texinfo-index 'texinfo-cindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1143
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1144 (put 'findex 'texinfo-format 'texinfo-format-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1145 (defun texinfo-format-findex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1146 (texinfo-index 'texinfo-findex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1147
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1148 (put 'pindex 'texinfo-format 'texinfo-format-pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1149 (defun texinfo-format-pindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1150 (texinfo-index 'texinfo-pindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1151
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1152 (put 'tindex 'texinfo-format 'texinfo-format-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1153 (defun texinfo-format-tindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1154 (texinfo-index 'texinfo-tindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1155
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1156 (put 'kindex 'texinfo-format 'texinfo-format-kindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1157 (defun texinfo-format-kindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1158 (texinfo-index 'texinfo-kindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1159
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1160 (defun texinfo-index (indexvar)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1161 (let ((arg (texinfo-parse-expanded-arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1162 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1163 (set indexvar
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1164 (cons (list arg texinfo-last-node)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1165 (symbol-value indexvar)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1166
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1167 (defconst texinfo-indexvar-alist
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1168 '(("cp" . texinfo-cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1169 ("fn" . texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1170 ("vr" . texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1171 ("tp" . texinfo-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1172 ("pg" . texinfo-pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1173 ("ky" . texinfo-kindex)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1174
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1175
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1176 ;;; @defindex @defcodeindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1177 (put 'defindex 'texinfo-format 'texinfo-format-defindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1178 (put 'defcodeindex 'texinfo-format 'texinfo-format-defindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1179
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1180 (defun texinfo-format-defindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1181 (let* ((index-name (texinfo-parse-arg-discard)) ; eg: `aa'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1182 (indexing-command (intern (concat index-name "index")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1183 (index-formatting-command ; eg: `texinfo-format-aaindex'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1184 (intern (concat "texinfo-format-" index-name "index")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1185 (index-alist-name ; eg: `texinfo-aaindex'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1186 (intern (concat "texinfo-" index-name "index"))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1187
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1188 (set index-alist-name nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1190 (put indexing-command ; eg, aaindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1191 'texinfo-format
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1192 index-formatting-command) ; eg, texinfo-format-aaindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1193
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1194 ;; eg: "aa" . texinfo-aaindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1195 (or (assoc index-name texinfo-indexvar-alist)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1196 (setq texinfo-indexvar-alist
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1197 (cons
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1198 (cons index-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1199 index-alist-name)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1200 texinfo-indexvar-alist)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1201
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1202 (fset index-formatting-command
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1203 (list 'lambda 'nil
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1204 (list 'texinfo-index
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1205 (list 'quote index-alist-name))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1206
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1207
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1208 ;;; @synindex @syncodeindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1209
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1210 (put 'synindex 'texinfo-format 'texinfo-format-synindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1211 (put 'syncodeindex 'texinfo-format 'texinfo-format-synindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1212
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1213 (defun texinfo-format-synindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1214 (let* ((args (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1215 (second (cdr (read-from-string args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1216 (joiner (symbol-name (car (read-from-string args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1217 (joined (symbol-name (car (read-from-string args second)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1218
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1219 (if (assoc joiner texinfo-short-index-cmds-alist)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1220 (put
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1221 (cdr (assoc joiner texinfo-short-index-cmds-alist))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1222 'texinfo-format
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1223 (or (cdr (assoc joined texinfo-short-index-format-cmds-alist))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1224 (intern (concat "texinfo-format-" joined "index"))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1225 (put
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1226 (intern (concat joiner "index"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1227 'texinfo-format
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1228 (or (cdr(assoc joined texinfo-short-index-format-cmds-alist))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1229 (intern (concat "texinfo-format-" joined "index")))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1230
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1231 (defconst texinfo-short-index-cmds-alist
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1232 '(("cp" . cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1233 ("fn" . findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1234 ("vr" . vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1235 ("tp" . tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1236 ("pg" . pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1237 ("ky" . kindex)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1238
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1239 (defconst texinfo-short-index-format-cmds-alist
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1240 '(("cp" . texinfo-format-cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1241 ("fn" . texinfo-format-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1242 ("vr" . texinfo-format-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1243 ("tp" . texinfo-format-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1244 ("pg" . texinfo-format-pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1245 ("ky" . texinfo-format-kindex)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1246
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1247
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1248 ;;; @printindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1249
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1250 (put 'printindex 'texinfo-format 'texinfo-format-printindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1251
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1252 (defun texinfo-format-printindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1253 (let ((indexelts (symbol-value
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1254 (cdr (assoc (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1255 texinfo-indexvar-alist))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1256 opoint)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1257 (insert "\n* Menu:\n\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1258 (setq opoint (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1259 (texinfo-print-index nil indexelts)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1260
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1261 (if (eq system-type 'vax-vms)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1262 (texinfo-sort-region opoint (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1263 (shell-command-on-region opoint (point) "sort -fd" 1))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1264
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1265 (defun texinfo-print-index (file indexelts)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1266 (while indexelts
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1267 (if (stringp (car (car indexelts)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1268 (insert "* " (car (car indexelts))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1269 ": " (if file (concat "(" file ")") "")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1270 (nth 1 (car indexelts)) ".\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1271 ;; index entries from @include'd file
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1272 (texinfo-print-index (nth 1 (car indexelts))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1273 (nth 2 (car indexelts))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1274 (setq indexelts (cdr indexelts))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1275
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1276
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1277 ;;; NOTATIONS: @equiv, @error, etc
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1278
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1279 ;; @equiv to show that two expressions are equivalent
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1280 ;; @error to show an error message
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1281 ;; @expansion to show what a macro expands to
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1282 ;; @point to show the location of point in an example
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1283 ;; @print to show what an evaluated expression prints
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1284 ;; @result to indicate the value returned by an expression
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1285
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1286 (put 'equiv 'texinfo-format 'texinfo-format-equiv)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1287 (defun texinfo-format-equiv ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1288 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1289 (insert "=="))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1290
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1291 (put 'error 'texinfo-format 'texinfo-format-error)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1292 (defun texinfo-format-error ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1293 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1294 (insert "error-->"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1295
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1296 (put 'expansion 'texinfo-format 'texinfo-format-expansion)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1297 (defun texinfo-format-expansion ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1298 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1299 (insert "==>"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1300
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1301 (put 'point 'texinfo-format 'texinfo-format-point)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1302 (defun texinfo-format-point ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1303 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1304 (insert "-!-"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1305
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1306 (put 'print 'texinfo-format 'texinfo-format-print)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1307 (defun texinfo-format-print ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1308 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1309 (insert "-|"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1310
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1311 (put 'result 'texinfo-format 'texinfo-format-result)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1312 (defun texinfo-format-result ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1313 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1314 (insert "=>"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1315
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1316
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1317 ;;;; Description formatting: @deffn, @defun, etc
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1318
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1319 (defun texinfo-format-defun ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1320 (texinfo-push-stack 'defun nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1321 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1322 (texinfo-format-defun-1 t))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1323
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1324 (defun texinfo-format-defunx ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1325 (texinfo-format-defun-1 nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1326
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1327 (defun texinfo-format-defun-1 (first-p)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1328 (let ((args (texinfo-format-parse-defun-args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1329 (command-type (get texinfo-command-name 'texinfo-defun-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1330 (class "")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1331 (name "")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1332 (classification "")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1333 (data-type ""))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1334 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1335
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1336 (cond
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1337 ;; Generalized object oriented entity: `category class name [args...]'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1338 ;; In Info, `Category on class: name ARG'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1339 ((eq (eval (car command-type)) 'defop-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1340 (setq category (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1341 (setq class (car (cdr args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1342 (setq name (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1343 (setq args (cdr (cdr args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1344
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1345 ;; Specialized object oriented entity: @defmethod, @defivar
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1346 ;; "Instance Variable" `class name [args...]'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1347 ;; In Info, `Instance variable of class: name'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1348 ((eq (eval (car command-type)) 'defmethod-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1349 (setq category (car (cdr command-type)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1350 (setq class (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1351 (setq name (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1352 (setq args (cdr args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1353
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1354 ;; Generalized function-like or variable-like entity:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1355 ;; `category name [args...]'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1356 ;; In Info, `Category: name ARGS'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1357 ((or (eq (eval (car command-type)) 'deffn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1358 (eq (eval (car command-type)) 'deftp-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1359 (setq category (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1360 (setq args (cdr args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1361 (setq name (car args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1362
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1363 ;; Specialized function-like or variable-like entity:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1364 ;; "Macro" `name [args...]'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1365 ;; In Info, `Macro: Name ARGS'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1366 ((eq (eval (car command-type)) 'defun-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1367 (setq category (car (cdr command-type)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1368 (setq name (car args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1369
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1370 ;; Generalized typed-function-like or typed-variable-like entity:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1371 ;; `Classification data-type name [args...]'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1372 ;; In Info, `Classification: data-type name ARGS'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1373 ((or (eq (eval (car command-type)) 'deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1374 (eq (eval (car command-type)) 'deftypevr-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1375 (setq classification (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1376 (setq data-type (car (cdr args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1377 (setq name (car (cdr (cdr args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1378 (setq args (cdr (cdr (cdr args)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1379
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1380 ;; Specialized typed-function-like or typed-variable-like entity:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1381 ;; `data-type name [args...]'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1382 ;; In Info, `Function: data-type name ARGS'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1383 ;; or, `Variable: data-type name'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1384 ((or (eq (eval (car command-type)) 'deftypefun-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1385 (eq (eval (car command-type)) 'deftypevar-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1386 (setq classification (car (cdr command-type)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1387 (setq data-type (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1388 (setq name (car (cdr args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1389 (setq args (cdr (cdr args)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1390
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1391 ;; Delete extra newline inserted after previous header line.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1392 (if (not first-p)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1393 (delete-char -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1394
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1395 (let ((formatter (get texinfo-command-name 'texinfo-defun-format-type)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1396 (cond
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1397 ;; if typed function or variable
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1398 ((eq formatter 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1399 (insert "* " classification ": " data-type " " name)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1400 (let ((args args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1401 (while args
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1402 (insert " " (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1403 (setq args (cdr args)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1404 (t
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1405 ;; and if object oriented, set category
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1406 (if (or (eq formatter 'texinfo-format-defop-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1407 (eq formatter 'texinfo-format-defcv-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1408 (setq category (funcall formatter category class)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1409 (insert "* " category ": " name)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1410 (let ((args (cdr args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1411 (while args
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1412 (insert " "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1413 (if (or (= ?& (aref (car args) 0))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1414 (eq (eval (car command-type)) 'deftp-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1415 (car args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1416 (upcase (car args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1417 (setq args (cdr args)))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1418
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1419 ;; Insert extra newline so that paragraph filling does not mess
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1420 ;; with header line.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1421 (insert "\n\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1422 (rplaca (cdr (cdr (car texinfo-stack))) (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1423
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1424 (let ((indexvar (get texinfo-command-name 'texinfo-defun-index))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1425 (index-formatter
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1426 (get texinfo-command-name 'texinfo-defun-format-index)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1427 (set indexvar
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1428 (cons (list
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1429 (cond
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1430 ;; if object oriented
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1431 ((or (eq index-formatter 'texinfo-format-defop-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1432 (eq index-formatter 'texinfo-format-defcv-index))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1433 (funcall index-formatter name class))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1434 ((eq index-formatter 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1435 (funcall index-formatter name data-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1436 (t (car args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1437 texinfo-last-node)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1438 (symbol-value indexvar))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1439
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1440 (defun texinfo-end-defun ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1441 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1442 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1443 (let ((start (nth 1 (texinfo-pop-stack 'defun))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1444 (texinfo-do-itemize start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1445 ;; Delete extra newline inserted after header.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1446 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1447 (goto-char start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1448 (delete-char -1))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1449
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1450 (defun texinfo-format-defop-type (category class)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1451 (format "%s on %s" category class))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1452
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1453 (defun texinfo-format-defop-index (name class)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1454 (format "%s on %s" name class))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1455
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1456 (defun texinfo-format-defcv-type (category class)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1457 (format "%s of %s" category class))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1458
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1459 (defun texinfo-format-defcv-index (name class)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1460 (format "%s of %s" name class))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1461
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1462 (put 'deffn 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1463 (put 'deffnx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1464 (put 'deffn 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1465 (put 'deffn 'texinfo-defun-type '('deffn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1466 (put 'deffnx 'texinfo-defun-type '('deffn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1467 (put 'deffn 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1468 (put 'deffnx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1469
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1470 (put 'defun 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1471 (put 'defunx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1472 (put 'defun 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1473 (put 'defun 'texinfo-defun-type '('defun-type "Function"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1474 (put 'defunx 'texinfo-defun-type '('defun-type "Function"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1475 (put 'defun 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1476 (put 'defunx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1477
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1478 (put 'defmac 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1479 (put 'defmacx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1480 (put 'defmac 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1481 (put 'defmac 'texinfo-defun-type '('defun-type "Macro"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1482 (put 'defmacx 'texinfo-defun-type '('defun-type "Macro"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1483 (put 'defmac 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1484 (put 'defmacx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1485
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1486 (put 'defspec 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1487 (put 'defspecx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1488 (put 'defspec 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1489 (put 'defspec 'texinfo-defun-type '('defun-type "Special form"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1490 (put 'defspecx 'texinfo-defun-type '('defun-type "Special form"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1491 (put 'defspec 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1492 (put 'defspecx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1493
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1494 (put 'defvr 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1495 (put 'defvrx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1496 (put 'defvr 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1497 (put 'defvr 'texinfo-defun-type '('deffn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1498 (put 'defvrx 'texinfo-defun-type '('deffn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1499 (put 'defvr 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1500 (put 'defvrx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1501
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1502 (put 'defvar 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1503 (put 'defvarx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1504 (put 'defvar 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1505 (put 'defvar 'texinfo-defun-type '('defun-type "Variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1506 (put 'defvarx 'texinfo-defun-type '('defun-type "Variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1507 (put 'defvar 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1508 (put 'defvarx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1509
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1510 (put 'defconst 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1511 (put 'defconstx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1512 (put 'defconst 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1513 (put 'defconst 'texinfo-defun-type '('defun-type "Constant"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1514 (put 'defconstx 'texinfo-defun-type '('defun-type "Constant"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1515 (put 'defconst 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1516 (put 'defconstx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1517
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1518 (put 'defcmd 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1519 (put 'defcmdx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1520 (put 'defcmd 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1521 (put 'defcmd 'texinfo-defun-type '('defun-type "Command"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1522 (put 'defcmdx 'texinfo-defun-type '('defun-type "Command"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1523 (put 'defcmd 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1524 (put 'defcmdx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1525
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1526 (put 'defopt 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1527 (put 'defoptx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1528 (put 'defopt 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1529 (put 'defopt 'texinfo-defun-type '('defun-type "User Option"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1530 (put 'defoptx 'texinfo-defun-type '('defun-type "User Option"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1531 (put 'defopt 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1532 (put 'defoptx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1533
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1534 (put 'deftp 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1535 (put 'deftpx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1536 (put 'deftp 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1537 (put 'deftp 'texinfo-defun-type '('deftp-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1538 (put 'deftpx 'texinfo-defun-type '('deftp-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1539 (put 'deftp 'texinfo-defun-index 'texinfo-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1540 (put 'deftpx 'texinfo-defun-index 'texinfo-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1541
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1542 ;;; Object-oriented stuff is a little hairier.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1543
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1544 (put 'defop 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1545 (put 'defopx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1546 (put 'defop 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1547 (put 'defop 'texinfo-defun-type '('defop-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1548 (put 'defopx 'texinfo-defun-type '('defop-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1549 (put 'defop 'texinfo-defun-format-type 'texinfo-format-defop-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1550 (put 'defopx 'texinfo-defun-format-type 'texinfo-format-defop-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1551 (put 'defop 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1552 (put 'defopx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1553 (put 'defop 'texinfo-defun-format-index 'texinfo-format-defop-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1554 (put 'defopx 'texinfo-defun-format-index 'texinfo-format-defop-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1555
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1556 (put 'defmethod 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1557 (put 'defmethodx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1558 (put 'defmethod 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1559 (put 'defmethod 'texinfo-defun-type '('defmethod-type "Operation"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1560 (put 'defmethodx 'texinfo-defun-type '('defmethod-type "Operation"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1561 (put 'defmethod 'texinfo-defun-format-type 'texinfo-format-defop-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1562 (put 'defmethodx 'texinfo-defun-format-type 'texinfo-format-defop-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1563 (put 'defmethod 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1564 (put 'defmethodx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1565 (put 'defmethod 'texinfo-defun-format-index 'texinfo-format-defop-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1566 (put 'defmethodx 'texinfo-defun-format-index 'texinfo-format-defop-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1567
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1568 (put 'defcv 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1569 (put 'defcvx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1570 (put 'defcv 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1571 (put 'defcv 'texinfo-defun-type '('defop-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1572 (put 'defcvx 'texinfo-defun-type '('defop-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1573 (put 'defcv 'texinfo-defun-format-type 'texinfo-format-defcv-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1574 (put 'defcvx 'texinfo-defun-format-type 'texinfo-format-defcv-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1575 (put 'defcv 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1576 (put 'defcvx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1577 (put 'defcv 'texinfo-defun-format-index 'texinfo-format-defcv-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1578 (put 'defcvx 'texinfo-defun-format-index 'texinfo-format-defcv-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1579
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1580 (put 'defivar 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1581 (put 'defivarx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1582 (put 'defivar 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1583 (put 'defivar 'texinfo-defun-type '('defmethod-type "Instance variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1584 (put 'defivarx 'texinfo-defun-type '('defmethod-type "Instance variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1585 (put 'defivar 'texinfo-defun-format-type 'texinfo-format-defcv-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1586 (put 'defivarx 'texinfo-defun-format-type 'texinfo-format-defcv-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1587 (put 'defivar 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1588 (put 'defivarx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1589 (put 'defivar 'texinfo-defun-format-index 'texinfo-format-defcv-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1590 (put 'defivarx 'texinfo-defun-format-index 'texinfo-format-defcv-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1591
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1592 ;;; Typed functions and variables
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1593
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1594 (defun texinfo-format-deftypefn-type (classification data-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1595 (format "%s" classification data-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1596
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1597 (defun texinfo-format-deftypefn-index (name data-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1598 (format "%s of type %s" name data-type))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1599
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1600
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1601 (put 'deftypefn 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1602 (put 'deftypefnx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1603 (put 'deftypefn 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1604 (put 'deftypefn 'texinfo-defun-type '('deftypefn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1605 (put 'deftypefnx 'texinfo-defun-type '('deftypefn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1606 (put 'deftypefn 'texinfo-defun-format-type 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1607 (put 'deftypefnx 'texinfo-defun-format-type 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1608 (put 'deftypefn 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1609 (put 'deftypefnx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1610 (put 'deftypefn 'texinfo-defun-format-index 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1611 (put 'deftypefnx 'texinfo-defun-format-index 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1612
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1613 (put 'deftypefun 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1614 (put 'deftypefunx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1615 (put 'deftypefun 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1616 (put 'deftypefun 'texinfo-defun-type '('deftypefun-type "Function"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1617 (put 'deftypefunx 'texinfo-defun-type '('deftypefun-type "Function"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1618 (put 'deftypefun 'texinfo-defun-format-type 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1619 (put 'deftypefunx 'texinfo-defun-format-type 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1620 (put 'deftypefun 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1621 (put 'deftypefunx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1622 (put 'deftypefun 'texinfo-defun-format-index 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1623 (put 'deftypefunx 'texinfo-defun-format-index 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1624
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1625 (put 'deftypevr 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1626 (put 'deftypevrx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1627 (put 'deftypevr 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1628 (put 'deftypevr 'texinfo-defun-type '('deftypefn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1629 (put 'deftypevrx 'texinfo-defun-type '('deftypefn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1630 (put 'deftypevr 'texinfo-defun-format-type 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1631 (put 'deftypevrx 'texinfo-defun-format-type 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1632 (put 'deftypevr 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1633 (put 'deftypevrx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1634 (put 'deftypevr 'texinfo-defun-format-index 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1635 (put 'deftypevrx 'texinfo-defun-format-index 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1636
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1637 (put 'deftypevar 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1638 (put 'deftypevarx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1639 (put 'deftypevar 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1640 (put 'deftypevar 'texinfo-defun-type '('deftypevar-type "Variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1641 (put 'deftypevarx 'texinfo-defun-type '('deftypevar-type "Variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1642 (put 'deftypevar 'texinfo-defun-format-type 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1643 (put 'deftypevarx 'texinfo-defun-format-type 'texinfo-format-deftypefn-type)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1644 (put 'deftypevar 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1645 (put 'deftypevarx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1646 (put 'deftypevar 'texinfo-defun-format-index 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1647 (put 'deftypevarx 'texinfo-defun-format-index 'texinfo-format-deftypefn-index)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1648
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1649
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1650 ;; process included files: `@include' command
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1651
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1652 ;; Updated 19 October 1990
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1653 ;; In the original version, include files were ignored by Info but
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1654 ;; incorporated in to the printed manual. To make references to the
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1655 ;; included file, the Texinfo source file has to refer to the included
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3456
diff changeset
1656 ;; files using the `(filename)nodename' format for referring to other
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1657 ;; Info files. Also, the included files had to be formatted on their
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1658 ;; own. It was just like they were another file.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1659
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1660 ;; Currently, include files are inserted into the buffer that is
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1661 ;; formatted for Info. If large, the resulting info file is split and
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1662 ;; tagified. For current include files to work, the master menu must
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1663 ;; refer to all the nodes, and the highest level nodes in the include
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1664 ;; files must have the correct next, prev, and up pointers.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1665
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1666 ;; The included file may have an @setfilename and even an @settitle,
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1667 ;; but not an /input texinfo
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1668
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1669 ; Original definition:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1670 ; (defun texinfo-format-include ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1671 ; (let ((filename (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1672 ; (default-directory input-directory)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1673 ; subindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1674 ; (setq subindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1675 ; (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1676 ; (progn (find-file
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1677 ; (cond ((file-readable-p (concat filename ".texinfo"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1678 ; (concat filename ".texinfo"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1679 ; ((file-readable-p (concat filename ".texi"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1680 ; (concat filename ".texi"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1681 ; ((file-readable-p (concat filename ".tex"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1682 ; (concat filename ".tex"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1683 ; ((file-readable-p filename)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1684 ; filename)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1685 ; (t (error "@include'd file %s not found"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1686 ; filename))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1687 ; (texinfo-format-buffer-1))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1688 ; (texinfo-subindex 'texinfo-vindex (car subindex) (nth 1 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1689 ; (texinfo-subindex 'texinfo-findex (car subindex) (nth 2 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1690 ; (texinfo-subindex 'texinfo-cindex (car subindex) (nth 3 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1691 ; (texinfo-subindex 'texinfo-pindex (car subindex) (nth 4 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1692 ; (texinfo-subindex 'texinfo-tindex (car subindex) (nth 5 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1693 ; (texinfo-subindex 'texinfo-kindex (car subindex) (nth 6 subindex))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1694
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1695 (defun texinfo-subindex (indexvar file content)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1696 (set indexvar (cons (list 'recurse file content)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1697 (symbol-value indexvar))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1698
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1699 (put 'include 'texinfo-format 'texinfo-format-include)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1700 (defun texinfo-format-include ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1701 (let ((filename (concat input-directory
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1702 (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1703 (default-directory input-directory))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1704 (message "Reading: %s" filename)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1705 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1706 (insert-file-contents filename)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1707 (setq last-input-buffer input-buffer) ; to bypass setfilename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1708 )
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1709
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1710
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1711
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1712 ;; Lots of bolio constructs do nothing in texinfo.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1713
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1714 (put 'page 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1715 (put 'c 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1716 (put 'comment 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1717 (put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1718 (put 'contents 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1719 (put 'summarycontents 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1720 (put 'shortcontents 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1721 (put 'nopara 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1722 (put 'noindent 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1723 (put 'setx 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1724 (put 'setq 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1725 (put 'settitle 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1726 (put 'hsize 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1727 (put 'parindent 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1728 (put 'lispnarrowing 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1729 (put 'itemindent 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1730 (put 'headings 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1731 (put 'group 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1732 (put 'group 'texinfo-end 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1733 (put 'need 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1734 (put 'bye 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1735 (put 'smallbook 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1736
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1737 (defun texinfo-discard-line-with-args ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1738 (goto-char texinfo-command-start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1739 (delete-region (point) (progn (forward-line 1) (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1740
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1741 ;; Sort an index which is in the current buffer between START and END.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1742 ;; Used on VMS, where the `sort' utility is not available.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1743 (defun texinfo-sort-region (start end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1744 (require 'sort)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1745 (save-restriction
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1746 (narrow-to-region start end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1747 (sort-subr nil 'forward-line 'end-of-line 'texinfo-sort-startkeyfun)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1748
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1749 ;; Subroutine for sorting an index.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1750 ;; At start of a line, return a string to sort the line under.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1751 (defun texinfo-sort-startkeyfun ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1752 (let ((line
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1753 (buffer-substring (point) (save-excursion (end-of-line) (point)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1754 ;; Canonicalize whitespace and eliminate funny chars.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1755 (while (string-match "[ \t][ \t]+\\|[^a-z0-9 ]+" line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1756 (setq line (concat (substring line 0 (match-beginning 0))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1757 " "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1758 (substring line (match-end 0) (length line)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1759 line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1760
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1761 ;; Some cannot be handled
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1762
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1763 (defun texinfo-unsupported ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1764 (error "%s is not handled by texinfo"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1765 (buffer-substring texinfo-command-start texinfo-command-end)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1766
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 189
diff changeset
1767 ;;;###autoload
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1768 (defun batch-texinfo-format ()
1576
ddfd236e2c0c Dox fix.
Christopher Zaborsky <rogue@erratum.com>
parents: 841
diff changeset
1769 "Runs `texinfo-format-buffer' on the files remaining on the command line.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1770 Must be used only with -batch, and kills emacs on completion.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1771 Each file will be processed even if an error occurred previously.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1772 For example, invoke
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1773 \"emacs -batch -funcall batch-texinfo-format $docs/ ~/*.texinfo\"."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1774 (if (not noninteractive)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1775 (error "batch-texinfo-format may only be used -batch."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1776 (let ((version-control t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1777 (auto-save-default nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1778 (find-file-run-dired nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1779 (kept-old-versions 259259)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1780 (kept-new-versions 259259))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1781 (let ((error 0)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1782 file
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1783 (files ()))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1784 (while command-line-args-left
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1785 (setq file (expand-file-name (car command-line-args-left)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1786 (cond ((not (file-exists-p file))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1787 (message ">> %s does not exist!" file)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1788 (setq error 1
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1789 command-line-args-left (cdr command-line-args-left)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1790 ((file-directory-p file)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1791 (setq command-line-args-left
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1792 (nconc (directory-files file)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1793 (cdr command-line-args-left))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1794 (t
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1795 (setq files (cons file files)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1796 command-line-args-left (cdr command-line-args-left)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1797 (while files
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1798 (setq file (car files)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1799 files (cdr files))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1800 (condition-case err
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1801 (progn
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1802 (if buffer-file-name (kill-buffer (current-buffer)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1803 (find-file file)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1804 (buffer-disable-undo (current-buffer))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1805 (set-buffer-modified-p nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1806 (texinfo-mode)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1807 (message "texinfo formatting %s..." file)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1808 (texinfo-format-buffer nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1809 (if (buffer-modified-p)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1810 (progn (message "Saving modified %s" (buffer-file-name))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1811 (save-buffer))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1812 (error
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1813 (message ">> Error: %s" (prin1-to-string err))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1814 (message ">> point at")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1815 (let ((s (buffer-substring (point)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1816 (min (+ (point) 100)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1817 (point-max))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1818 (tem 0))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1819 (while (setq tem (string-match "\n+" s tem))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1820 (setq s (concat (substring s 0 (match-beginning 0))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1821 "\n>> "
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1822 (substring s (match-end 0)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1823 tem (1+ tem)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1824 (message ">> %s" s))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1825 (setq error 1))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1826 (kill-emacs error))))
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
1827
3456
57089987a2de Provide texinfmt.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
1828 (provide 'texinfmt)
57089987a2de Provide texinfmt.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
1829
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
1830 ;;; texinfmt.el ends here