annotate lisp/packages/texinfmt.el @ 209:41ff10fd062f r20-4b3

Import from CVS: tag r20-4b3
author cvs
date Mon, 13 Aug 2007 10:04:58 +0200
parents ac2d302a0011
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1 ;;; texinfmt.el --- format Texinfo files into Info files.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3 ;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993 Free Software
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
4 ;; Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Maintainer: Robert J. Chassell <bug-texinfo@prep.ai.mit.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
8 ;; This file is part of XEmacs.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
11 ;; under the terms of the GNU General Public License as published by
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
18 ;; General Public License for more details.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
23 ;; 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
25 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; Emacs lisp functions to convert Texinfo files to Info files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (defvar texinfmt-version "2.34 of 7 June 1995")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; Variable definitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (require 'texinfo) ; So `texinfo-footnote-style' is defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (require 'texnfo-upd) ; So `texinfo-section-types-regexp' is defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (defvar texinfo-format-syntax-table nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (defvar texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (defvar texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (defvar texinfo-cindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (defvar texinfo-pindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (defvar texinfo-tindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defvar texinfo-kindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (defvar texinfo-last-node)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (defvar texinfo-node-names)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (defvar texinfo-enclosure-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (defvar texinfo-alias-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (defvar texinfo-command-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (defvar texinfo-command-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (defvar texinfo-command-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (defvar texinfo-defun-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (defvar texinfo-last-node-pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (defvar texinfo-stack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (defvar texinfo-short-index-cmds-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defvar texinfo-short-index-format-cmds-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (defvar texinfo-format-filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (defvar texinfo-footnote-number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (defvar texinfo-start-of-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (defvar texinfo-end-of-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defvar texinfo-raisesections-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (defvar texinfo-lowersections-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;;; Syntax table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (if texinfo-format-syntax-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (setq texinfo-format-syntax-table (make-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (modify-syntax-entry ?\" " " texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (modify-syntax-entry ?\\ " " texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (modify-syntax-entry ?@ "\\" texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (modify-syntax-entry ?\^q "\\" texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (modify-syntax-entry ?\[ "." texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (modify-syntax-entry ?\] "." texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (modify-syntax-entry ?\( "." texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (modify-syntax-entry ?\) "." texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (modify-syntax-entry ?{ "(}" texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (modify-syntax-entry ?} "){" texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (modify-syntax-entry ?\' "." texinfo-format-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;;; Top level buffer and region formatting functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defun texinfo-format-buffer (&optional notagify)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 "Process the current buffer as texinfo code, into an Info file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 The Info file output is generated in a buffer visiting the Info file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 names specified in the @setfilename command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 Non-nil argument (prefix, if interactive) means don't make tag table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 and don't split the file if large. You can use Info-tagify and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 Info-split to do these manually."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (let ((lastmessage "Formatting Info file..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (message lastmessage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (texinfo-format-buffer-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (if notagify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (if (> (buffer-size) 30000)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (message (setq lastmessage "Making tags table for Info file..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (Info-tagify)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (if (> (buffer-size) 100000)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (message (setq lastmessage "Splitting Info file..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (Info-split))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (message (concat lastmessage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (if (interactive-p) "done. Now save it." "done.")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (defvar texinfo-region-buffer-name "*Info Region*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 "*Name of the temporary buffer used by \\[texinfo-format-region].")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (defun texinfo-format-region (region-beginning region-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 "Convert the current region of the Texinfo file to Info format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 This lets you see what that part of the file will look like in Info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 The command is bound to \\[texinfo-format-region]. The text that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 converted to Info is stored in a temporary buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (message "Converting region to Info format...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (let (texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 texinfo-command-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 texinfo-command-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 texinfo-vindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 texinfo-findex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 texinfo-cindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 texinfo-pindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 texinfo-tindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 texinfo-kindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 texinfo-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (texinfo-format-filename "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 texinfo-example-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 texinfo-node-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (texinfo-footnote-number 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 last-input-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (fill-column-for-info fill-column)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (input-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (input-directory default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (header-text "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (header-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (header-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;;; Copy lines between beginning and end of header lines,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;;; if any, or else copy the `@setfilename' line, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (let ((search-end (save-excursion (forward-line 100) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (if (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;; Either copy header text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (search-forward tex-start-of-header search-end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;; Mark beginning of header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (setq header-beginning (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (search-forward tex-end-of-header nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; Mark end of header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (setq header-end (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;; Or copy @filename line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (prog2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (search-forward "@setfilename" search-end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (setq header-beginning (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (setq header-end (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; Copy header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (setq header-text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (min header-beginning region-beginning)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 header-end))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;;; Find a buffer to use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (switch-to-buffer (get-buffer-create texinfo-region-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;; Insert the header into the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (insert header-text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; Insert the region into the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (insert-buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 input-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (max region-beginning header-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 region-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;; Make sure region ends in a newline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (or (= (preceding-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (texinfo-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (message "Converting region to Info format...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (setq fill-column fill-column-for-info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;; Install a syntax table useful for scanning command operands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (set-syntax-table texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ;; Insert @include files so `texinfo-raise-lower-sections' can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;; work on them without losing track of multiple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;; @raise/@lowersections commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (while (re-search-forward "^@include" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (let ((filename (concat input-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (texinfo-parse-line-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (re-search-backward "^@include")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (delete-region (point) (save-excursion (forward-line 1) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (message "Reading included file: %s" filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (+ (point) (car (cdr (insert-file-contents filename)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;; Remove `@setfilename' line from included file, if any,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;; so @setfilename command not duplicated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (if (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 "^@setfilename" (save-excursion (forward-line 100) (point)) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (point) (save-excursion (forward-line 1) (point)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; Raise or lower level of each section, if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (texinfo-raise-lower-sections)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ;; Append @refill to appropriate paragraphs for filling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (texinfo-append-refill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; If the region includes the effective end of the data,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ;; discard everything after that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (if (re-search-backward "^@bye" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (delete-region (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;; Make sure buffer ends in a newline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (or (= (preceding-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;; Don't use a previous value of texinfo-enclosure-list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (setq texinfo-enclosure-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (setq texinfo-alias-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (if (looking-at "\\\\input[ \t]+texinfo")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (delete-region (point) (save-excursion (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ;; Insert Info region title text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (if (search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 "@setfilename" (save-excursion (forward-line 100) (point)) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (setq texinfo-command-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (let ((arg (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (insert " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 texinfo-region-buffer-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 " buffer for: `")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (insert (file-name-nondirectory (expand-file-name arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (insert "', -*-Text-*-\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;; Else no `@setfilename' line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (insert " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 texinfo-region-buffer-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 " buffer -*-Text-*-\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (insert "produced by `texinfo-format-region'\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 "from a region in: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (if (buffer-file-name input-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (concat "`"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (file-name-sans-versions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (buffer-file-name input-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 "'")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (concat "buffer `" (buffer-name input-buffer) "'"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 "\nusing `texinfmt.el' version "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 texinfmt-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ".\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;; Now convert for real.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (texinfo-format-scan)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (message "Done.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 ;;; Primary internal formatting function for the whole buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (defun texinfo-format-buffer-1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (let (texinfo-format-filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 texinfo-example-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 texinfo-command-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 texinfo-command-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 texinfo-vindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 texinfo-findex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 texinfo-cindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 texinfo-pindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 texinfo-tindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 texinfo-kindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 texinfo-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 texinfo-node-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (texinfo-footnote-number 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 last-input-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 outfile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (fill-column-for-info fill-column)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (input-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (input-directory default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (setq texinfo-enclosure-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (setq texinfo-alias-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (or (search-forward "@setfilename" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (error "Texinfo file needs an `@setfilename FILENAME' line."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (setq outfile (texinfo-parse-line-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (find-file outfile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (texinfo-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (setq fill-column fill-column-for-info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (set-syntax-table texinfo-format-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (insert-buffer-substring input-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (message "Converting %s to Info format..." (buffer-name input-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 ;; Insert @include files so `texinfo-raise-lower-sections' can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 ;; work on them without losing track of multiple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 ;; @raise/@lowersections commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (while (re-search-forward "^@include" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (let ((filename (concat input-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (texinfo-parse-line-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (re-search-backward "^@include")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (delete-region (point) (save-excursion (forward-line 1) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (message "Reading included file: %s" filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (+ (point) (car (cdr (insert-file-contents filename)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 ;; Remove `@setfilename' line from included file, if any,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; so @setfilename command not duplicated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (if (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 "^@setfilename"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (save-excursion (forward-line 100) (point)) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (point) (save-excursion (forward-line 1) (point)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 ;; Raise or lower level of each section, if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (texinfo-raise-lower-sections)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ;; Append @refill to appropriate paragraphs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (texinfo-append-refill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (search-forward "@setfilename")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (delete-region (point-min) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ;; Remove @bye at end of file, if it is there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (if (search-backward "@bye" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (delete-region (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ;; Make sure buffer ends in a newline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (or (= (preceding-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;; Scan the whole buffer, converting to Info format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (texinfo-format-scan)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 ;; Return data for indices.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (list outfile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 texinfo-vindex texinfo-findex texinfo-cindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 texinfo-pindex texinfo-tindex texinfo-kindex)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;;; Perform non-@-command file conversions: quotes and hyphens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (defun texinfo-format-convert (min max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ;; Convert left and right quotes to typewriter font quotes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (goto-char min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (while (search-forward "``" max t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (replace-match "\""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (goto-char min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (while (search-forward "''" max t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (replace-match "\""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ;; Convert three hyphens in a row to two.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (goto-char min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\)" max t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ;;; Handle paragraph filling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (defvar texinfo-no-refill-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 "^@\\(example\\|smallexample\\|lisp\\|smalllisp\\|display\\|format\\|flushleft\\|flushright\\|menu\\|titlepage\\|iftex\\|ifhtml\\|tex\\|html\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 "Regexp specifying environments in which paragraphs are not filled.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (defvar texinfo-part-of-para-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 "^@\\(b{\\|bullet{\\|cite{\\|code{\\|emph{\\|equiv{\\|error{\\|expansion{\\|file{\\|i{\\|inforef{\\|kbd{\\|key{\\|lisp{\\|minus{\\|point{\\|print{\\|pxref{\\|r{\\|ref{\\|result{\\|samp{\\|sc{\\|t{\\|TeX{\\|today{\\|var{\\|w{\\|xref{\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 "Regexp specifying @-commands found within paragraphs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (defun texinfo-append-refill ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 "Append @refill at end of each paragraph that should be filled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 Do not append @refill to paragraphs within @example and similar environments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 Do not append @refill to paragraphs containing @w{TEXT} or @*."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;; It is necessary to append @refill before other processing because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 ;; the other processing removes information that tells Texinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 ;; whether the text should or should not be filled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (while (< (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (let ((refill-blank-lines "^[ \t\n]*$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (case-fold-search nil)) ; Don't confuse @TeX and @tex....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ;; 1. Skip over blank lines;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ;; skip over lines beginning with @-commands,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ;; but do not skip over lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 ;; that are no-refill environments such as @example or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 ;; that begin with within-paragraph @-commands such as @code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (while (and (looking-at (concat "^@\\|^\\\\\\|" refill-blank-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (not (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 "\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 texinfo-no-refill-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 texinfo-part-of-para-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 "\\)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (< (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 ;; 2. Skip over @example and similar no-refill environments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (if (looking-at texinfo-no-refill-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (let ((environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (buffer-substring (match-beginning 1) (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (progn (re-search-forward (concat "^@end " environment) nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 ;; 3. Do not refill a paragraph containing @w or @*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (if (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (>= (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 "@w{\\|@\\*" (save-excursion (forward-paragraph) (point)) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 ;; Go to end of paragraph and do nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (forward-paragraph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 ;; 4. Else go to end of paragraph and insert @refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (forward-paragraph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (save-excursion (skip-chars-backward " \t") (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 ;; `looking-at-backward' not available in v. 18.57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 ;; (if (not (looking-at-backward "@refill\\|@bye")) ;)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (if (not (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 "@refill\\|@bye"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (save-excursion (beginning-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (insert "@refill"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (forward-line 1))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 ;;; Handle `@raisesections' and `@lowersections' commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 ;; These commands change the hierarchical level of chapter structuring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 ;; commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 ;; @raisesections changes @subsection to @section,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 ;; @section to @chapter,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 ;; etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ;; @lowersections changes @chapter to @section
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 ;; @subsection to @subsubsection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 ;; etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 ;; An @raisesections/@lowersections command changes only those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 ;; structuring commands that follow the @raisesections/@lowersections
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 ;; command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 ;; Repeated @raisesections/@lowersections continue to raise or lower
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 ;; the heading level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 ;; An @lowersections command cancels an @raisesections command, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 ;; vice versa.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 ;; You cannot raise or lower "beyond" chapters or subsubsections, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 ;; trying to do so does not elicit an error---you just get more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 ;; headings that mean the same thing as you keep raising or lowering
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 ;; (for example, after a single @raisesections, both @chapter and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 ;; @section produce chapter headings).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (defun texinfo-raise-lower-sections ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 "Raise or lower the hierarchical level of chapters, sections, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 This function acts according to `@raisesections' and `@lowersections'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 commands in the Texinfo file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 For example, an `@lowersections' command is useful if you wish to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 include what is written as an outer or standalone Texinfo file in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 another Texinfo file as an inner, included file. The `@lowersections'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 command changes chapters to sections, sections to subsections and so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 @raisesections changes @subsection to @section,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 @section to @chapter,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 @heading to @chapheading,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 @lowersections changes @chapter to @section,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 @subsection to @subsubsection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 @heading to @subheading,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 An `@raisesections' or `@lowersections' command changes only those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 structuring commands that follow the `@raisesections' or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 `@lowersections' command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 An `@lowersections' command cancels an `@raisesections' command, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 vice versa.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 Repeated use of the commands continue to raise or lower the hierarchical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 level a step at a time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 An attempt to raise above `chapters' reproduces chapter commands; an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 attempt to lower below subsubsections reproduces subsubsection
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 commands."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ;; `texinfo-section-types-regexp' is defined in `texnfo-upd.el';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 ;; it is a regexp matching chapter, section, other headings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ;; (but not the top node).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (let (type (level 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 "\\(\\(^@\\(raise\\|lower\\)sections\\)\\|\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 texinfo-section-types-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 "\\)\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (save-excursion (setq type (read (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ;; 1. Increment level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ((eq type '@raisesections)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (setq level (1+ level))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (point) (save-excursion (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 ;; 2. Decrement level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 ((eq type '@lowersections)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (setq level (1- level))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (point) (save-excursion (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 ;; Now handle structuring commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ((cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 ;; 3. Raise level when positive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 ((> level 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (let ((count level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (new-level type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (while (> count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (setq new-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (cdr (assq new-level texinfo-raisesections-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (setq count (1- count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (kill-word 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (insert (symbol-name new-level))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ;; 4. Do nothing except move point when level is zero
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 ((= level 0) (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 ;; 5. Lower level when positive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 ((< level 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (let ((count level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (new-level type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (while (< count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (setq new-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (cdr (assq new-level texinfo-lowersections-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (setq count (1+ count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (kill-word 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (insert (symbol-name new-level))))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (defvar texinfo-raisesections-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 '((@chapter . @chapter) ; Cannot go higher
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (@unnumbered . @unnumbered)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (@majorheading . @majorheading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (@chapheading . @chapheading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (@appendix . @appendix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (@section . @chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (@unnumberedsec . @unnumbered)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (@heading . @chapheading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (@appendixsec . @appendix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (@subsection . @section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (@unnumberedsubsec . @unnumberedsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (@subheading . @heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (@appendixsubsec . @appendixsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (@subsubsection . @subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (@unnumberedsubsubsec . @unnumberedsubsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (@subsubheading . @subheading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (@appendixsubsubsec . @appendixsubsec))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 "*An alist of next higher levels for chapters, sections. etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 For example, section to chapter, subsection to section.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 Used by `texinfo-raise-lower-sections'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 The keys specify types of section; the values correspond to the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 higher types.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (defvar texinfo-lowersections-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 '((@chapter . @section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (@unnumbered . @unnumberedsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (@majorheading . @heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (@chapheading . @heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (@appendix . @appendixsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (@section . @subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (@unnumberedsec . @unnumberedsubsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (@heading . @subheading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (@appendixsec . @appendixsubsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (@subsection . @subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (@unnumberedsubsec . @unnumberedsubsubsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (@subheading . @subsubheading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (@appendixsubsec . @appendixsubsubsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (@subsubsection . @subsubsection) ; Cannot go lower.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (@unnumberedsubsubsec . @unnumberedsubsubsec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (@subsubheading . @subsubheading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (@appendixsubsubsec . @appendixsubsubsec))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 "*An alist of next lower levels for chapters, sections. etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 For example, chapter to section, section to subsection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 Used by `texinfo-raise-lower-sections'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 The keys specify types of section; the values correspond to the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 lower types.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ;;; Perform those texinfo-to-info conversions that apply to the whole input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 ;;; uniformly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (defun texinfo-format-scan ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (texinfo-format-convert (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 ;; Scan for @-commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (while (search-forward "@" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (if (looking-at "[@{}^'` *\"?!]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 ;; Handle a few special @-followed-by-one-char commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (if (= (following-char) ?*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;; remove command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (delete-region (1- (point)) (1+ (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ;; insert return if not at end of line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 ;; else line is already broken.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (if (not (= (following-char) ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (insert ?\n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;; The other characters are simply quoted. Delete the @.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (delete-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (forward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 ;; @ is followed by a command-word; find the end of the word.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (setq texinfo-command-start (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (if (= (char-syntax (following-char)) ?w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (forward-word 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (forward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 ;; Handle let aliasing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (setq texinfo-command-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (let (trial
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (cmdname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (1+ texinfo-command-start) texinfo-command-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (while (setq trial (assoc cmdname texinfo-alias-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (setq cmdname (cdr trial)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (intern cmdname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 ;; Call the handler for this command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (let ((enclosure-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (assoc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (symbol-name texinfo-command-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 texinfo-enclosure-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (if enclosure-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (car (car (cdr enclosure-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (car (cdr (car (cdr enclosure-type)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (goto-char texinfo-command-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (let ((cmd (get texinfo-command-name 'texinfo-format)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (if cmd (funcall cmd) (texinfo-unsupported)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (cond (texinfo-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (goto-char (nth 2 (car texinfo-stack)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (error "Unterminated @%s" (car (car texinfo-stack))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (put 'begin 'texinfo-format 'texinfo-format-begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (defun texinfo-format-begin ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (texinfo-format-begin-end 'texinfo-format))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (put 'end 'texinfo-format 'texinfo-format-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (defun texinfo-format-end ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (texinfo-format-begin-end 'texinfo-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (defun texinfo-format-begin-end (prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (setq texinfo-command-name (intern (texinfo-parse-line-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (let ((cmd (get texinfo-command-name prop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (if cmd (funcall cmd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (texinfo-unsupported))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 ;;; Parsing functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (defun texinfo-parse-line-arg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (goto-char texinfo-command-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (cond ((looking-at " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (skip-chars-backward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (delete-region (point) (progn (end-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (setq texinfo-command-end (1+ (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 ((looking-at "{")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (setq start (1+ (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (forward-list 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (forward-char -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (error "Invalid texinfo command arg format")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (prog1 (buffer-substring start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (if (eolp) (forward-char 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (defun texinfo-parse-expanded-arg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (goto-char texinfo-command-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (let ((start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (cond ((looking-at " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (setq texinfo-command-end (1+ (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 ((looking-at "{")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (setq start (1+ (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (forward-list 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (forward-char -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (error "Invalid texinfo command arg format")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (setq marker (move-marker (make-marker) texinfo-command-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (texinfo-format-expand-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (setq texinfo-command-end (marker-position marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (move-marker marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (prog1 (buffer-substring start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (if (eolp) (forward-char 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (defun texinfo-format-expand-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (narrow-to-region start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (let (texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 texinfo-command-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 texinfo-command-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 texinfo-stack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (texinfo-format-scan))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (goto-char (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (defun texinfo-parse-arg-discard ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (prog1 (texinfo-parse-line-arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (texinfo-discard-command)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (defun texinfo-discard-command ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (delete-region texinfo-command-start texinfo-command-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (defun texinfo-optional-braces-discard ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 "Discard braces following command, if any."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (goto-char texinfo-command-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (cond ((looking-at "[ \t]*\n")) ; do nothing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 ((looking-at "{") ; remove braces, if any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (forward-list 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (setq texinfo-command-end (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 "Invalid `texinfo-optional-braces-discard' format \(need braces?\)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (delete-region texinfo-command-start texinfo-command-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (defun texinfo-format-parse-line-args ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (let ((start (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 next beg end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (while (not (eolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (re-search-forward "[\n,]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (setq next (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (if (bolp) (setq next (1- next)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (skip-chars-backward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (setq end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (setq args (cons (if (> end beg) (buffer-substring beg end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (goto-char next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (skip-chars-forward " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (if (eolp) (forward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (nreverse args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (defun texinfo-format-parse-args ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (let ((start (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 next beg end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (search-forward "{")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (texinfo-format-expand-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (save-excursion (up-list 1) (1- (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 ;; The following does not handle cross references of the form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 ;; `@xref{bullet, , @code{@@bullet}@{@}}.' because the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 ;; re-search-forward finds the first right brace after the second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 ;; comma.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (while (/= (preceding-char) ?\})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (skip-chars-forward " \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (re-search-forward "[},]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (setq next (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (skip-chars-backward " \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (setq end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 (cond ((< beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (while (search-forward "\n" end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (replace-match " "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 (setq args (cons (if (> end beg) (buffer-substring beg end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (goto-char next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (if (eolp) (forward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (setq texinfo-command-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (nreverse args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (defun texinfo-format-parse-defun-args ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (goto-char texinfo-command-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (setq texinfo-command-end (1+ (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (let ((marker (move-marker (make-marker) texinfo-command-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (texinfo-format-expand-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (setq texinfo-command-end (marker-position marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (move-marker marker nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (let ((args '())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (while (not (eolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (cond ((looking-at "{")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 (setq beg (1+ (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (forward-list 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (setq end (1- (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (re-search-forward "[\n ]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (setq end (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (setq args (cons (buffer-substring beg end) args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (skip-chars-forward " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (nreverse args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (defun texinfo-discard-line ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (goto-char texinfo-command-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (skip-chars-forward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (or (eolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (error "Extraneous text at end of command line."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (goto-char texinfo-command-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (or (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (error "Extraneous text at beginning of command line."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (delete-region (point) (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (defun texinfo-discard-line-with-args ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (goto-char texinfo-command-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (delete-region (point) (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 ;;; @setfilename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 ;; Only `texinfo-format-buffer' handles @setfilename with this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 ;; definition; `texinfo-format-region' handles @setfilename, if any,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 ;; specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (put 'setfilename 'texinfo-format 'texinfo-format-setfilename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (defun texinfo-format-setfilename ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (let ((arg (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (message "Formatting Info file: %s" arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (setq texinfo-format-filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (file-name-nondirectory (expand-file-name arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (insert "Info file: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 texinfo-format-filename ", -*-Text-*-\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 "produced by `texinfo-format-buffer'\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 "from file"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (if (buffer-file-name input-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (concat " `"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (file-name-sans-versions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (buffer-file-name input-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 "'")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (concat "buffer `" (buffer-name input-buffer) "'"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 "\nusing `texinfmt.el' version "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 texinfmt-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 ".\n\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 ;;; @node, @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (put 'node 'texinfo-format 'texinfo-format-node)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (put 'nwnode 'texinfo-format 'texinfo-format-node)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 (defun texinfo-format-node ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (let* ((args (texinfo-format-parse-line-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (name (nth 0 args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (next (nth 1 args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (prev (nth 2 args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (up (nth 3 args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (setq texinfo-last-node name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (let ((tem (downcase name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (if (assoc tem texinfo-node-names)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (error "Duplicate node name: %s" name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (setq texinfo-node-names (cons (list tem) texinfo-node-names))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (setq texinfo-footnote-number 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 ;; insert "\n\^_" unconditionally since this is what info is looking for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (insert "\n\^_\nFile: " texinfo-format-filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 ", Node: " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (if next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (insert ", Next: " next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (if prev
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (insert ", Prev: " prev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (if up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (insert ", Up: " up))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (setq texinfo-last-node-pos (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (put 'menu 'texinfo-format 'texinfo-format-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (defun texinfo-format-menu ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (insert "* Menu:\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (put 'menu 'texinfo-end 'texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ;;; Cross references
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 ; @xref {NODE, FNAME, NAME, FILE, DOCUMENT}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 ; -> *Note FNAME: (FILE)NODE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 ; If FILE is missing,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 ; *Note FNAME: NODE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 ; If FNAME is empty and NAME is present
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 ; *Note NAME: Node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 ; If both NAME and FNAME are missing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ; *Note NODE::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 ; texinfo ignores the DOCUMENT argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 ; -> See section <xref to NODE> [NAME, else NODE], page <xref to NODE>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 ; If FILE is specified, (FILE)NODE is used for xrefs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 ; If fifth argument DOCUMENT is specified, produces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 ; See section <xref to NODE> [NAME, else NODE], page <xref to NODE>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 ; of DOCUMENT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 ; @ref a reference that does not put `See' or `see' in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 ; the hardcopy and is the same as @xref in Info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (put 'ref 'texinfo-format 'texinfo-format-xref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (put 'xref 'texinfo-format 'texinfo-format-xref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (defun texinfo-format-xref ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (let ((args (texinfo-format-parse-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (insert "*Note ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (let ((fname (or (nth 1 args) (nth 2 args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (if (null (or fname (nth 3 args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (insert (car args) "::")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (insert (or fname (car args)) ": ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (if (nth 3 args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (insert "(" (nth 3 args) ")"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (insert (car args))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (put 'pxref 'texinfo-format 'texinfo-format-pxref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (defun texinfo-format-pxref ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (texinfo-format-xref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (or (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (forward-char -2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (looking-at "::"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (insert ".")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 ;@inforef{NODE, FNAME, FILE}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 ;Like @xref{NODE, FNAME,,FILE} in texinfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 ;In Tex, generates "See Info file FILE, node NODE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (put 'inforef 'texinfo-format 'texinfo-format-inforef)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (defun texinfo-format-inforef ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (let ((args (texinfo-format-parse-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (if (nth 1 args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (insert "*Note " (nth 1 args) ": (" (nth 2 args) ")" (car args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (insert "*Note " "(" (nth 2 args) ")" (car args) "::"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 ;;; Section headings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (put 'majorheading 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (put 'chapheading 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (put 'ichapter 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (put 'chapter 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (put 'iappendix 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (put 'appendix 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (put 'iunnumbered 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (put 'top 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (put 'unnumbered 'texinfo-format 'texinfo-format-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (defun texinfo-format-chapter ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (texinfo-format-chapter-1 ?*))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (put 'heading 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (put 'isection 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 (put 'section 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (put 'iappendixsection 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (put 'appendixsection 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (put 'iappendixsec 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (put 'appendixsec 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (put 'iunnumberedsec 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (put 'unnumberedsec 'texinfo-format 'texinfo-format-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (defun texinfo-format-section ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (texinfo-format-chapter-1 ?=))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (put 'subheading 'texinfo-format 'texinfo-format-subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (put 'isubsection 'texinfo-format 'texinfo-format-subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (put 'subsection 'texinfo-format 'texinfo-format-subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (put 'iappendixsubsec 'texinfo-format 'texinfo-format-subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (put 'appendixsubsec 'texinfo-format 'texinfo-format-subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (put 'iunnumberedsubsec 'texinfo-format 'texinfo-format-subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (put 'unnumberedsubsec 'texinfo-format 'texinfo-format-subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (defun texinfo-format-subsection ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (texinfo-format-chapter-1 ?-))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (put 'subsubheading 'texinfo-format 'texinfo-format-subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (put 'isubsubsection 'texinfo-format 'texinfo-format-subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (put 'subsubsection 'texinfo-format 'texinfo-format-subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (put 'iappendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (put 'appendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (put 'iunnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (put 'unnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (defun texinfo-format-subsubsection ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (texinfo-format-chapter-1 ?.))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (defun texinfo-format-chapter-1 (belowchar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (let ((arg (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (message "Formatting: %s ... " arg) ; So we can see where we are.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (insert ?\n arg ?\n "@SectionPAD " belowchar ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (forward-line -2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (put 'SectionPAD 'texinfo-format 'texinfo-format-sectionpad)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (defun texinfo-format-sectionpad ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (let ((str (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (let ((column (current-column)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (while (> column 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (insert str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (setq column (1- column))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (insert ?\n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 ;;; Space controlling commands: @. and @:, and the soft hyphen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 (put '\. 'texinfo-format 'texinfo-format-\.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (defun texinfo-format-\. ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (insert "."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (put '\: 'texinfo-format 'texinfo-format-\:)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (defun texinfo-format-\: ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (texinfo-discard-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (put '\- 'texinfo-format 'texinfo-format-soft-hyphen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (defun texinfo-format-soft-hyphen ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (texinfo-discard-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 ;;; @center, @sp, and @br
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (put 'center 'texinfo-format 'texinfo-format-center)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (defun texinfo-format-center ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (let ((arg (texinfo-parse-expanded-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (insert arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (goto-char (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (let ((indent-tabs-mode nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (center-line)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (put 'sp 'texinfo-format 'texinfo-format-sp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (defun texinfo-format-sp ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (let* ((arg (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (num (read arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (insert-char ?\n num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (put 'br 'texinfo-format 'texinfo-format-paragraph-break)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (defun texinfo-format-paragraph-break ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 "Force a paragraph break.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 If used within a line, follow `@br' with braces."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (texinfo-optional-braces-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 ;; insert one return if at end of line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 ;; else insert two returns, to generate a blank line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (if (= (following-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (insert-char ?\n 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 ;;; @footnote and @footnotestyle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 ; In Texinfo, footnotes are created with the `@footnote' command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 ; This command is followed immediately by a left brace, then by the text of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 ; the footnote, and then by a terminating right brace. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 ; template for a footnote is:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 ; @footnote{TEXT}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 ; Info has two footnote styles:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 ; * In the End of node style, all the footnotes for a single node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 ; are placed at the end of that node. The footnotes are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 ; separated from the rest of the node by a line of dashes with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 ; the word `Footnotes' within it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 ; * In the Separate node style, all the footnotes for a single node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 ; are placed in an automatically constructed node of their own.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 ; Footnote style is specified by the @footnotestyle command, either
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 ; @footnotestyle separate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 ; or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 ; @footnotestyle end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 ; The default is separate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 (defvar texinfo-footnote-style "separate"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 "Footnote style, either separate or end.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (put 'footnotestyle 'texinfo-format 'texinfo-footnotestyle)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (defun texinfo-footnotestyle ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 "Specify whether footnotes are at end of node or in separate nodes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 Argument is either end or separate."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (setq texinfo-footnote-style (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (defvar texinfo-footnote-number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (put 'footnote 'texinfo-format 'texinfo-format-footnote)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (defun texinfo-format-footnote ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 "Format a footnote in either end of node or separate node style.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 The texinfo-footnote-style variable controls which style is used."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (setq texinfo-footnote-number (1+ texinfo-footnote-number))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (cond ((string= texinfo-footnote-style "end")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (texinfo-format-end-node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 ((string= texinfo-footnote-style "separate")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (texinfo-format-separate-node))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (defun texinfo-format-separate-node ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 "Format footnote in Separate node style, with notes in own node.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 The node is constructed automatically."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (let* (start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 (arg (texinfo-parse-line-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 (node-name-beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 "^File: \\w+\\(\\w\\|\\s_\\|\\.\\|,\\)*[ \t]+Node:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (node-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 (progn (goto-char node-name-beginning) ; skip over node command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 (skip-chars-forward " \t") ; and over spaces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (if (search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 ","
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 (save-excursion (end-of-line) (point)) t) ; bound search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 (end-of-line) (point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (texinfo-discard-command) ; remove or insert whitespace, as needed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (delete-region (save-excursion (skip-chars-backward " \t\n") (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 (insert (format " (%d) (*Note %s-Footnotes::)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 texinfo-footnote-number node-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 (fill-paragraph nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (if (re-search-forward "^@node" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 ;; two cases: for the first footnote, we must insert a node header;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 ;; for the second and subsequent footnotes, we need only insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 ;; the text of the footnote.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (if (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (concat node-name "-Footnotes, Up: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 node-name-beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 (progn ; already at least one footnote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 (fill-region start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 ;; else not yet a footnote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 (insert "\n\^_\nFile: " texinfo-format-filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 " Node: " node-name "-Footnotes, Up: " node-name "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 (fill-region start (point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 (defun texinfo-format-end-node ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 "Format footnote in the End of node style, with notes at end of node."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 (let (start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 (arg (texinfo-parse-line-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 (texinfo-discard-command) ; remove or insert whitespace, as needed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 (delete-region (save-excursion (skip-chars-backward " \t\n") (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 (insert (format " (%d) " texinfo-footnote-number))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 (fill-paragraph nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 (if (search-forward "\n--------- Footnotes ---------\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (progn ; already have footnote, put new one before end of node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 (if (re-search-forward "^@node" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 (fill-region start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 ;; else no prior footnote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 (if (re-search-forward "^@node" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 (insert "\n--------- Footnotes ---------\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 ;;; @itemize, @enumerate, and similar commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 ;; @itemize pushes (itemize "COMMANDS" STARTPOS) on texinfo-stack.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 ;; @enumerate pushes (enumerate 0 STARTPOS).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 ;; @item dispatches to the texinfo-item prop of the first elt of the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 ;; For itemize, this puts in and rescans the COMMANDS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 ;; For enumerate, this increments the number and puts it in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 ;; In either case, it puts a Backspace at the front of the line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 ;; which marks it not to be indented later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 ;; All other lines get indented by 5 when the @end is reached.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (defvar texinfo-stack-depth 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 "Count of number of unpopped texinfo-push-stack calls.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 Used by @refill indenting command to avoid indenting within lists, etc.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (defun texinfo-push-stack (check arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (setq texinfo-stack-depth (1+ texinfo-stack-depth))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (setq texinfo-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 (cons (list check arg texinfo-command-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 texinfo-stack)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (defun texinfo-pop-stack (check)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (setq texinfo-stack-depth (1- texinfo-stack-depth))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 (if (null texinfo-stack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 (error "Unmatched @end %s" check))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (if (not (eq (car (car texinfo-stack)) check))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 (error "@end %s matches @%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 check (car (car texinfo-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 (prog1 (cdr (car texinfo-stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 (setq texinfo-stack (cdr texinfo-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (put 'itemize 'texinfo-format 'texinfo-itemize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (defun texinfo-itemize ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 (texinfo-push-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 'itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (progn (skip-chars-forward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 (if (eolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 "@bullet"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 (texinfo-parse-line-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 (texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 (setq fill-column (- fill-column 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (put 'itemize 'texinfo-end 'texinfo-end-itemize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (defun texinfo-end-itemize ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (setq fill-column (+ fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (let ((stacktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (texinfo-pop-stack 'itemize)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 (texinfo-do-itemize (nth 1 stacktop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 (put 'enumerate 'texinfo-format 'texinfo-enumerate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (defun texinfo-enumerate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (texinfo-push-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 'enumerate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (progn (skip-chars-forward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 (if (eolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (read (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 (if (and (symbolp (car (cdr (car texinfo-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (> 1 (length (symbol-name (car (cdr (car texinfo-stack)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 "@enumerate: Use a number or letter, eg: 1, A, a, 3, B, or d." ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 (setq fill-column (- fill-column 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 (put 'enumerate 'texinfo-end 'texinfo-end-enumerate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (defun texinfo-end-enumerate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 (setq fill-column (+ fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 (let ((stacktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 (texinfo-pop-stack 'enumerate)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 (texinfo-do-itemize (nth 1 stacktop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 ;; @alphaenumerate never became a standard part of Texinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 (put 'alphaenumerate 'texinfo-format 'texinfo-alphaenumerate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 (defun texinfo-alphaenumerate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 (texinfo-push-stack 'alphaenumerate (1- ?a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 (setq fill-column (- fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (texinfo-discard-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 (put 'alphaenumerate 'texinfo-end 'texinfo-end-alphaenumerate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 (defun texinfo-end-alphaenumerate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 (setq fill-column (+ fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 (let ((stacktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 (texinfo-pop-stack 'alphaenumerate)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 (texinfo-do-itemize (nth 1 stacktop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 ;; @capsenumerate never became a standard part of Texinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (put 'capsenumerate 'texinfo-format 'texinfo-capsenumerate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 (defun texinfo-capsenumerate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 (texinfo-push-stack 'capsenumerate (1- ?A))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (setq fill-column (- fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 (texinfo-discard-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 (put 'capsenumerate 'texinfo-end 'texinfo-end-capsenumerate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 (defun texinfo-end-capsenumerate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 (setq fill-column (+ fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 (let ((stacktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 (texinfo-pop-stack 'capsenumerate)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 (texinfo-do-itemize (nth 1 stacktop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 ;; At the @end, indent all the lines within the construct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 ;; except those marked with backspace. FROM says where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 ;; construct started.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 (defun texinfo-do-itemize (from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 (while (progn (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 (>= (point) from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 (if (= (following-char) ?\b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 (delete-char 6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 (if (not (looking-at "[ \t]*$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 (save-excursion (insert " ")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 (put 'item 'texinfo-format 'texinfo-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 (put 'itemx 'texinfo-format 'texinfo-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 (defun texinfo-item ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 (funcall (get (car (car texinfo-stack)) 'texinfo-item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 (put 'itemize 'texinfo-item 'texinfo-itemize-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 (defun texinfo-itemize-item ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 ;; (texinfo-discard-line) ; Did not handle text on same line as @item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 (delete-region (1+ (point)) (save-excursion (beginning-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (if (looking-at "[ \t]*[^ \t\n]+")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 ;; Text on same line as @item command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 (insert "\b " (nth 1 (car texinfo-stack)) " \n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 ;; Else text on next line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (insert "\b " (nth 1 (car texinfo-stack)) " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (put 'enumerate 'texinfo-item 'texinfo-enumerate-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (defun texinfo-enumerate-item ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (let (enumerating-symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (cond ((integerp (car (cdr (car texinfo-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (setq enumerating-symbol (car (cdr (car texinfo-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (insert ?\b (format "%3d. " enumerating-symbol) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 (setcar (cdr (car texinfo-stack)) (1+ enumerating-symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 ((symbolp (car (cdr (car texinfo-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (setq enumerating-symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 (symbol-name (car (cdr (car texinfo-stack)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 (if (or (equal ?\[ (string-to-char enumerating-symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 (equal ?\{ (string-to-char enumerating-symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 "Too many items in enumerated list; alphabet ends at Z."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (insert ?\b (format "%3s. " enumerating-symbol) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (setcar (cdr (car texinfo-stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 (make-symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 (char-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 (1+
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (string-to-char enumerating-symbol))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 "@enumerate: Use a number or letter, eg: 1, A, a, 3, B or d." )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 (forward-line -1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 (put 'alphaenumerate 'texinfo-item 'texinfo-alphaenumerate-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 (defun texinfo-alphaenumerate-item ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 (let ((next (1+ (car (cdr (car texinfo-stack))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 (if (> next ?z)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 (error "More than 26 items in @alphaenumerate; get a bigger alphabet."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 (setcar (cdr (car texinfo-stack)) next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 (insert "\b " next ". \n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 (put 'capsenumerate 'texinfo-item 'texinfo-capsenumerate-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (defun texinfo-capsenumerate-item ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 (texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (let ((next (1+ (car (cdr (car texinfo-stack))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 (if (> next ?Z)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 (error "More than 26 items in @capsenumerate; get a bigger alphabet."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (setcar (cdr (car texinfo-stack)) next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (insert "\b " next ". \n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 (forward-line -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 ;;; @table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 ; The `@table' command produces two-column tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 (put 'table 'texinfo-format 'texinfo-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 (defun texinfo-table ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 (texinfo-push-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 'table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 (progn (skip-chars-forward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 (if (eolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 "@asis"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 (texinfo-parse-line-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 (texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 (setq fill-column (- fill-column 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 (put 'table 'texinfo-item 'texinfo-table-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 (defun texinfo-table-item ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 (let ((arg (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 (itemfont (car (cdr (car texinfo-stack)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 (insert ?\b itemfont ?\{ arg "}\n \n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 (forward-line -2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 (put 'table 'texinfo-end 'texinfo-end-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 (defun texinfo-end-table ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (setq fill-column (+ fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 (let ((stacktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 (texinfo-pop-stack 'table)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (texinfo-do-itemize (nth 1 stacktop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 ;; @description appears to be an undocumented variant on @table that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 ;; does not require an arg. It fails in texinfo.tex 2.58 and is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 ;; part of makeinfo.c The command appears to be a relic of the past.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 (put 'description 'texinfo-end 'texinfo-end-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 (put 'description 'texinfo-format 'texinfo-description)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 (defun texinfo-description ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 (texinfo-push-stack 'table "@asis")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 (setq fill-column (- fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 (texinfo-discard-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 ;;; @ftable, @vtable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 ; The `@ftable' and `@vtable' commands are like the `@table' command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 ; but they also insert each entry in the first column of the table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 ; into the function or variable index.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 ;; Handle the @ftable and @vtable commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 (put 'ftable 'texinfo-format 'texinfo-ftable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 (put 'vtable 'texinfo-format 'texinfo-vtable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 (defun texinfo-ftable () (texinfo-indextable 'ftable))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 (defun texinfo-vtable () (texinfo-indextable 'vtable))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 (defun texinfo-indextable (table-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 (texinfo-push-stack table-type (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 (setq fill-column (- fill-column 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 ;; Handle the @item commands within ftable and vtable:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 (put 'ftable 'texinfo-item 'texinfo-ftable-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 (put 'vtable 'texinfo-item 'texinfo-vtable-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 (defun texinfo-ftable-item () (texinfo-indextable-item 'texinfo-findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 (defun texinfo-vtable-item () (texinfo-indextable-item 'texinfo-vindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 (defun texinfo-indextable-item (index-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 (let ((item (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 (itemfont (car (cdr (car texinfo-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 (indexvar index-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 (insert ?\b itemfont ?\{ item "}\n \n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 (set indexvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 (list item texinfo-last-node)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 (symbol-value indexvar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 (forward-line -2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 ;; Handle @end ftable, @end vtable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 (put 'ftable 'texinfo-end 'texinfo-end-ftable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 (put 'vtable 'texinfo-end 'texinfo-end-vtable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 (defun texinfo-end-ftable () (texinfo-end-indextable 'ftable))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 (defun texinfo-end-vtable () (texinfo-end-indextable 'vtable))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 (defun texinfo-end-indextable (table-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 (setq fill-column (+ fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (let ((stacktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 (texinfo-pop-stack table-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 (texinfo-do-itemize (nth 1 stacktop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 ;;; @ifinfo, @iftex, @tex, @ifhtml, @html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 (put 'ifinfo 'texinfo-format 'texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 (put 'ifinfo 'texinfo-end 'texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 (put 'iftex 'texinfo-format 'texinfo-format-iftex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 (defun texinfo-format-iftex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 (progn (re-search-forward "@end iftex[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 (put 'ifhtml 'texinfo-format 'texinfo-format-ifhtml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 (defun texinfo-format-ifhtml ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 (progn (re-search-forward "@end ifhtml[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 (put 'tex 'texinfo-format 'texinfo-format-tex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 (defun texinfo-format-tex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 (progn (re-search-forward "@end tex[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 (put 'html 'texinfo-format 'texinfo-format-html)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 (defun texinfo-format-html ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 (progn (re-search-forward "@end html[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 ;;; @titlepage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 (put 'titlepage 'texinfo-format 'texinfo-format-titlepage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 (defun texinfo-format-titlepage ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 (progn (re-search-forward "@end titlepage[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 (put 'endtitlepage 'texinfo-format 'texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 ; @titlespec an alternative titling command; ignored by Info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 (put 'titlespec 'texinfo-format 'texinfo-format-titlespec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 (defun texinfo-format-titlespec ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 (progn (re-search-forward "@end titlespec[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 (put 'endtitlespec 'texinfo-format 'texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 ;;; @today
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 (put 'today 'texinfo-format 'texinfo-format-today)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 ; Produces Day Month Year style of output. eg `1 Jan 1900'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 ; The `@today{}' command requires a pair of braces, like `@dots{}'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 (defun texinfo-format-today ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 (texinfo-parse-arg-discard)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1568 (insert (format-time-string "%e %b %Y")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 ;;; @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 (put 'ignore 'texinfo-format 'texinfo-format-ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 (defun texinfo-format-ignore ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 (progn (re-search-forward "@end ignore[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 (put 'endignore 'texinfo-format 'texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 ;;; Define the Info enclosure command: @definfoenclose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 ; A `@definfoenclose' command may be used to define a highlighting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 ; command for Info, but not for TeX. A command defined using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 ; `@definfoenclose' marks text by enclosing it in strings that precede
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 ; and follow the text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 ; Presumably, if you define a command with `@definfoenclose` for Info,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 ; you will also define the same command in the TeX definitions file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 ; `texinfo.tex' in a manner appropriate for typesetting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 ; Write a `@definfoenclose' command on a line and follow it with three
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 ; arguments separated by commas (commas are used as separators in an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 ; `@node' line in the same way). The first argument to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 ; `@definfoenclose' is the @-command name \(without the `@'\); the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 ; second argument is the Info start delimiter string; and the third
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 ; argument is the Info end delimiter string. The latter two arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 ; enclose the highlighted text in the Info file. A delimiter string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 ; may contain spaces. Neither the start nor end delimiter is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 ; required. However, if you do not provide a start delimiter, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 ; must follow the command name with two commas in a row; otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 ; the Info formatting commands will misinterpret the end delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 ; string as a start delimiter string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 ; If you do a @definfoenclose{} on the name of a pre-defined macro (such
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 ; as @emph{}, @strong{}, @tt{}, or @i{}) the enclosure definition will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 ; override the built-in definition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 ; An enclosure command defined this way takes one argument in braces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 ; For example, you can write:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 ; @ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 ; @definfoenclose phoo, //, \\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 ; @end ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 ; near the beginning of a Texinfo file at the beginning of the lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 ; to define `@phoo' as an Info formatting command that inserts `//'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 ; before and `\\' after the argument to `@phoo'. You can then write
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 ; `@phoo{bar}' wherever you want `//bar\\' highlighted in Info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 ; Also, for TeX formatting, you could write
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 ; @iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 ; @global@let@phoo=@i
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 ; @end iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 ; to define `@phoo' as a command that causes TeX to typeset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 ; the argument to `@phoo' in italics.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 ; Note that each definition applies to its own formatter: one for TeX,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 ; the other for texinfo-format-buffer or texinfo-format-region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 ; Here is another example: write
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 ; @definfoenclose headword, , :
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 ; near the beginning of the file, to define `@headword' as an Info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 ; formatting command that inserts nothing before and a colon after the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 ; argument to `@headword'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 (put 'definfoenclose 'texinfo-format 'texinfo-define-info-enclosure)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 (defun texinfo-define-info-enclosure ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 (let* ((args (texinfo-format-parse-line-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 (command-name (nth 0 args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 (beginning-delimiter (or (nth 1 args) ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 (end-delimiter (or (nth 2 args) "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 (setq texinfo-enclosure-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 (list command-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 beginning-delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 end-delimiter))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 texinfo-enclosure-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 ;;; @var, @code and the like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 (put 'var 'texinfo-format 'texinfo-format-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 ; @sc a small caps font for TeX; formatted as `var' in Info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 (put 'sc 'texinfo-format 'texinfo-format-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 (defun texinfo-format-var ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 (insert (upcase (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 (goto-char texinfo-command-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 ; various noops
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 (put 'b 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 (put 'i 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 (put 'r 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 (put 't 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 (put 'w 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 (put 'asis 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 (put 'dmn 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 (put 'key 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 (put 'math 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 (put 'titlefont 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 (defun texinfo-format-noop ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 (insert (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 (goto-char texinfo-command-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 (put 'cite 'texinfo-format 'texinfo-format-code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 (put 'code 'texinfo-format 'texinfo-format-code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 (put 'file 'texinfo-format 'texinfo-format-code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 (put 'kbd 'texinfo-format 'texinfo-format-code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 (put 'samp 'texinfo-format 'texinfo-format-code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 (defun texinfo-format-code ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 (insert "`" (texinfo-parse-arg-discard) "'")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 (goto-char texinfo-command-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 (put 'emph 'texinfo-format 'texinfo-format-emph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 (put 'strong 'texinfo-format 'texinfo-format-emph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 (defun texinfo-format-emph ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 (insert "*" (texinfo-parse-arg-discard) "*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 (goto-char texinfo-command-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 (put 'dfn 'texinfo-format 'texinfo-format-defn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 (put 'defn 'texinfo-format 'texinfo-format-defn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 (defun texinfo-format-defn ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 (insert "\"" (texinfo-parse-arg-discard) "\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 (goto-char texinfo-command-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 (put 'bullet 'texinfo-format 'texinfo-format-bullet)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 (defun texinfo-format-bullet ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 "Insert an asterisk.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 If used within a line, follow `@bullet' with braces."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 (texinfo-optional-braces-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 (insert "*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 ;;; @example, @lisp, @quotation, @display, @smalllisp, @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 (put 'display 'texinfo-format 'texinfo-format-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 (put 'example 'texinfo-format 'texinfo-format-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 (put 'lisp 'texinfo-format 'texinfo-format-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 (put 'quotation 'texinfo-format 'texinfo-format-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 (put 'smallexample 'texinfo-format 'texinfo-format-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 (put 'smalllisp 'texinfo-format 'texinfo-format-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 (defun texinfo-format-example ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 (texinfo-push-stack 'example nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 (setq fill-column (- fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 (texinfo-discard-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 (put 'example 'texinfo-end 'texinfo-end-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 (put 'display 'texinfo-end 'texinfo-end-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 (put 'lisp 'texinfo-end 'texinfo-end-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 (put 'quotation 'texinfo-end 'texinfo-end-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 (put 'smallexample 'texinfo-end 'texinfo-end-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 (put 'smalllisp 'texinfo-end 'texinfo-end-example)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 (defun texinfo-end-example ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 (setq fill-column (+ fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 (let ((stacktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 (texinfo-pop-stack 'example)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 (texinfo-do-itemize (nth 1 stacktop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 (put 'exdent 'texinfo-format 'texinfo-format-exdent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 (defun texinfo-format-exdent ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 (delete-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 (insert ?\b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 ;; Cancel out the deletion that texinfo-do-itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 ;; is going to do at the end of this line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 (insert "\n ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 ;;; @cartouche
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 ; The @cartouche command is a noop in Info; in a printed manual,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 ; it makes a box with rounded corners.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 (put 'cartouche 'texinfo-format 'texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 (put 'cartouche 'texinfo-end 'texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 ;;; @flushleft and @format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 ; The @flushleft command left justifies every line but leaves the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 ; right end ragged. As far as Info is concerned, @flushleft is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 ; `do-nothing' command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 ; The @format command is similar to @example except that it does not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 ; indent; this means that in Info, @format is similar to @flushleft.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 (put 'format 'texinfo-format 'texinfo-format-flushleft)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 (put 'flushleft 'texinfo-format 'texinfo-format-flushleft)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 (defun texinfo-format-flushleft ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 (texinfo-discard-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 (put 'format 'texinfo-end 'texinfo-end-flushleft)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 (put 'flushleft 'texinfo-end 'texinfo-end-flushleft)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 (defun texinfo-end-flushleft ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 (texinfo-discard-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 ;;; @flushright
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 ; The @flushright command right justifies every line but leaves the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 ; left end ragged. Spaces and tabs at the right ends of lines are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 ; removed so that visible text lines up on the right side.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 (put 'flushright 'texinfo-format 'texinfo-format-flushright)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 (defun texinfo-format-flushright ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 (texinfo-push-stack 'flushright nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 (texinfo-discard-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 (put 'flushright 'texinfo-end 'texinfo-end-flushright)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 (defun texinfo-end-flushright ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 (let ((stacktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 (texinfo-pop-stack 'flushright)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 (texinfo-do-flushright (nth 1 stacktop))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 (defun texinfo-do-flushright (from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 (while (progn (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 (>= (point) from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 (make-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 (- fill-column
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 (delete-region (point) (progn (end-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 (current-column)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 ? )))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 ;;; @ctrl, @TeX, @copyright, @minus, @dots
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 (put 'ctrl 'texinfo-format 'texinfo-format-ctrl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 (defun texinfo-format-ctrl ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 (let ((str (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 (insert (logand 31 (aref str 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 (put 'TeX 'texinfo-format 'texinfo-format-TeX)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 (defun texinfo-format-TeX ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 (insert "TeX"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 (put 'copyright 'texinfo-format 'texinfo-format-copyright)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 (defun texinfo-format-copyright ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 (insert "(C)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 (put 'minus 'texinfo-format 'texinfo-format-minus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 (defun texinfo-format-minus ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 "Insert a minus sign.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 If used within a line, follow `@minus' with braces."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 (texinfo-optional-braces-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 (insert "-"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 (put 'dots 'texinfo-format 'texinfo-format-dots)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 (defun texinfo-format-dots ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 (insert "..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 (put 'enddots 'texinfo-format 'texinfo-format-enddots)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 (defun texinfo-format-enddots ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 (insert "...."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 ;;; Refilling and indenting: @refill, @paragraphindent, @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 ;;; Indent only those paragraphs that are refilled as a result of an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 ;;; @refill command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 ; * If the value is `asis', do not change the existing indentation at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 ; the starts of paragraphs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 ; * If the value zero, delete any existing indentation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 ; * If the value is greater than zero, indent each paragraph by that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 ; number of spaces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 ;;; But do not refill paragraphs with an @refill command that are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 ;;; preceded by @noindent or are part of a table, list, or deffn.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 (defvar texinfo-paragraph-indent "asis"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 "Number of spaces for @refill to indent a paragraph; else to leave as is.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 (put 'paragraphindent 'texinfo-format 'texinfo-paragraphindent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (defun texinfo-paragraphindent ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 "Specify the number of spaces for @refill to indent a paragraph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 Default is to leave the number of spaces as is."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 (let ((arg (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 (if (string= "asis" arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 (setq texinfo-paragraph-indent "asis")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 (setq texinfo-paragraph-indent (string-to-int arg)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 (put 'refill 'texinfo-format 'texinfo-format-refill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 (defun texinfo-format-refill ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 "Refill paragraph. Also, indent first line as set by @paragraphindent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 Default is to leave paragraph indentation as is."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 (forward-paragraph -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 (if (looking-at "[ \t\n]*$") (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 ;; Do not indent if an entry in a list, table, or deffn,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 ;; or if paragraph is preceded by @noindent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 ;; Otherwise, indent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 ;; delete a @noindent line and do not indent paragraph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 ((save-excursion (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 (looking-at "^@noindent"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 (delete-region (point) (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 ;; do nothing if "asis"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 ((equal texinfo-paragraph-indent "asis"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 ;; do no indenting in list, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 ((> texinfo-stack-depth 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 ;; otherwise delete existing whitespace and indent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 (delete-region (point) (progn (skip-chars-forward " \t") (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 (insert (make-string texinfo-paragraph-indent ? ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 (forward-paragraph 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 ;; Do not fill a section title line with asterisks, hyphens, etc. that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 ;; are used to underline it. This could occur if the line following
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 ;; the underlining is not an index entry and has text within it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 ;; XEmacs change: the standard 3.6 paragraph separators cause
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 ;; texinfmt to fail on vm.texi so we continue to use the older version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 (let* ((previous-paragraph-separate paragraph-separate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 (paragraph-separate (concat paragraph-separate "\\|^[=*---.]+"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 (previous-paragraph-start paragraph-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 (paragraph-start (concat paragraph-start "\\|^[=*---.]+")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 (fill-paragraph nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 (setq paragraph-separate previous-paragraph-separate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 (setq paragraph-start previous-paragraph-start))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 (put 'noindent 'texinfo-format 'texinfo-noindent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 (defun texinfo-noindent ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 (forward-paragraph 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 (if (search-backward "@refill"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 (save-excursion (forward-line -1) (point)) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 () ; leave @noindent command so @refill command knows not to indent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 ;; else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 (texinfo-discard-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 ;;; Index generation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 (put 'vindex 'texinfo-format 'texinfo-format-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 (defun texinfo-format-vindex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 (texinfo-index 'texinfo-vindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 (put 'cindex 'texinfo-format 'texinfo-format-cindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 (defun texinfo-format-cindex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 (texinfo-index 'texinfo-cindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 (put 'findex 'texinfo-format 'texinfo-format-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 (defun texinfo-format-findex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 (texinfo-index 'texinfo-findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 (put 'pindex 'texinfo-format 'texinfo-format-pindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 (defun texinfo-format-pindex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 (texinfo-index 'texinfo-pindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 (put 'tindex 'texinfo-format 'texinfo-format-tindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 (defun texinfo-format-tindex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 (texinfo-index 'texinfo-tindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 (put 'kindex 'texinfo-format 'texinfo-format-kindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 (defun texinfo-format-kindex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 (texinfo-index 'texinfo-kindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 (defun texinfo-index (indexvar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 (let ((arg (texinfo-parse-expanded-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 (set indexvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 (cons (list arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 ;; Region formatting may not provide last node position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 (if texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 (1+ (count-lines texinfo-last-node-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 (symbol-value indexvar)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 (defconst texinfo-indexvar-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 '(("cp" . texinfo-cindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 ("fn" . texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 ("vr" . texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 ("tp" . texinfo-tindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 ("pg" . texinfo-pindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 ("ky" . texinfo-kindex)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 ;;; @defindex @defcodeindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 (put 'defindex 'texinfo-format 'texinfo-format-defindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 (put 'defcodeindex 'texinfo-format 'texinfo-format-defindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 (defun texinfo-format-defindex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 (let* ((index-name (texinfo-parse-arg-discard)) ; eg: `aa'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 (indexing-command (intern (concat index-name "index")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 (index-formatting-command ; eg: `texinfo-format-aaindex'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 (intern (concat "texinfo-format-" index-name "index")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992 (index-alist-name ; eg: `texinfo-aaindex'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 (intern (concat "texinfo-" index-name "index"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 (set index-alist-name nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 (put indexing-command ; eg, aaindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 'texinfo-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 index-formatting-command) ; eg, texinfo-format-aaindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 ;; eg: "aa" . texinfo-aaindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 (or (assoc index-name texinfo-indexvar-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 (setq texinfo-indexvar-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 (cons index-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 index-alist-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 texinfo-indexvar-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 (fset index-formatting-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 (list 'lambda 'nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 (list 'texinfo-index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 (list 'quote index-alist-name))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 ;;; @synindex @syncodeindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 (put 'synindex 'texinfo-format 'texinfo-format-synindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 (put 'syncodeindex 'texinfo-format 'texinfo-format-synindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 (defun texinfo-format-synindex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 (let* ((args (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 (second (cdr (read-from-string args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 (joiner (symbol-name (car (read-from-string args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 (joined (symbol-name (car (read-from-string args second)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 (if (assoc joiner texinfo-short-index-cmds-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 (put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 (cdr (assoc joiner texinfo-short-index-cmds-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 'texinfo-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 (or (cdr (assoc joined texinfo-short-index-format-cmds-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 (intern (concat "texinfo-format-" joined "index"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 (put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 (intern (concat joiner "index"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 'texinfo-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 (or (cdr(assoc joined texinfo-short-index-format-cmds-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 (intern (concat "texinfo-format-" joined "index")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 (defconst texinfo-short-index-cmds-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 '(("cp" . cindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 ("fn" . findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 ("vr" . vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 ("tp" . tindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 ("pg" . pindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 ("ky" . kindex)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 (defconst texinfo-short-index-format-cmds-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 '(("cp" . texinfo-format-cindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 ("fn" . texinfo-format-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 ("vr" . texinfo-format-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 ("tp" . texinfo-format-tindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 ("pg" . texinfo-format-pindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 ("ky" . texinfo-format-kindex)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 ;;; Sort and index (for VMS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 ;; Sort an index which is in the current buffer between START and END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 ;; Used on VMS, where the `sort' utility is not available.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 (defun texinfo-sort-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 (require 'sort)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 (narrow-to-region start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 (sort-subr nil 'forward-line 'end-of-line 'texinfo-sort-startkeyfun)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 ;; Subroutine for sorting an index.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 ;; At start of a line, return a string to sort the line under.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 (defun texinfo-sort-startkeyfun ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 (let ((line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 (buffer-substring (point) (save-excursion (end-of-line) (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 ;; Canonicalize whitespace and eliminate funny chars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 (while (string-match "[ \t][ \t]+\\|[^a-z0-9 ]+" line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 (setq line (concat (substring line 0 (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 (substring line (match-end 0) (length line)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 ;;; @printindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 (put 'printindex 'texinfo-format 'texinfo-format-printindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 (defun texinfo-format-printindex ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 (let ((indexelts (symbol-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084 (cdr (assoc (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 texinfo-indexvar-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 (insert "\n* Menu:\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 (setq opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 (texinfo-print-index nil indexelts)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 (if (eq system-type 'vax-vms)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 (texinfo-sort-region opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 (shell-command-on-region opoint (point) "sort -fd" 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 (defun texinfo-print-index (file indexelts)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 (while indexelts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 (if (stringp (car (car indexelts)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 (insert "* " (car (car indexelts)) ": " )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 (indent-to 32)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 (if file (concat "(" file ")") "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 (nth 1 (car indexelts)) ".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 (indent-to 54)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 (if (nth 2 (car indexelts))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 (format " %d." (nth 2 (car indexelts)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 ;; index entries from @include'd file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111 (texinfo-print-index (nth 1 (car indexelts))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 (nth 2 (car indexelts))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 (setq indexelts (cdr indexelts))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 ;;; Glyphs: @equiv, @error, etc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 ;; @equiv to show that two expressions are equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 ;; @error to show an error message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120 ;; @expansion to show what a macro expands to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 ;; @point to show the location of point in an example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122 ;; @print to show what an evaluated expression prints
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 ;; @result to indicate the value returned by an expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 (put 'equiv 'texinfo-format 'texinfo-format-equiv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 (defun texinfo-format-equiv ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 (insert "=="))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130 (put 'error 'texinfo-format 'texinfo-format-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 (defun texinfo-format-error ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133 (insert "error-->"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 (put 'expansion 'texinfo-format 'texinfo-format-expansion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136 (defun texinfo-format-expansion ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 (insert "==>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140 (put 'point 'texinfo-format 'texinfo-format-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 (defun texinfo-format-point ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143 (insert "-!-"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145 (put 'print 'texinfo-format 'texinfo-format-print)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 (defun texinfo-format-print ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 (insert "-|"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 (put 'result 'texinfo-format 'texinfo-format-result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 (defun texinfo-format-result ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 (texinfo-parse-arg-discard)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 (insert "=>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156 ;;; Definition formatting: @deffn, @defun, etc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158 ;; What definition formatting produces:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160 ;; @deffn category name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161 ;; In Info, `Category: name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162 ;; In index: name: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164 ;; @defvr category name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165 ;; In Info, `Category: name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 ;; In index: name: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 ;; @deftp category name attributes...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169 ;; `category name attributes...' Note: @deftp args in lower case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 ;; In index: name: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2172 ;; Specialized function-like or variable-like entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2173 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174 ;; @defun, @defmac, @defspec, @defvar, @defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 ;; @defun name args In Info, `Function: name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177 ;; @defmac name args In Info, `Macro: name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178 ;; @defvar name In Info, `Variable: name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2179 ;; etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2180 ;; In index: name: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2181 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2182 ;; Generalized typed-function-like or typed-variable-like entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2183 ;; @deftypefn category data-type name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184 ;; In Info, `Category: data-type name args...'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2185 ;; @deftypevr category data-type name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2186 ;; In Info, `Category: data-type name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2187 ;; In index: name: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2188 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189 ;; Specialized typed-function-like or typed-variable-like entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2190 ;; @deftypefun data-type name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 ;; In Info, `Function: data-type name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2192 ;; In index: name: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2194 ;; @deftypevar data-type name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2195 ;; In Info, `Variable: data-type name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196 ;; In index: name: node. line#. but include args after name!?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198 ;; Generalized object oriented entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2199 ;; @defop category class name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2200 ;; In Info, `Category on class: name ARG'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2201 ;; In index: name on class: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2202 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2203 ;; @defcv category class name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2204 ;; In Info, `Category of class: name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2205 ;; In index: name of class: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2206 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2207 ;; Specialized object oriented entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2208 ;; @defmethod class name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209 ;; In Info, `Method on class: name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210 ;; In index: name on class: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2211 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2212 ;; @defivar class name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2213 ;; In Info, `Instance variable of class: name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214 ;; In index: name of class: node. line#.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 ;;; The definition formatting functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2219 (defun texinfo-format-defun ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2220 (texinfo-push-stack 'defun nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221 (setq fill-column (- fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222 (texinfo-format-defun-1 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224 (defun texinfo-end-defun ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 (setq fill-column (+ fill-column 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227 (let ((start (nth 1 (texinfo-pop-stack 'defun))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228 (texinfo-do-itemize start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229 ;; Delete extra newline inserted after header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 (delete-char -1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 (defun texinfo-format-defunx ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235 (texinfo-format-defun-1 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237 (defun texinfo-format-defun-1 (first-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2238 (let ((parse-args (texinfo-format-parse-defun-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2239 (texinfo-defun-type (get texinfo-command-name 'texinfo-defun-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 (texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241 ;; Delete extra newline inserted after previous header line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242 (if (not first-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 (delete-char -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244 (funcall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 (get texinfo-command-name 'texinfo-deffn-formatting-property) parse-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 ;; Insert extra newline so that paragraph filling does not mess
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247 ;; with header line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 (insert "\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 (rplaca (cdr (cdr (car texinfo-stack))) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250 (funcall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 (get texinfo-command-name 'texinfo-defun-indexing-property) parse-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253 ;;; Formatting the first line of a definition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255 ;; @deffn, @defvr, @deftp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 (put 'deffn 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 (put 'deffnx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258 (put 'defvr 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 (put 'defvrx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 (put 'deftp 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 (put 'deftpx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262 (defun texinfo-format-deffn (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 ;; Generalized function-like, variable-like, or generic data-type entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264 ;; @deffn category name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265 ;; In Info, `Category: name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266 ;; @deftp category name attributes...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 ;; `category name attributes...' Note: @deftp args in lower case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2268 (let ((category (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 (name (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270 (args (cdr (cdr parsed-args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 (insert " -- " category ": " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2272 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273 (insert " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274 (if (or (= ?& (aref (car args) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2275 (eq (eval (car texinfo-defun-type)) 'deftp-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2276 (car args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2277 (upcase (car args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2278 (setq args (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280 ;; @defun, @defmac, @defspec, @defvar, @defopt: Specialized, simple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281 (put 'defun 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 (put 'defunx 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285 (put 'defmac 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 (put 'defmacx 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 (put 'defspec 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 (put 'defspecx 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 (put 'defvar 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 (put 'defvarx 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 (put 'defopt 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 (put 'defoptx 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 'texinfo-format-specialized-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 (defun texinfo-format-specialized-defun (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 ;; Specialized function-like or variable-like entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 ;; @defun name args In Info, `Function: Name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 ;; @defmac name args In Info, `Macro: Name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 ;; @defvar name In Info, `Variable: Name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306 ;; Use cdr of texinfo-defun-type to determine category:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 (let ((category (car (cdr texinfo-defun-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 (name (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 (args (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 (insert " -- " category ": " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312 (insert " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313 (if (= ?& (aref (car args) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2314 (car args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2315 (upcase (car args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316 (setq args (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318 ;; @deftypefn, @deftypevr: Generalized typed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2319 (put 'deftypefn 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2320 (put 'deftypefnx 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2321 (put 'deftypevr 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2322 (put 'deftypevrx 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2323 (defun texinfo-format-deftypefn (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2324 ;; Generalized typed-function-like or typed-variable-like entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2325 ;; @deftypefn category data-type name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2326 ;; In Info, `Category: data-type name args...'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2327 ;; @deftypevr category data-type name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2328 ;; In Info, `Category: data-type name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2329 ;; Note: args in lower case, unless modified in command line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2330 (let ((category (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2331 (data-type (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2332 (name (car (cdr (cdr parsed-args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2333 (args (cdr (cdr (cdr parsed-args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2334 (insert " -- " category ": " data-type " " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2335 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2336 (insert " " (car args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2337 (setq args (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2339 ;; @deftypefun, @deftypevar: Specialized typed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2340 (put 'deftypefun 'texinfo-deffn-formatting-property 'texinfo-format-deftypefun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2341 (put 'deftypefunx 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2342 'texinfo-format-deftypefun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2343 (put 'deftypevar 'texinfo-deffn-formatting-property 'texinfo-format-deftypefun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2344 (put 'deftypevarx 'texinfo-deffn-formatting-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2345 'texinfo-format-deftypefun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2346 (defun texinfo-format-deftypefun (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2347 ;; Specialized typed-function-like or typed-variable-like entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2348 ;; @deftypefun data-type name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2349 ;; In Info, `Function: data-type name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2350 ;; @deftypevar data-type name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2351 ;; In Info, `Variable: data-type name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 ;; Note: args in lower case, unless modified in command line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353 ;; Use cdr of texinfo-defun-type to determine category:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 (let ((category (car (cdr texinfo-defun-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 (data-type (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2356 (name (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 (args (cdr (cdr parsed-args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2358 (insert " -- " category ": " data-type " " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2359 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360 (insert " " (car args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 (setq args (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 ;; @defop: Generalized object-oriented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364 (put 'defop 'texinfo-deffn-formatting-property 'texinfo-format-defop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2365 (put 'defopx 'texinfo-deffn-formatting-property 'texinfo-format-defop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366 (defun texinfo-format-defop (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 ;; Generalized object oriented entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368 ;; @defop category class name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 ;; In Info, `Category on class: name ARG'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370 ;; Note: args in upper case; use of `on'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2371 (let ((category (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2372 (class (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2373 (name (car (cdr (cdr parsed-args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374 (args (cdr (cdr (cdr parsed-args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 (insert " -- " category " on " class ": " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377 (insert " " (upcase (car args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 (setq args (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380 ;; @defcv: Generalized object-oriented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381 (put 'defcv 'texinfo-deffn-formatting-property 'texinfo-format-defcv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382 (put 'defcvx 'texinfo-deffn-formatting-property 'texinfo-format-defcv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383 (defun texinfo-format-defcv (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384 ;; Generalized object oriented entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385 ;; @defcv category class name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2386 ;; In Info, `Category of class: name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387 ;; Note: args in upper case; use of `of'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388 (let ((category (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389 (class (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390 (name (car (cdr (cdr parsed-args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2391 (args (cdr (cdr (cdr parsed-args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392 (insert " -- " category " of " class ": " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2394 (insert " " (upcase (car args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395 (setq args (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 ;; @defmethod: Specialized object-oriented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2398 (put 'defmethod 'texinfo-deffn-formatting-property 'texinfo-format-defmethod)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399 (put 'defmethodx 'texinfo-deffn-formatting-property 'texinfo-format-defmethod)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400 (defun texinfo-format-defmethod (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 ;; Specialized object oriented entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402 ;; @defmethod class name args...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 ;; In Info, `Method on class: name ARGS'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404 ;; Note: args in upper case; use of `on'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405 ;; Use cdr of texinfo-defun-type to determine category:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406 (let ((category (car (cdr texinfo-defun-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 (class (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408 (name (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 (args (cdr (cdr parsed-args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410 (insert " -- " category " on " class ": " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412 (insert " " (upcase (car args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413 (setq args (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415 ;; @defivar: Specialized object-oriented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416 (put 'defivar 'texinfo-deffn-formatting-property 'texinfo-format-defivar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 (put 'defivarx 'texinfo-deffn-formatting-property 'texinfo-format-defivar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418 (defun texinfo-format-defivar (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419 ;; Specialized object oriented entity:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420 ;; @defivar class name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 ;; In Info, `Instance variable of class: name'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 ;; Note: args in upper case; use of `of'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 ;; Use cdr of texinfo-defun-type to determine category:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424 (let ((category (car (cdr texinfo-defun-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 (class (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426 (name (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2427 (args (cdr (cdr parsed-args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428 (insert " -- " category " of " class ": " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 (insert " " (upcase (car args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431 (setq args (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434 ;;; Indexing for definitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 ;; An index entry has three parts: the `entry proper', the node name, and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2437 ;; line number. Depending on the which command is used, the entry is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2438 ;; formatted differently:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2439 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 ;; @defun,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 ;; @defmac,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442 ;; @defspec,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443 ;; @defvar,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444 ;; @defopt all use their 1st argument as the entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446 ;; @deffn,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2447 ;; @defvr,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2448 ;; @deftp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2449 ;; @deftypefun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2450 ;; @deftypevar all use their 2nd argument as the entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2451 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2452 ;; @deftypefn,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2453 ;; @deftypevr both use their 3rd argument as the entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2454 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2455 ;; @defmethod uses its 2nd and 1st arguments as an entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2456 ;; formatted: NAME on CLASS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458 ;; @defop uses its 3rd and 2nd arguments as an entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459 ;; formatted: NAME on CLASS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461 ;; @defivar uses its 2nd and 1st arguments as an entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2462 ;; formatted: NAME of CLASS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464 ;; @defcv uses its 3rd and 2nd argument as an entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2465 ;; formatted: NAME of CLASS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467 (put 'defun 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 (put 'defunx 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2469 (put 'defmac 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 (put 'defmacx 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2471 (put 'defspec 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2472 (put 'defspecx 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2473 (put 'defvar 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2474 (put 'defvarx 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2475 (put 'defopt 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2476 (put 'defoptx 'texinfo-defun-indexing-property 'texinfo-index-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477 (defun texinfo-index-defun (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478 ;; use 1st parsed-arg as entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 ;; `index-list' will be texinfo-findex or the like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481 (set index-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 ;; Three elements: entry-proper, node-name, line-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2484 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485 (car parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2487 ;; Region formatting may not provide last node position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488 (if texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 (1+ (count-lines texinfo-last-node-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 (symbol-value index-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 (put 'deffn 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 (put 'deffnx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495 (put 'defvr 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496 (put 'defvrx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2497 (put 'deftp 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498 (put 'deftpx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2499 (put 'deftypefun 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500 (put 'deftypefunx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501 (put 'deftypevar 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 (put 'deftypevarx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2503 (defun texinfo-index-deffn (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 ;; use 2nd parsed-arg as entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505 ;; `index-list' will be texinfo-findex or the like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2506 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507 (set index-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509 ;; Three elements: entry-proper, node-name, line-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2511 (car (cdr parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2512 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2513 ;; Region formatting may not provide last node position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2514 (if texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2515 (1+ (count-lines texinfo-last-node-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2516 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2517 (symbol-value index-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2519 (put 'deftypefn 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2520 (put 'deftypefnx 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2521 (put 'deftypevr 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2522 (put 'deftypevrx 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2523 (defun texinfo-index-deftypefn (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2524 ;; use 3rd parsed-arg as entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2525 ;; `index-list' will be texinfo-findex or the like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2526 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2527 (set index-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2528 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2529 ;; Three elements: entry-proper, node-name, line-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2530 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2531 (car (cdr (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2532 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2533 ;; Region formatting may not provide last node position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2534 (if texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2535 (1+ (count-lines texinfo-last-node-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2536 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2537 (symbol-value index-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2539 (put 'defmethod 'texinfo-defun-indexing-property 'texinfo-index-defmethod)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2540 (put 'defmethodx 'texinfo-defun-indexing-property 'texinfo-index-defmethod)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2541 (defun texinfo-index-defmethod (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2542 ;; use 2nd on 1st parsed-arg as entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2543 ;; `index-list' will be texinfo-findex or the like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2544 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2545 (set index-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2546 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2547 ;; Three elements: entry-proper, node-name, line-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2548 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2549 (format "%s on %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2550 (car (cdr parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2551 (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2552 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2553 ;; Region formatting may not provide last node position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2554 (if texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2555 (1+ (count-lines texinfo-last-node-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2556 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2557 (symbol-value index-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2559 (put 'defop 'texinfo-defun-indexing-property 'texinfo-index-defop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2560 (put 'defopx 'texinfo-defun-indexing-property 'texinfo-index-defop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2561 (defun texinfo-index-defop (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2562 ;; use 3rd on 2nd parsed-arg as entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2563 ;; `index-list' will be texinfo-findex or the like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2564 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2565 (set index-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2566 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2567 ;; Three elements: entry-proper, node-name, line-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2568 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2569 (format "%s on %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2570 (car (cdr (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2571 (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2572 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2573 ;; Region formatting may not provide last node position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2574 (if texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2575 (1+ (count-lines texinfo-last-node-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2576 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2577 (symbol-value index-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2579 (put 'defivar 'texinfo-defun-indexing-property 'texinfo-index-defivar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2580 (put 'defivarx 'texinfo-defun-indexing-property 'texinfo-index-defivar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2581 (defun texinfo-index-defivar (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2582 ;; use 2nd of 1st parsed-arg as entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2583 ;; `index-list' will be texinfo-findex or the like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2584 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2585 (set index-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2586 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2587 ;; Three elements: entry-proper, node-name, line-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2588 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2589 (format "%s of %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2590 (car (cdr parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2591 (car parsed-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2592 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2593 ;; Region formatting may not provide last node position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2594 (if texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2595 (1+ (count-lines texinfo-last-node-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2596 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2597 (symbol-value index-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2598
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2599 (put 'defcv 'texinfo-defun-indexing-property 'texinfo-index-defcv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2600 (put 'defcvx 'texinfo-defun-indexing-property 'texinfo-index-defcv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2601 (defun texinfo-index-defcv (parsed-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2602 ;; use 3rd of 2nd parsed-arg as entry-proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2603 ;; `index-list' will be texinfo-findex or the like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2604 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2605 (set index-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2606 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2607 ;; Three elements: entry-proper, node-name, line-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2608 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2609 (format "%s of %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2610 (car (cdr (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2611 (car (cdr parsed-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2612 texinfo-last-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2613 ;; Region formatting may not provide last node position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2614 (if texinfo-last-node-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2615 (1+ (count-lines texinfo-last-node-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2616 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2617 (symbol-value index-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2619
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2620 ;;; Properties for definitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2622 ;; Each definition command has six properties:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2623 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2624 ;; 1. texinfo-deffn-formatting-property to format definition line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2625 ;; 2. texinfo-defun-indexing-property to create index entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2626 ;; 3. texinfo-format formatting command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2627 ;; 4. texinfo-end end formatting command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2628 ;; 5. texinfo-defun-type type of deffn to format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2629 ;; 6. texinfo-defun-index type of index to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2630 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2631 ;; The `x' forms of each definition command are used for the second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2632 ;; and subsequent header lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2634 ;; The texinfo-deffn-formatting-property and texinfo-defun-indexing-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2635 ;; are listed just before the appropriate formatting and indexing commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2636
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2637 (put 'deffn 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2638 (put 'deffnx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2639 (put 'deffn 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2640 (put 'deffn 'texinfo-defun-type '('deffn-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2641 (put 'deffnx 'texinfo-defun-type '('deffn-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2642 (put 'deffn 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2643 (put 'deffnx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2645 (put 'defun 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2646 (put 'defunx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2647 (put 'defun 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2648 (put 'defun 'texinfo-defun-type '('defun-type "Function"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2649 (put 'defunx 'texinfo-defun-type '('defun-type "Function"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2650 (put 'defun 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2651 (put 'defunx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2652
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2653 (put 'defmac 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2654 (put 'defmacx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2655 (put 'defmac 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2656 (put 'defmac 'texinfo-defun-type '('defun-type "Macro"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2657 (put 'defmacx 'texinfo-defun-type '('defun-type "Macro"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2658 (put 'defmac 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2659 (put 'defmacx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2661 (put 'defspec 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2662 (put 'defspecx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2663 (put 'defspec 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2664 (put 'defspec 'texinfo-defun-type '('defun-type "Special form"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2665 (put 'defspecx 'texinfo-defun-type '('defun-type "Special form"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2666 (put 'defspec 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2667 (put 'defspecx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2669 (put 'defvr 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2670 (put 'defvrx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2671 (put 'defvr 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2672 (put 'defvr 'texinfo-defun-type '('deffn-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2673 (put 'defvrx 'texinfo-defun-type '('deffn-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2674 (put 'defvr 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2675 (put 'defvrx 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2677 (put 'defvar 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2678 (put 'defvarx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2679 (put 'defvar 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2680 (put 'defvar 'texinfo-defun-type '('defun-type "Variable"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2681 (put 'defvarx 'texinfo-defun-type '('defun-type "Variable"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2682 (put 'defvar 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2683 (put 'defvarx 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2685 (put 'defconst 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2686 (put 'defconstx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2687 (put 'defconst 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2688 (put 'defconst 'texinfo-defun-type '('defun-type "Constant"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2689 (put 'defconstx 'texinfo-defun-type '('defun-type "Constant"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2690 (put 'defconst 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2691 (put 'defconstx 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2693 (put 'defcmd 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2694 (put 'defcmdx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2695 (put 'defcmd 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2696 (put 'defcmd 'texinfo-defun-type '('defun-type "Command"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2697 (put 'defcmdx 'texinfo-defun-type '('defun-type "Command"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2698 (put 'defcmd 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2699 (put 'defcmdx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2700
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2701 (put 'defopt 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2702 (put 'defoptx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2703 (put 'defopt 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2704 (put 'defopt 'texinfo-defun-type '('defun-type "User Option"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2705 (put 'defoptx 'texinfo-defun-type '('defun-type "User Option"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2706 (put 'defopt 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2707 (put 'defoptx 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2709 (put 'deftp 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2710 (put 'deftpx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2711 (put 'deftp 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2712 (put 'deftp 'texinfo-defun-type '('deftp-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2713 (put 'deftpx 'texinfo-defun-type '('deftp-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2714 (put 'deftp 'texinfo-defun-index 'texinfo-tindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2715 (put 'deftpx 'texinfo-defun-index 'texinfo-tindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2717 ;;; Object-oriented stuff is a little hairier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2718
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2719 (put 'defop 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2720 (put 'defopx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2721 (put 'defop 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2722 (put 'defop 'texinfo-defun-type '('defop-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2723 (put 'defopx 'texinfo-defun-type '('defop-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2724 (put 'defop 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2725 (put 'defopx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2727 (put 'defmethod 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2728 (put 'defmethodx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2729 (put 'defmethod 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2730 (put 'defmethod 'texinfo-defun-type '('defmethod-type "Method"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2731 (put 'defmethodx 'texinfo-defun-type '('defmethod-type "Method"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2732 (put 'defmethod 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2733 (put 'defmethodx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2735 (put 'defcv 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2736 (put 'defcvx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2737 (put 'defcv 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2738 (put 'defcv 'texinfo-defun-type '('defop-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2739 (put 'defcvx 'texinfo-defun-type '('defop-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2740 (put 'defcv 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2741 (put 'defcvx 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2742
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2743 (put 'defivar 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2744 (put 'defivarx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2745 (put 'defivar 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2746 (put 'defivar 'texinfo-defun-type '('defmethod-type "Instance variable"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2747 (put 'defivarx 'texinfo-defun-type '('defmethod-type "Instance variable"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2748 (put 'defivar 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2749 (put 'defivarx 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2750
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2751 ;;; Typed functions and variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2753 (put 'deftypefn 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2754 (put 'deftypefnx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2755 (put 'deftypefn 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2756 (put 'deftypefn 'texinfo-defun-type '('deftypefn-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2757 (put 'deftypefnx 'texinfo-defun-type '('deftypefn-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2758 (put 'deftypefn 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2759 (put 'deftypefnx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2761 (put 'deftypefun 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2762 (put 'deftypefunx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2763 (put 'deftypefun 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2764 (put 'deftypefun 'texinfo-defun-type '('deftypefun-type "Function"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2765 (put 'deftypefunx 'texinfo-defun-type '('deftypefun-type "Function"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2766 (put 'deftypefun 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2767 (put 'deftypefunx 'texinfo-defun-index 'texinfo-findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2768
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2769 (put 'deftypevr 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2770 (put 'deftypevrx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2771 (put 'deftypevr 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2772 (put 'deftypevr 'texinfo-defun-type '('deftypefn-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2773 (put 'deftypevrx 'texinfo-defun-type '('deftypefn-type nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2774 (put 'deftypevr 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2775 (put 'deftypevrx 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2777 (put 'deftypevar 'texinfo-format 'texinfo-format-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2778 (put 'deftypevarx 'texinfo-format 'texinfo-format-defunx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2779 (put 'deftypevar 'texinfo-end 'texinfo-end-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2780 (put 'deftypevar 'texinfo-defun-type '('deftypevar-type "Variable"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2781 (put 'deftypevarx 'texinfo-defun-type '('deftypevar-type "Variable"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2782 (put 'deftypevar 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2783 (put 'deftypevarx 'texinfo-defun-index 'texinfo-vindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2786 ;;; @set, @clear, @ifset, @ifclear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2788 ;; If a flag is set with @set FLAG, then text between @ifset and @end
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2789 ;; ifset is formatted normally, but if the flag is cleared with
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2790 ;; @clear FLAG, then the text is not formatted; it is ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2791
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2792 ;; If a flag is cleared with @clear FLAG, then text between @ifclear
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2793 ;; and @end ifclear is formatted normally, but if the flag is set with
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2794 ;; @set FLAG, then the text is not formatted; it is ignored. @ifclear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2795 ;; is the opposite of @ifset.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2797 ;; If a flag is set to a string with @set FLAG,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2798 ;; replace @value{FLAG} with the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2799 ;; If a flag with a value is cleared,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2800 ;; @value{FLAG} is invalid,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2801 ;; as if there had never been any @set FLAG previously.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2803 (put 'clear 'texinfo-format 'texinfo-clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2804 (defun texinfo-clear ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2805 "Clear the value of the flag."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2806 (let* ((arg (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2807 (flag (car (read-from-string arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2808 (value (substring arg (cdr (read-from-string arg)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2809 (put flag 'texinfo-whether-setp 'flag-cleared)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2810 (put flag 'texinfo-set-value "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2811
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2812 (put 'set 'texinfo-format 'texinfo-set)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2813 (defun texinfo-set ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2814 "Set the value of the flag, optionally to a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2815 The command `@set foo This is a string.'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2816 sets flag foo to the value: `This is a string.'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2817 The command `@value{foo}' expands to the value."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2818 (let* ((arg (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2819 (flag (car (read-from-string arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2820 (value (substring arg (cdr (read-from-string arg)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2821 (put flag 'texinfo-whether-setp 'flag-set)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2822 (put flag 'texinfo-set-value value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2824 (put 'value 'texinfo-format 'texinfo-value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2825 (defun texinfo-value ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2826 "Insert the string to which the flag is set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2827 The command `@set foo This is a string.'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2828 sets flag foo to the value: `This is a string.'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2829 The command `@value{foo}' expands to the value."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2830 (let ((arg (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2831 (cond ((and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2832 (eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2833 'flag-set)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2834 (get (car (read-from-string arg)) 'texinfo-set-value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2835 (insert (get (car (read-from-string arg)) 'texinfo-set-value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2836 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2837 'flag-cleared)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2838 (insert (format "{No value for \"%s\"}" arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2839 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2840 (insert (format "{No value for \"%s\"}" arg))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2842 (put 'ifset 'texinfo-end 'texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2843 (put 'ifset 'texinfo-format 'texinfo-if-set)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2844 (defun texinfo-if-set ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2845 "If set, continue formatting; else do not format region up to @end ifset"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2846 (let ((arg (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2847 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2848 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2849 'flag-set)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2850 ;; Format the text (i.e., do not remove it); do nothing here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2851 ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2852 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2853 'flag-cleared)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2854 ;; Clear region (i.e., cause the text to be ignored).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2855 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2856 (progn (re-search-forward "@end ifset[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2857 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2858 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2859 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2860 ;; In this case flag is neither set nor cleared.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2861 ;; Act as if set, i.e. do nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2862 ()))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2863
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2864 (put 'ifclear 'texinfo-end 'texinfo-discard-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2865 (put 'ifclear 'texinfo-format 'texinfo-if-clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2866 (defun texinfo-if-clear ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2867 "If clear, continue formatting; if set, do not format up to @end ifset"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2868 (let ((arg (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2869 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2870 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2871 'flag-set)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2872 ;; Clear region (i.e., cause the text to be ignored).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2873 (delete-region texinfo-command-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2874 (progn (re-search-forward "@end ifclear[ \t]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2875 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2876 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2877 'flag-cleared)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2878 ;; Format the text (i.e., do not remove it); do nothing here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2879 ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2880 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2881 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2882 ;; In this case flag is neither set nor cleared.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2883 ;; Act as if clear, i.e. do nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2884 ()))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2885
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2887 ;;; Process included files: `@include' command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2888
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2889 ;; Updated 19 October 1990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2890 ;; In the original version, include files were ignored by Info but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2891 ;; incorporated in to the printed manual. To make references to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2892 ;; included file, the Texinfo source file has to refer to the included
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2893 ;; files using the `(filename)nodename' format for referring to other
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2894 ;; Info files. Also, the included files had to be formatted on their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2895 ;; own. It was just like they were another file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2896
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2897 ;; Currently, include files are inserted into the buffer that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2898 ;; formatted for Info. If large, the resulting info file is split and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2899 ;; tagified. For current include files to work, the master menu must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2900 ;; refer to all the nodes, and the highest level nodes in the include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2901 ;; files must have the correct next, prev, and up pointers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2903 ;; The included file may have an @setfilename and even an @settitle,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2904 ;; but not an `\input texinfo' line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2905
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2906 ;; Updated 24 March 1993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2907 ;; In order for @raisesections and @lowersections to work, included
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2908 ;; files must be inserted into the buffer holding the outer file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2909 ;; before other Info formatting takes place. So @include is no longer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2910 ;; is treated like other @-commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2911 (put 'include 'texinfo-format 'texinfo-format-noop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2913 ; Original definition:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2914 ; (defun texinfo-format-include ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2915 ; (let ((filename (texinfo-parse-arg-discard))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2916 ; (default-directory input-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2917 ; subindex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2918 ; (setq subindex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2919 ; (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2920 ; (progn (find-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2921 ; (cond ((file-readable-p (concat filename ".texinfo"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2922 ; (concat filename ".texinfo"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2923 ; ((file-readable-p (concat filename ".texi"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2924 ; (concat filename ".texi"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2925 ; ((file-readable-p (concat filename ".tex"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2926 ; (concat filename ".tex"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2927 ; ((file-readable-p filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 ; filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929 ; (t (error "@include'd file %s not found"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 ; filename))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931 ; (texinfo-format-buffer-1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932 ; (texinfo-subindex 'texinfo-vindex (car subindex) (nth 1 subindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2933 ; (texinfo-subindex 'texinfo-findex (car subindex) (nth 2 subindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934 ; (texinfo-subindex 'texinfo-cindex (car subindex) (nth 3 subindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 ; (texinfo-subindex 'texinfo-pindex (car subindex) (nth 4 subindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 ; (texinfo-subindex 'texinfo-tindex (car subindex) (nth 5 subindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2937 ; (texinfo-subindex 'texinfo-kindex (car subindex) (nth 6 subindex))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2938 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2939 ;(defun texinfo-subindex (indexvar file content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2940 ; (set indexvar (cons (list 'recurse file content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2941 ; (symbol-value indexvar))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2943 ; Second definition:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2944 ; (put 'include 'texinfo-format 'texinfo-format-include)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2945 ; (defun texinfo-format-include ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2946 ; (let ((filename (concat input-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2947 ; (texinfo-parse-arg-discard)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2948 ; (default-directory input-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2949 ; (message "Reading: %s" filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2950 ; (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2951 ; (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2952 ; (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2953 ; (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2954 ; (+ (point) (car (cdr (insert-file-contents filename)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2955 ; (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2956 ; (texinfo-append-refill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2957 ; (texinfo-format-convert (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2958 ; (setq last-input-buffer input-buffer) ; to bypass setfilename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2959 ; ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2960
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2961
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2962 ;;; Numerous commands do nothing in Texinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2963
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2964 ;; These commands are defined in texinfo.tex for printed output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2966 (put 'bye 'texinfo-format 'texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2967 (put 'c 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2968 (put 'comment 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2969 (put 'contents 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2970 (put 'finalout 'texinfo-format 'texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2971 (put 'group 'texinfo-end 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2972 (put 'group 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2973 (put 'headings 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2974 (put 'hsize 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2975 (put 'itemindent 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2976 (put 'lispnarrowing 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2977 (put 'need 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2978 (put 'nopara 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2979 (put 'page 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2980 (put 'parindent 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2981 (put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2982 (put 'setq 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2983 (put 'settitle 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2984 (put 'setx 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2985 (put 'shortcontents 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2986 (put 'smallbook 'texinfo-format 'texinfo-discard-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2987 (put 'summarycontents 'texinfo-format 'texinfo-discard-line-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2989
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2990 ;;; Some commands cannot be handled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2992 (defun texinfo-unsupported ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2993 (error "%s is not handled by texinfo"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2994 (buffer-substring texinfo-command-start texinfo-command-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2996 ;;; Batch formatting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2997
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2998 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2999 (defun batch-texinfo-format ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3000 "Runs texinfo-format-buffer on the files remaining on the command line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3001 Must be used only with -batch, and kills emacs on completion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3002 Each file will be processed even if an error occurred previously.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3003 For example, invoke
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3004 \"emacs -batch -funcall batch-texinfo-format $docs/ ~/*.texinfo\"."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3005 (if (not noninteractive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3006 (error "batch-texinfo-format may only be used -batch."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3007 (let ((version-control t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3008 (auto-save-default nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3009 (find-file-run-dired nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3010 (kept-old-versions 259259)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3011 (kept-new-versions 259259))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3012 (let ((error 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3013 file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3014 (files ()))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3015 (while command-line-args-left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3016 (setq file (expand-file-name (car command-line-args-left)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3017 (cond ((not (file-exists-p file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3018 (message ">> %s does not exist!" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3019 (setq error 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3020 command-line-args-left (cdr command-line-args-left)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3021 ((file-directory-p file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3022 (setq command-line-args-left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3023 (nconc (directory-files file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3024 (cdr command-line-args-left))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3025 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3026 (setq files (cons file files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3027 command-line-args-left (cdr command-line-args-left)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3028 (while files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3029 (setq file (car files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3030 files (cdr files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3031 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3032 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3033 (if buffer-file-name (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3034 (find-file file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3035 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3036 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3037 (texinfo-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3038 (message "texinfo formatting %s..." file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3039 (texinfo-format-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3040 (if (buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3041 (progn (message "Saving modified %s" (buffer-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3042 (save-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3043 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3044 (message ">> Error: %s" (prin1-to-string err))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3045 (message ">> point at")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3046 (let ((s (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3047 (min (+ (point) 100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3048 (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3049 (tem 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3050 (while (setq tem (string-match "\n+" s tem))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3051 (setq s (concat (substring s 0 (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3052 "\n>> "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3053 (substring s (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3054 tem (1+ tem)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3055 (message ">> %s" s))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3056 (setq error 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3057 (kill-emacs error))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3060 ;;; Place `provide' at end of file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3061 (provide 'texinfmt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3062
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3063 ;;; texinfmt.el ends here.