annotate lisp/textmodes/texinfmt.el @ 600:a8d78999e46d

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