annotate lisp/textmodes/texinfmt.el @ 5814:eecc796f374d

Comment changes.
author Richard M. Stallman <rms@gnu.org>
date Mon, 07 Feb 1994 05:01:53 +0000
parents eec34ce70181
children 9217f29851c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1 ;;;; texinfmt.el
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2 ;;; Copyright (C) 1985, 1986, 1988,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3 ;;; 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
5 ;; Maintainer: Robert J. Chassell <bug-texinfo@prep.ai.mit.edu>
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
6
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
7 ;;; This file is part of GNU Emacs.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
8
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
12 ;; any later version.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
13
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
18
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
22
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
23 ;;; Code:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
24
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
25 ;;; Emacs lisp functions to convert Texinfo files to Info files.
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
26
5118
eec34ce70181 (texinfo-if-set, texinfo-if-clear): Act appropriately when flat neither
Robert J. Chassell <bob@rattlesnake.com>
parents: 4982
diff changeset
27 (defvar texinfmt-version "2.32 of 19 November 1993")
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
28
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
29 ;;; Variable definitions
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
30
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
31 (require 'texinfo) ; So `texinfo-footnote-style' is defined.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
32 (require 'texnfo-upd) ; So `texinfo-section-types-regexp' is defined.
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
33
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
34 (defvar texinfo-format-syntax-table nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
35
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
36 (defvar texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
37 (defvar texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
38 (defvar texinfo-cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
39 (defvar texinfo-pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
40 (defvar texinfo-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
41 (defvar texinfo-kindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
42 (defvar texinfo-last-node)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
43 (defvar texinfo-node-names)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
44 (defvar texinfo-enclosure-list)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
45
4868
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
46 (defvar texinfo-command-start)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
47 (defvar texinfo-command-end)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
48 (defvar texinfo-command-name)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
49 (defvar texinfo-defun-type)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
50 (defvar texinfo-last-node-pos)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
51 (defvar texinfo-stack)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
52 (defvar texinfo-short-index-cmds-alist)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
53 (defvar texinfo-short-index-format-cmds-alist)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
54 (defvar texinfo-format-filename)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
55 (defvar texinfo-footnote-number)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
56 (defvar texinfo-start-of-header)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
57 (defvar texinfo-end-of-header)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
58 (defvar texinfo-raisesections-alist)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
59 (defvar texinfo-lowersections-alist)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
60
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
61 ;;; Syntax table
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
62
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
63 (if texinfo-format-syntax-table
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
64 nil
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
65 (setq texinfo-format-syntax-table (make-syntax-table))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
66 (modify-syntax-entry ?\" " " texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
67 (modify-syntax-entry ?\\ " " texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
68 (modify-syntax-entry ?@ "\\" texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
69 (modify-syntax-entry ?\^q "\\" texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
70 (modify-syntax-entry ?\[ "." texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
71 (modify-syntax-entry ?\] "." texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
72 (modify-syntax-entry ?\( "." texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
73 (modify-syntax-entry ?\) "." texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
74 (modify-syntax-entry ?{ "(}" texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
75 (modify-syntax-entry ?} "){" texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
76 (modify-syntax-entry ?\' "." texinfo-format-syntax-table))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
77
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
78
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
79 ;;; Top level buffer and region formatting functions
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
80
4769
d1b5ca8f5493 (texinfo-format-region texinfo-format-buffer): Add ###autoload cookies.
Brian Fox <bfox@gnu.org>
parents: 4396
diff changeset
81 ;;;###autoload
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
82 (defun texinfo-format-buffer (&optional notagify)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
83 "Process the current buffer as texinfo code, into an Info file.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
84 The Info file output is generated in a buffer visiting the Info file
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
85 names specified in the @setfilename command.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
86
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
87 Non-nil argument (prefix, if interactive) means don't make tag table
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
88 and don't split the file if large. You can use Info-tagify and
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
89 Info-split to do these manually."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
90 (interactive "P")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
91 (let ((lastmessage "Formatting Info file..."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
92 (message lastmessage)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
93 (texinfo-format-buffer-1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
94 (if notagify
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
95 nil
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
96 (if (> (buffer-size) 30000)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
97 (progn
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
98 (message (setq lastmessage "Making tags table for Info file..."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
99 (Info-tagify)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
100 (if (> (buffer-size) 100000)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
101 (progn
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
102 (message (setq lastmessage "Splitting Info file..."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
103 (Info-split))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
104 (message (concat lastmessage
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
105 (if (interactive-p) "done. Now save it." "done.")))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
106
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
107 (defvar texinfo-region-buffer-name "*Info Region*"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
108 "*Name of the temporary buffer used by \\[texinfo-format-region].")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
109
4769
d1b5ca8f5493 (texinfo-format-region texinfo-format-buffer): Add ###autoload cookies.
Brian Fox <bfox@gnu.org>
parents: 4396
diff changeset
110 ;;;###autoload
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
111 (defun texinfo-format-region (region-beginning region-end)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
112 "Convert the current region of the Texinfo file to Info format.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
113 This lets you see what that part of the file will look like in Info.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
114 The command is bound to \\[texinfo-format-region]. The text that is
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
115 converted to Info is stored in a temporary buffer."
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
116 (interactive "r")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
117 (message "Converting region to Info format...")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
118 (let (texinfo-command-start
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
119 texinfo-command-end
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
120 texinfo-command-name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
121 texinfo-vindex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
122 texinfo-findex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
123 texinfo-cindex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
124 texinfo-pindex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
125 texinfo-tindex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
126 texinfo-kindex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
127 texinfo-stack
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
128 (texinfo-format-filename "")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
129 texinfo-example-start
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
130 texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
131 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
132 texinfo-node-names
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
133 (texinfo-footnote-number 0)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
134 last-input-buffer
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
135 (fill-column-for-info fill-column)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
136 (input-buffer (current-buffer))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
137 (input-directory default-directory)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
138 (header-text "")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
139 (header-beginning 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
140 (header-end 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
141
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
142 ;;; Copy lines between beginning and end of header lines,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
143 ;;; if any, or else copy the `@setfilename' line, if any.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
144 (save-excursion
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
145 (save-restriction
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
146 (widen)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
147 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
148 (let ((search-end (save-excursion (forward-line 100) (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
149 (if (or
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
150 ;; Either copy header text.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
151 (and
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
152 (prog1
4982
36b78ccd6285 (texinfo-format-region): Change `texinfo-[start
Richard M. Stallman <rms@gnu.org>
parents: 4868
diff changeset
153 (search-forward tex-start-of-header search-end t)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
154 (forward-line 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
155 ;; Mark beginning of header.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
156 (setq header-beginning (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
157 (prog1
4982
36b78ccd6285 (texinfo-format-region): Change `texinfo-[start
Richard M. Stallman <rms@gnu.org>
parents: 4868
diff changeset
158 (search-forward tex-end-of-header nil t)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
159 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
160 ;; Mark end of header
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
161 (setq header-end (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
162 ;; Or copy @filename line.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
163 (prog2
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
164 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
165 (search-forward "@setfilename" search-end t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
166 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
167 (setq header-beginning (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
168 (forward-line 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
169 (setq header-end (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
170
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
171 ;; Copy header
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
172 (setq header-text
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
173 (buffer-substring
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
174 (min header-beginning region-beginning)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
175 header-end))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
176
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
177 ;;; Find a buffer to use.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
178 (switch-to-buffer (get-buffer-create texinfo-region-buffer-name))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
179 (erase-buffer)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
180 ;; Insert the header into the buffer.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
181 (insert header-text)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
182 ;; Insert the region into the buffer.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
183 (insert-buffer-substring
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
184 input-buffer
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
185 (max region-beginning header-end)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
186 region-end)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
187 ;; Make sure region ends in a newline.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
188 (or (= (preceding-char) ?\n)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
189 (insert "\n"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
190
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
191 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
192 (texinfo-mode)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
193 (message "Converting region to Info format...")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
194 (setq fill-column fill-column-for-info)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
195 ;; Install a syntax table useful for scanning command operands.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
196 (set-syntax-table texinfo-format-syntax-table)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
197
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
198 ;; Insert @include files so `texinfo-raise-lower-sections' can
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
199 ;; work on them without losing track of multiple
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
200 ;; @raise/@lowersections commands.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
201 (while (re-search-forward "^@include" nil t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
202 (setq texinfo-command-end (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
203 (let ((filename (concat input-directory
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
204 (texinfo-parse-line-arg))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
205 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
206 (delete-region (point) (save-excursion (forward-line 1) (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
207 (message "Reading included file: %s" filename)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
208 (save-excursion
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
209 (save-restriction
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
210 (narrow-to-region
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
211 (point)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
212 (+ (point) (car (cdr (insert-file-contents filename)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
213 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
214 ;; Remove `@setfilename' line from included file, if any,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
215 ;; so @setfilename command not duplicated.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
216 (if (re-search-forward
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
217 "^@setfilename" (save-excursion (forward-line 100) (point)) t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
218 (progn
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
219 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
220 (delete-region
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
221 (point) (save-excursion (forward-line 1) (point)))))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
222
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
223 ;; Raise or lower level of each section, if necessary.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
224 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
225 (texinfo-raise-lower-sections)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
226 ;; Append @refill to appropriate paragraphs for filling.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
227 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
228 (texinfo-append-refill)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
229 ;; If the region includes the effective end of the data,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
230 ;; discard everything after that.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
231 (goto-char (point-max))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
232 (if (re-search-backward "^@bye" nil t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
233 (delete-region (point) (point-max)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
234 ;; Make sure buffer ends in a newline.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
235 (or (= (preceding-char) ?\n)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
236 (insert "\n"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
237 ;; Don't use a previous value of texinfo-enclosure-list.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
238 (setq texinfo-enclosure-list nil)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
239
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
240 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
241 (if (looking-at "\\\\input[ \t]+texinfo")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
242 (delete-region (point) (save-excursion (forward-line 1) (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
243
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
244 ;; Insert Info region title text.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
245 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
246 (if (search-forward
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
247 "@setfilename" (save-excursion (forward-line 100) (point)) t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
248 (progn
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
249 (setq texinfo-command-end (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
250 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
251 (setq texinfo-command-start (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
252 (let ((arg (texinfo-parse-arg-discard)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
253 (insert " "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
254 texinfo-region-buffer-name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
255 " buffer for: `")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
256 (insert (file-name-nondirectory (expand-file-name arg)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
257 (insert "', -*-Text-*-\n")))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
258 ;; Else no `@setfilename' line
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
259 (insert " "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
260 texinfo-region-buffer-name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
261 " buffer -*-Text-*-\n"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
262 (insert "produced by `texinfo-format-region'\n"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
263 "from a region in: "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
264 (if (buffer-file-name input-buffer)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
265 (concat "`"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
266 (file-name-sans-versions
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
267 (file-name-nondirectory
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
268 (buffer-file-name input-buffer)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
269 "'")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
270 (concat "buffer `" (buffer-name input-buffer) "'"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
271 "\nusing `texinfmt.el' version "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
272 texinfmt-version
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
273 ".\n\n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
274
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
275 ;; Now convert for real.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
276 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
277 (texinfo-format-scan)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
278 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
279
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
280 (message "Done.")))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
281
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
282
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
283 ;;; Primary internal formatting function for the whole buffer.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
284
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
285 (defun texinfo-format-buffer-1 ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
286 (let (texinfo-format-filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
287 texinfo-example-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
288 texinfo-command-start
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
289 texinfo-command-end
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
290 texinfo-command-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
291 texinfo-last-node
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
292 texinfo-last-node-pos
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
293 texinfo-vindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
294 texinfo-findex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
295 texinfo-cindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
296 texinfo-pindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
297 texinfo-tindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
298 texinfo-kindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
299 texinfo-stack
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
300 texinfo-node-names
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
301 (texinfo-footnote-number 0)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
302 last-input-buffer
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
303 outfile
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
304 (fill-column-for-info fill-column)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
305 (input-buffer (current-buffer))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
306 (input-directory default-directory))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
307 (setq texinfo-enclosure-list nil)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
308 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
309 (goto-char (point-min))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
310 (or (search-forward "@setfilename" nil t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
311 (error "Texinfo file needs an `@setfilename FILENAME' line."))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
312 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
313 (setq outfile (texinfo-parse-line-arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
314 (find-file outfile)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
315 (texinfo-mode)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
316 (setq fill-column fill-column-for-info)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
317 (set-syntax-table texinfo-format-syntax-table)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
318 (erase-buffer)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
319 (insert-buffer-substring input-buffer)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
320 (message "Converting %s to Info format..." (buffer-name input-buffer))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
321
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
322 ;; Insert @include files so `texinfo-raise-lower-sections' can
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
323 ;; work on them without losing track of multiple
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
324 ;; @raise/@lowersections commands.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
325 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
326 (while (re-search-forward "^@include" nil t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
327 (setq texinfo-command-end (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
328 (let ((filename (concat input-directory
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
329 (texinfo-parse-line-arg))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
330 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
331 (delete-region (point) (save-excursion (forward-line 1) (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
332 (message "Reading included file: %s" filename)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
333 (save-excursion
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
334 (save-restriction
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
335 (narrow-to-region
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
336 (point)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
337 (+ (point) (car (cdr (insert-file-contents filename)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
338 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
339 ;; Remove `@setfilename' line from included file, if any,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
340 ;; so @setfilename command not duplicated.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
341 (if (re-search-forward
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
342 "^@setfilename"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
343 (save-excursion (forward-line 100) (point)) t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
344 (progn
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
345 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
346 (delete-region
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
347 (point) (save-excursion (forward-line 1) (point)))))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
348 ;; Raise or lower level of each section, if necessary.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
349 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
350 (texinfo-raise-lower-sections)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
351 ;; Append @refill to appropriate paragraphs
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
352 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
353 (texinfo-append-refill)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
354 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
355 (search-forward "@setfilename")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
356 (beginning-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
357 (delete-region (point-min) (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
358 ;; Remove @bye at end of file, if it is there.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
359 (goto-char (point-max))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
360 (if (search-backward "@bye" nil t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
361 (delete-region (point) (point-max)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
362 ;; Make sure buffer ends in a newline.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
363 (or (= (preceding-char) ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
364 (insert "\n"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
365 ;; Scan the whole buffer, converting to Info format.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
366 (texinfo-format-scan)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
367 ;; Return data for indices.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
368 (goto-char (point-min))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
369 (list outfile
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
370 texinfo-vindex texinfo-findex texinfo-cindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
371 texinfo-pindex texinfo-tindex texinfo-kindex)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
372
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
373
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
374 ;;; Perform non-@-command file conversions: quotes and hyphens
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
375
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
376 (defun texinfo-format-convert (min max)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
377 ;; Convert left and right quotes to typewriter font quotes.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
378 (goto-char min)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
379 (while (search-forward "``" max t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
380 (replace-match "\""))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
381 (goto-char min)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
382 (while (search-forward "''" max t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
383 (replace-match "\""))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
384 ;; Convert three hyphens in a row to two.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
385 (goto-char min)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
386 (while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\)" max t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
387 (delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
388 2)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
389
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
390
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
391 ;;; Handle paragraph filling
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
392
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
393 (defvar texinfo-no-refill-regexp
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
394 "^@\\(example\\|smallexample\\|lisp\\|smalllisp\\|display\\|format\\|flushleft\\|flushright\\|menu\\|titlepage\\|iftex\\|tex\\)"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
395 "Regexp specifying environments in which paragraphs are not filled.")
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
396
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
397 (defvar texinfo-part-of-para-regexp
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
398 "^@\\(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{\\)"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
399 "Regexp specifying @-commands found within paragraphs.")
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
400
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
401 (defun texinfo-append-refill ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
402 "Append @refill at end of each paragraph that should be filled.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
403 Do not append @refill to paragraphs within @example and similar environments.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
404 Do not append @refill to paragraphs containing @w{TEXT} or @*."
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
405
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
406 ;; It is necessary to append @refill before other processing because
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
407 ;; the other processing removes information that tells Texinfo
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
408 ;; whether the text should or should not be filled.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
409
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
410 (while (< (point) (point-max))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
411 (let ((refill-blank-lines "^[ \t\n]*$")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
412 (case-fold-search nil)) ; Don't confuse @TeX and @tex....
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
413 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
414 ;; 1. Skip over blank lines;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
415 ;; skip over lines beginning with @-commands,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
416 ;; but do not skip over lines
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
417 ;; that are no-refill environments such as @example or
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
418 ;; that begin with within-paragraph @-commands such as @code.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
419 (while (and (looking-at (concat "^@\\|^\\\\\\|" refill-blank-lines))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
420 (not (looking-at
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
421 (concat
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
422 "\\("
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
423 texinfo-no-refill-regexp
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
424 "\\|"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
425 texinfo-part-of-para-regexp
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
426 "\\)")))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
427 (< (point) (point-max)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
428 (forward-line 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
429 ;; 2. Skip over @example and similar no-refill environments.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
430 (if (looking-at texinfo-no-refill-regexp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
431 (let ((environment
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
432 (buffer-substring (match-beginning 1) (match-end 1))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
433 (progn (re-search-forward (concat "^@end " environment) nil t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
434 (forward-line 1)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
435 ;; 3. Do not refill a paragraph containing @w or @*
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
436 (if (or
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
437 (>= (point) (point-max))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
438 (re-search-forward
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
439 "@w{\\|@\\*" (save-excursion (forward-paragraph) (point)) t))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
440 ;; Go to end of paragraph and do nothing.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
441 (forward-paragraph)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
442 ;; 4. Else go to end of paragraph and insert @refill
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
443 (forward-paragraph)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
444 (forward-line -1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
445 (end-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
446 (delete-region
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
447 (point)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
448 (save-excursion (skip-chars-backward " \t") (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
449 ;; `looking-at-backward' not available in v. 18.57
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
450 ;; (if (not (looking-at-backward "@refill\\|@bye")) ;)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
451 (if (not (re-search-backward
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
452 "@refill\\|@bye"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
453 (save-excursion (beginning-of-line) (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
454 t))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
455 (insert "@refill"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
456 (forward-line 1))))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
457
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
458
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
459 ;;; Handle `@raisesections' and `@lowersections' commands
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
460
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
461 ;; These commands change the hierarchical level of chapter structuring
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
462 ;; commands.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
463 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
464 ;; @raisesections changes @subsection to @section,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
465 ;; @section to @chapter,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
466 ;; etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
467 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
468 ;; @lowersections changes @chapter to @section
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
469 ;; @subsection to @subsubsection,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
470 ;; etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
471 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
472 ;; An @raisesections/@lowersections command changes only those
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
473 ;; structuring commands that follow the @raisesections/@lowersections
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
474 ;; command.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
475 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
476 ;; Repeated @raisesections/@lowersections continue to raise or lower
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
477 ;; the heading level.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
478 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
479 ;; An @lowersections command cancels an @raisesections command, and
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
480 ;; vice versa.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
481 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
482 ;; You cannot raise or lower "beyond" chapters or subsubsections, but
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
483 ;; trying to do so does not elicit an error---you just get more
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
484 ;; headings that mean the same thing as you keep raising or lowering
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
485 ;; (for example, after a single @raisesections, both @chapter and
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
486 ;; @section produce chapter headings).
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
487
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
488 (defun texinfo-raise-lower-sections ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
489 "Raise or lower the hierarchical level of chapters, sections, etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
490
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
491 This function acts according to `@raisesections' and `@lowersections'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
492 commands in the Texinfo file.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
493
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
494 For example, an `@lowersections' command is useful if you wish to
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
495 include what is written as an outer or standalone Texinfo file in
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
496 another Texinfo file as an inner, included file. The `@lowersections'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
497 command changes chapters to sections, sections to subsections and so
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
498 on.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
499
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
500 @raisesections changes @subsection to @section,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
501 @section to @chapter,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
502 @heading to @chapheading,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
503 etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
504
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
505 @lowersections changes @chapter to @section,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
506 @subsection to @subsubsection,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
507 @heading to @subheading,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
508 etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
509
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
510 An `@raisesections' or `@lowersections' command changes only those
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
511 structuring commands that follow the `@raisesections' or
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
512 `@lowersections' command.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
513
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
514 An `@lowersections' command cancels an `@raisesections' command, and
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
515 vice versa.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
516
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
517 Repeated use of the commands continue to raise or lower the hierarchical
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
518 level a step at a time.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
519
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
520 An attempt to raise above `chapters' reproduces chapter commands; an
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
521 attempt to lower below subsubsections reproduces subsubsection
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
522 commands."
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
523
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
524 ;; `texinfo-section-types-regexp' is defined in `texnfo-upd.el';
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
525 ;; it is a regexp matching chapter, section, other headings
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
526 ;; (but not the top node).
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
527
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
528 (let (type (level 0))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
529 (while
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
530 (re-search-forward
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
531 (concat
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
532 "\\(\\(^@\\(raise\\|lower\\)sections\\)\\|\\("
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
533 texinfo-section-types-regexp
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
534 "\\)\\)")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
535 nil t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
536 (beginning-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
537 (save-excursion (setq type (read (current-buffer))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
538 (cond
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
539
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
540 ;; 1. Increment level
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
541 ((eq type '@raisesections)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
542 (setq level (1+ level))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
543 (delete-region
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
544 (point) (save-excursion (forward-line 1) (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
545
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
546 ;; 2. Decrement level
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
547 ((eq type '@lowersections)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
548 (setq level (1- level))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
549 (delete-region
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
550 (point) (save-excursion (forward-line 1) (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
551
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
552 ;; Now handle structuring commands
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
553 ((cond
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
554
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
555 ;; 3. Raise level when positive
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
556 ((> level 0)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
557 (let ((count level)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
558 (new-level type))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
559 (while (> count 0)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
560 (setq new-level
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
561 (cdr (assq new-level texinfo-raisesections-alist)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
562 (setq count (1- count)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
563 (kill-word 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
564 (insert (symbol-name new-level))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
565
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
566 ;; 4. Do nothing except move point when level is zero
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
567 ((= level 0) (forward-line 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
568
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
569 ;; 5. Lower level when positive
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
570 ((< level 0)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
571 (let ((count level)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
572 (new-level type))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
573 (while (< count 0)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
574 (setq new-level
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
575 (cdr (assq new-level texinfo-lowersections-alist)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
576 (setq count (1+ count)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
577 (kill-word 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
578 (insert (symbol-name new-level))))))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
579
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
580 (defvar texinfo-raisesections-alist
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
581 '((@chapter . @chapter) ; Cannot go higher
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
582 (@unnumbered . @unnumbered)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
583
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
584 (@majorheading . @majorheading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
585 (@chapheading . @chapheading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
586 (@appendix . @appendix)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
587
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
588 (@section . @chapter)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
589 (@unnumberedsec . @unnumbered)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
590 (@heading . @chapheading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
591 (@appendixsec . @appendix)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
592
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
593 (@subsection . @section)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
594 (@unnumberedsubsec . @unnumberedsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
595 (@subheading . @heading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
596 (@appendixsubsec . @appendixsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
597
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
598 (@subsubsection . @subsection)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
599 (@unnumberedsubsubsec . @unnumberedsubsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
600 (@subsubheading . @subheading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
601 (@appendixsubsubsec . @appendixsubsec))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
602 "*An alist of next higher levels for chapters, sections. etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
603 For example, section to chapter, subsection to section.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
604 Used by `texinfo-raise-lower-sections'.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
605 The keys specify types of section; the values correspond to the next
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
606 higher types.")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
607
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
608 (defvar texinfo-lowersections-alist
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
609 '((@chapter . @section)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
610 (@unnumbered . @unnumberedsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
611 (@majorheading . @heading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
612 (@chapheading . @heading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
613 (@appendix . @appendixsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
614
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
615 (@section . @subsection)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
616 (@unnumberedsec . @unnumberedsubsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
617 (@heading . @subheading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
618 (@appendixsec . @appendixsubsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
619
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
620 (@subsection . @subsubsection)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
621 (@unnumberedsubsec . @unnumberedsubsubsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
622 (@subheading . @subsubheading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
623 (@appendixsubsec . @appendixsubsubsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
624
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
625 (@subsubsection . @subsubsection) ; Cannot go lower.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
626 (@unnumberedsubsubsec . @unnumberedsubsubsec)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
627 (@subsubheading . @subsubheading)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
628 (@appendixsubsubsec . @appendixsubsubsec))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
629 "*An alist of next lower levels for chapters, sections. etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
630 For example, chapter to section, section to subsection.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
631 Used by `texinfo-raise-lower-sections'.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
632 The keys specify types of section; the values correspond to the next
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
633 lower types.")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
634
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
635
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
636 ;;; Perform those texinfo-to-info conversions that apply to the whole input
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
637 ;;; uniformly.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
638
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
639 (defun texinfo-format-scan ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
640 (texinfo-format-convert (point-min) (point-max))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
641 ;; Scan for @-commands.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
642 (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
643 (while (search-forward "@" nil t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
644 (if (looking-at "[@{}'` *]")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
645 ;; Handle a few special @-followed-by-one-char commands.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
646 (if (= (following-char) ?*)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
647 (progn
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
648 ;; remove command
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
649 (delete-region (1- (point)) (1+ (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
650 ;; insert return if not at end of line;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
651 ;; else line is already broken.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
652 (if (not (= (following-char) ?\n))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
653 (insert ?\n)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
654 ;; The other characters are simply quoted. Delete the @.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
655 (delete-char -1)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
656 (forward-char 1))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
657 ;; @ is followed by a command-word; find the end of the word.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
658 (setq texinfo-command-start (1- (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
659 (if (= (char-syntax (following-char)) ?w)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
660 (forward-word 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
661 (forward-char 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
662 (setq texinfo-command-end (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
663 ;; Call the handler for this command.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
664 (setq texinfo-command-name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
665 (intern (buffer-substring
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
666 (1+ texinfo-command-start) texinfo-command-end)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
667 (let ((enclosure-type
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
668 (assoc
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
669 (symbol-name texinfo-command-name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
670 texinfo-enclosure-list)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
671 (if enclosure-type
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
672 (progn
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
673 (insert
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
674 (car (car (cdr enclosure-type)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
675 (texinfo-parse-arg-discard)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
676 (car (cdr (car (cdr enclosure-type)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
677 (goto-char texinfo-command-start))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
678 (let ((cmd (get texinfo-command-name 'texinfo-format)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
679 (if cmd (funcall cmd) (texinfo-unsupported)))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
680
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
681 (cond (texinfo-stack
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
682 (goto-char (nth 2 (car texinfo-stack)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
683 (error "Unterminated @%s" (car (car texinfo-stack))))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
684
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
685 (put 'begin 'texinfo-format 'texinfo-format-begin)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
686 (defun texinfo-format-begin ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
687 (texinfo-format-begin-end 'texinfo-format))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
688
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
689 (put 'end 'texinfo-format 'texinfo-format-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
690 (defun texinfo-format-end ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
691 (texinfo-format-begin-end 'texinfo-end))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
692
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
693 (defun texinfo-format-begin-end (prop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
694 (setq texinfo-command-name (intern (texinfo-parse-line-arg)))
4868
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
695 (let ((cmd (get texinfo-command-name prop)))
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
696 (if cmd (funcall cmd)
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
697 (texinfo-unsupported))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
698
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
699 ;;; Parsing functions
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
700
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
701 (defun texinfo-parse-line-arg ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
702 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
703 (let ((start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
704 (cond ((looking-at " ")
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
705 (skip-chars-forward " ")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
706 (setq start (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
707 (end-of-line)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
708 (skip-chars-backward " ")
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
709 (delete-region (point) (progn (end-of-line) (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
710 (setq texinfo-command-end (1+ (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
711 ((looking-at "{")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
712 (setq start (1+ (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
713 (forward-list 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
714 (setq texinfo-command-end (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
715 (forward-char -1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
716 (t
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
717 (error "Invalid texinfo command arg format")))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
718 (prog1 (buffer-substring start (point))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
719 (if (eolp) (forward-char 1)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
720
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
721 (defun texinfo-parse-expanded-arg ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
722 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
723 (let ((start (point))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
724 marker)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
725 (cond ((looking-at " ")
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
726 (skip-chars-forward " ")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
727 (setq start (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
728 (end-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
729 (setq texinfo-command-end (1+ (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
730 ((looking-at "{")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
731 (setq start (1+ (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
732 (forward-list 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
733 (setq texinfo-command-end (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
734 (forward-char -1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
735 (t
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
736 (error "Invalid texinfo command arg format")))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
737 (setq marker (move-marker (make-marker) texinfo-command-end))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
738 (texinfo-format-expand-region start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
739 (setq texinfo-command-end (marker-position marker))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
740 (move-marker marker nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
741 (prog1 (buffer-substring start (point))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
742 (if (eolp) (forward-char 1)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
743
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
744 (defun texinfo-format-expand-region (start end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
745 (save-restriction
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
746 (narrow-to-region start end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
747 (let (texinfo-command-start
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
748 texinfo-command-end
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
749 texinfo-command-name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
750 texinfo-stack)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
751 (texinfo-format-scan))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
752 (goto-char (point-max))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
753
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
754 (defun texinfo-parse-arg-discard ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
755 (prog1 (texinfo-parse-line-arg)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
756 (texinfo-discard-command)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
757
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
758 (defun texinfo-discard-command ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
759 (delete-region texinfo-command-start texinfo-command-end))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
760
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
761 (defun texinfo-optional-braces-discard ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
762 "Discard braces following command, if any."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
763 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
764 (let ((start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
765 (cond ((looking-at "[ \t]*\n")) ; do nothing
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
766 ((looking-at "{") ; remove braces, if any
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
767 (forward-list 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
768 (setq texinfo-command-end (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
769 (t
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
770 (error
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
771 "Invalid `texinfo-optional-braces-discard' format \(need braces?\)")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
772 (delete-region texinfo-command-start texinfo-command-end)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
773
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
774 (defun texinfo-format-parse-line-args ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
775 (let ((start (1- (point)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
776 next beg end
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
777 args)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
778 (skip-chars-forward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
779 (while (not (eolp))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
780 (setq beg (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
781 (re-search-forward "[\n,]")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
782 (setq next (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
783 (if (bolp) (setq next (1- next)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
784 (forward-char -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
785 (skip-chars-backward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
786 (setq end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
787 (setq args (cons (if (> end beg) (buffer-substring beg end))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
788 args))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
789 (goto-char next)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
790 (skip-chars-forward " "))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
791 (if (eolp) (forward-char 1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
792 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
793 (nreverse args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
794
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
795 (defun texinfo-format-parse-args ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
796 (let ((start (1- (point)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
797 next beg end
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
798 args)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
799 (search-forward "{")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
800 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
801 (texinfo-format-expand-region
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
802 (point)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
803 (save-excursion (up-list 1) (1- (point)))))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
804 ;; The following does not handle cross references of the form:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
805 ;; `@xref{bullet, , @code{@@bullet}@{@}}.' because the
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
806 ;; re-search-forward finds the first right brace after the second
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
807 ;; comma.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
808 (while (/= (preceding-char) ?\})
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
809 (skip-chars-forward " \t\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
810 (setq beg (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
811 (re-search-forward "[},]")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
812 (setq next (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
813 (forward-char -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
814 (skip-chars-backward " \t\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
815 (setq end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
816 (cond ((< beg end)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
817 (goto-char beg)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
818 (while (search-forward "\n" end t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
819 (replace-match " "))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
820 (setq args (cons (if (> end beg) (buffer-substring beg end))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
821 args))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
822 (goto-char next))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
823 (if (eolp) (forward-char 1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
824 (setq texinfo-command-end (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
825 (nreverse args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
826
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
827 (defun texinfo-format-parse-defun-args ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
828 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
829 (let ((start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
830 (end-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
831 (setq texinfo-command-end (1+ (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
832 (let ((marker (move-marker (make-marker) texinfo-command-end)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
833 (texinfo-format-expand-region start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
834 (setq texinfo-command-end (marker-position marker))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
835 (move-marker marker nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
836 (goto-char start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
837 (let ((args '())
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
838 beg end)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
839 (skip-chars-forward " ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
840 (while (not (eolp))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
841 (cond ((looking-at "{")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
842 (setq beg (1+ (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
843 (forward-list 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
844 (setq end (1- (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
845 (t
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
846 (setq beg (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
847 (re-search-forward "[\n ]")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
848 (forward-char -1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
849 (setq end (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
850 (setq args (cons (buffer-substring beg end) args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
851 (skip-chars-forward " "))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
852 (forward-char 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
853 (nreverse args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
854
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
855 (defun texinfo-discard-line ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
856 (goto-char texinfo-command-end)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
857 (skip-chars-forward " \t")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
858 (or (eolp)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
859 (error "Extraneous text at end of command line."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
860 (goto-char texinfo-command-start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
861 (or (bolp)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
862 (error "Extraneous text at beginning of command line."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
863 (delete-region (point) (progn (forward-line 1) (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
864
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
865 (defun texinfo-discard-line-with-args ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
866 (goto-char texinfo-command-start)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
867 (delete-region (point) (progn (forward-line 1) (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
868
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
869
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
870 ;;; @setfilename
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
871
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
872 ;; Only `texinfo-format-buffer' handles @setfilename with this
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
873 ;; definition; `texinfo-format-region' handles @setfilename, if any,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
874 ;; specially.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
875 (put 'setfilename 'texinfo-format 'texinfo-format-setfilename)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
876 (defun texinfo-format-setfilename ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
877 (let ((arg (texinfo-parse-arg-discard)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
878 (message "Formatting Info file: %s" arg)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
879 (setq texinfo-format-filename
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
880 (file-name-nondirectory (expand-file-name arg)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
881 (insert "Info file: "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
882 texinfo-format-filename ", -*-Text-*-\n"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
883 ;; Date string removed so that regression testing is easier.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
884 ;; "produced on "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
885 ;; (substring (current-time-string) 8 10) " "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
886 ;; (substring (current-time-string) 4 7) " "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
887 ;; (substring (current-time-string) -4) " "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
888 "produced by `texinfo-format-buffer'\n"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
889 "from file"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
890 (if (buffer-file-name input-buffer)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
891 (concat " `"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
892 (file-name-sans-versions
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
893 (file-name-nondirectory
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
894 (buffer-file-name input-buffer)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
895 "'")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
896 (concat "buffer `" (buffer-name input-buffer) "'"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
897 "\nusing `texinfmt.el' version "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
898 texinfmt-version
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
899 ".\n\n")))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
900
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
901 ;;; @node, @menu
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
902
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
903 (put 'node 'texinfo-format 'texinfo-format-node)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
904 (put 'nwnode 'texinfo-format 'texinfo-format-node)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
905 (defun texinfo-format-node ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
906 (let* ((args (texinfo-format-parse-line-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
907 (name (nth 0 args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
908 (next (nth 1 args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
909 (prev (nth 2 args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
910 (up (nth 3 args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
911 (texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
912 (setq texinfo-last-node name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
913 (let ((tem (downcase name)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
914 (if (assoc tem texinfo-node-names)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
915 (error "Duplicate node name: %s" name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
916 (setq texinfo-node-names (cons (list tem) texinfo-node-names))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
917 (setq texinfo-footnote-number 0)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
918 (or (bolp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
919 (insert ?\n))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
920 (insert "\^_\nFile: " texinfo-format-filename
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
921 ", Node: " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
922 (if next
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
923 (insert ", Next: " next))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
924 (if prev
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
925 (insert ", Prev: " prev))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
926 (if up
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
927 (insert ", Up: " up))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
928 (insert ?\n)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
929 (setq texinfo-last-node-pos (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
930
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
931 (put 'menu 'texinfo-format 'texinfo-format-menu)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
932 (defun texinfo-format-menu ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
933 (texinfo-discard-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
934 (insert "* Menu:\n\n"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
935
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
936 (put 'menu 'texinfo-end 'texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
937
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
938
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
939 ;;; Cross references
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
940
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
941 ; @xref {NODE, FNAME, NAME, FILE, DOCUMENT}
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
942 ; -> *Note FNAME: (FILE)NODE
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
943 ; If FILE is missing,
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
944 ; *Note FNAME: NODE
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
945 ; If FNAME is empty and NAME is present
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
946 ; *Note NAME: Node
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
947 ; If both NAME and FNAME are missing
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
948 ; *Note NODE::
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
949 ; texinfo ignores the DOCUMENT argument.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
950 ; -> See section <xref to NODE> [NAME, else NODE], page <xref to NODE>
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
951 ; If FILE is specified, (FILE)NODE is used for xrefs.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
952 ; If fifth argument DOCUMENT is specified, produces
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
953 ; See section <xref to NODE> [NAME, else NODE], page <xref to NODE>
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
954 ; of DOCUMENT
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
955
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
956 ; @ref a reference that does not put `See' or `see' in
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
957 ; the hardcopy and is the same as @xref in Info
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
958 (put 'ref 'texinfo-format 'texinfo-format-xref)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
959
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
960 (put 'xref 'texinfo-format 'texinfo-format-xref)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
961 (defun texinfo-format-xref ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
962 (let ((args (texinfo-format-parse-args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
963 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
964 (insert "*Note ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
965 (let ((fname (or (nth 1 args) (nth 2 args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
966 (if (null (or fname (nth 3 args)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
967 (insert (car args) "::")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
968 (insert (or fname (car args)) ": ")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
969 (if (nth 3 args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
970 (insert "(" (nth 3 args) ")"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
971 (insert (car args))))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
972
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
973 (put 'pxref 'texinfo-format 'texinfo-format-pxref)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
974 (defun texinfo-format-pxref ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
975 (texinfo-format-xref)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
976 (or (save-excursion
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
977 (forward-char -2)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
978 (looking-at "::"))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
979 (insert ".")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
980
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
981 ;@inforef{NODE, FNAME, FILE}
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
982 ;Like @xref{NODE, FNAME,,FILE} in texinfo.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
983 ;In Tex, generates "See Info file FILE, node NODE"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
984 (put 'inforef 'texinfo-format 'texinfo-format-inforef)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
985 (defun texinfo-format-inforef ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
986 (let ((args (texinfo-format-parse-args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
987 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
988 (if (nth 1 args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
989 (insert "*Note " (nth 1 args) ": (" (nth 2 args) ")" (car args))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
990 (insert "*Note " "(" (nth 2 args) ")" (car args) "::"))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
991
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
992
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
993 ;;; Section headings
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
994
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
995 (put 'majorheading 'texinfo-format 'texinfo-format-chapter)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
996 (put 'chapheading 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
997 (put 'ichapter 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
998 (put 'chapter 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
999 (put 'iappendix 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1000 (put 'appendix 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1001 (put 'iunnumbered 'texinfo-format 'texinfo-format-chapter)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1002 (put 'top 'texinfo-format 'texinfo-format-chapter)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1003 (put 'unnumbered 'texinfo-format 'texinfo-format-chapter)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1004 (defun texinfo-format-chapter ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1005 (texinfo-format-chapter-1 ?*))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1006
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1007 (put 'heading 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1008 (put 'isection 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1009 (put 'section 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1010 (put 'iappendixsection 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1011 (put 'appendixsection 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1012 (put 'iappendixsec 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1013 (put 'appendixsec 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1014 (put 'iunnumberedsec 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1015 (put 'unnumberedsec 'texinfo-format 'texinfo-format-section)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1016 (defun texinfo-format-section ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1017 (texinfo-format-chapter-1 ?=))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1018
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1019 (put 'subheading 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1020 (put 'isubsection 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1021 (put 'subsection 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1022 (put 'iappendixsubsec 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1023 (put 'appendixsubsec 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1024 (put 'iunnumberedsubsec 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1025 (put 'unnumberedsubsec 'texinfo-format 'texinfo-format-subsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1026 (defun texinfo-format-subsection ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1027 (texinfo-format-chapter-1 ?-))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1028
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1029 (put 'subsubheading 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1030 (put 'isubsubsection 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1031 (put 'subsubsection 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1032 (put 'iappendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1033 (put 'appendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1034 (put 'iunnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1035 (put 'unnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1036 (defun texinfo-format-subsubsection ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1037 (texinfo-format-chapter-1 ?.))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1038
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1039 (defun texinfo-format-chapter-1 (belowchar)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1040 (let ((arg (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1041 (message "Formatting: %s ... " arg) ; So we can see where we are.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1042 (insert ?\n arg ?\n "@SectionPAD " belowchar ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1043 (forward-line -2)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1044
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1045 (put 'SectionPAD 'texinfo-format 'texinfo-format-sectionpad)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1046 (defun texinfo-format-sectionpad ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1047 (let ((str (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1048 (forward-char -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1049 (let ((column (current-column)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1050 (forward-char 1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1051 (while (> column 0)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1052 (insert str)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1053 (setq column (1- column))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1054 (insert ?\n)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1055
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1056
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1057 ;;; Space controling commands: @. and @:
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1058 (put '\. 'texinfo-format 'texinfo-format-\.)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1059 (defun texinfo-format-\. ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1060 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1061 (insert "."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1062
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1063 (put '\: 'texinfo-format 'texinfo-format-\:)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1064 (defun texinfo-format-\: ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1065 (texinfo-discard-command))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1066
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1067
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1068 ;;; @center, @sp, and @br
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1069
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1070 (put 'center 'texinfo-format 'texinfo-format-center)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1071 (defun texinfo-format-center ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1072 (let ((arg (texinfo-parse-expanded-arg)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1073 (texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1074 (insert arg)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1075 (insert ?\n)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1076 (save-restriction
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1077 (goto-char (1- (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1078 (let ((indent-tabs-mode nil))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1079 (center-line)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1080
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1081 (put 'sp 'texinfo-format 'texinfo-format-sp)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1082 (defun texinfo-format-sp ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1083 (let* ((arg (texinfo-parse-arg-discard))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1084 (num (read arg)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1085 (insert-char ?\n num)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1086
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1087 (put 'br 'texinfo-format 'texinfo-format-paragraph-break)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1088 (defun texinfo-format-paragraph-break ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1089 "Force a paragraph break.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1090 If used within a line, follow `@br' with braces."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1091 (texinfo-optional-braces-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1092 ;; insert one return if at end of line;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1093 ;; else insert two returns, to generate a blank line.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1094 (if (= (following-char) ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1095 (insert ?\n)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1096 (insert-char ?\n 2)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1097
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1098
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1099 ;;; @footnote and @footnotestyle
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1100
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1101 ; In Texinfo, footnotes are created with the `@footnote' command.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1102 ; This command is followed immediately by a left brace, then by the text of
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1103 ; the footnote, and then by a terminating right brace. The
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1104 ; template for a footnote is:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1105 ;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1106 ; @footnote{TEXT}
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1107 ;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1108 ; Info has two footnote styles:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1109 ;
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1110 ; * In the End of node style, all the footnotes for a single node
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1111 ; are placed at the end of that node. The footnotes are
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1112 ; separated from the rest of the node by a line of dashes with
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1113 ; the word `Footnotes' within it.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1114 ;
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1115 ; * In the Separate node style, all the footnotes for a single node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1116 ; are placed in an automatically constructed node of their own.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1117
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1118 ; Footnote style is specified by the @footnotestyle command, either
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1119 ; @footnotestyle separate
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1120 ; or
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1121 ; @footnotestyle end
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1122 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1123 ; The default is separate
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1124
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1125 (defvar texinfo-footnote-style "separate"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1126 "Footnote style, either separate or end.")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1127
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1128 (put 'footnotestyle 'texinfo-format 'texinfo-footnotestyle)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1129 (defun texinfo-footnotestyle ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1130 "Specify whether footnotes are at end of node or in separate nodes.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1131 Argument is either end or separate."
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1132 (setq texinfo-footnote-style (texinfo-parse-arg-discard)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1133
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1134 (defvar texinfo-footnote-number)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1135
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1136 (put 'footnote 'texinfo-format 'texinfo-format-footnote)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1137 (defun texinfo-format-footnote ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1138 "Format a footnote in either end of node or separate node style.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1139 The texinfo-footnote-style variable controls which style is used."
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1140 (setq texinfo-footnote-number (1+ texinfo-footnote-number))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1141 (cond ((string= texinfo-footnote-style "end")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1142 (texinfo-format-end-node))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1143 ((string= texinfo-footnote-style "separate")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1144 (texinfo-format-separate-node))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1145
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1146 (defun texinfo-format-separate-node ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1147 "Format footnote in Separate node style, with notes in own node.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1148 The node is constructed automatically."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1149 (let* (start
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1150 (arg (texinfo-parse-line-arg))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1151 (node-name-beginning
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1152 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1153 (re-search-backward
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1154 "^File: \\w+\\(\\w\\|\\s_\\|\\.\\|,\\)*[ \t]+Node:")
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1155 (match-end 0)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1156 (node-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1157 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1158 (buffer-substring
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1159 (progn (goto-char node-name-beginning) ; skip over node command
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1160 (skip-chars-forward " \t") ; and over spaces
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1161 (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1162 (if (search-forward
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1163 ","
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1164 (save-excursion (end-of-line) (point)) t) ; bound search
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1165 (1- (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1166 (end-of-line) (point))))))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1167 (texinfo-discard-command) ; remove or insert whitespace, as needed
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1168 (delete-region (save-excursion (skip-chars-backward " \t\n") (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1169 (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1170 (insert (format " (%d) (*Note %s-Footnotes::)"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1171 texinfo-footnote-number node-name))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1172 (fill-paragraph nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1173 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1174 (if (re-search-forward "^@node" nil 'move)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1175 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1176
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1177 ;; two cases: for the first footnote, we must insert a node header;
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1178 ;; for the second and subsequent footnotes, we need only insert
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1179 ;; the text of the footnote.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1180
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1181 (if (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1182 (re-search-backward
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1183 (concat node-name "-Footnotes, Up: ")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1184 node-name-beginning
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1185 t))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1186 (progn ; already at least one footnote
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1187 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1188 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1189 (fill-region start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1190 ;; else not yet a footnote
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1191 (insert "\n\^_\nFile: " texinfo-format-filename
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1192 " Node: " node-name "-Footnotes, Up: " node-name "\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1193 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1194 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1195 (fill-region start (point))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1196
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1197 (defun texinfo-format-end-node ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1198 "Format footnote in the End of node style, with notes at end of node."
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1199 (let (start
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1200 (arg (texinfo-parse-line-arg)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1201 (texinfo-discard-command) ; remove or insert whitespace, as needed
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1202 (delete-region (save-excursion (skip-chars-backward " \t\n") (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1203 (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1204 (insert (format " (%d) " texinfo-footnote-number))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1205 (fill-paragraph nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1206 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1207 (if (search-forward "\n--------- Footnotes ---------\n" nil t)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1208 (progn ; already have footnote, put new one before end of node
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1209 (if (re-search-forward "^@node" nil 'move)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1210 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1211 (setq start (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1212 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1213 (fill-region start (point)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1214 ;; else no prior footnote
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1215 (if (re-search-forward "^@node" nil 'move)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1216 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1217 (insert "\n--------- Footnotes ---------\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1218 (setq start (point))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1219 (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1220
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1221
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1222 ;;; @itemize, @enumerate, and similar commands
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1223
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1224 ;; @itemize pushes (itemize "COMMANDS" STARTPOS) on texinfo-stack.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1225 ;; @enumerate pushes (enumerate 0 STARTPOS).
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1226 ;; @item dispatches to the texinfo-item prop of the first elt of the list.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1227 ;; For itemize, this puts in and rescans the COMMANDS.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1228 ;; For enumerate, this increments the number and puts it in.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1229 ;; In either case, it puts a Backspace at the front of the line
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1230 ;; which marks it not to be indented later.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1231 ;; All other lines get indented by 5 when the @end is reached.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1232
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1233 (defvar texinfo-stack-depth 0
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1234 "Count of number of unpopped texinfo-push-stack calls.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1235 Used by @refill indenting command to avoid indenting within lists, etc.")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1236
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1237 (defun texinfo-push-stack (check arg)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1238 (setq texinfo-stack-depth (1+ texinfo-stack-depth))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1239 (setq texinfo-stack
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1240 (cons (list check arg texinfo-command-start)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1241 texinfo-stack)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1242
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1243 (defun texinfo-pop-stack (check)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1244 (setq texinfo-stack-depth (1- texinfo-stack-depth))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1245 (if (null texinfo-stack)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1246 (error "Unmatched @end %s" check))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1247 (if (not (eq (car (car texinfo-stack)) check))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1248 (error "@end %s matches @%s"
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1249 check (car (car texinfo-stack))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1250 (prog1 (cdr (car texinfo-stack))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1251 (setq texinfo-stack (cdr texinfo-stack))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1252
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1253 (put 'itemize 'texinfo-format 'texinfo-itemize)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1254 (defun texinfo-itemize ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1255 (texinfo-push-stack
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1256 'itemize
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1257 (progn (skip-chars-forward " \t")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1258 (if (eolp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1259 "@bullet"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1260 (texinfo-parse-line-arg))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1261 (texinfo-discard-line-with-args)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1262 (setq fill-column (- fill-column 5)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1263
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1264 (put 'itemize 'texinfo-end 'texinfo-end-itemize)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1265 (defun texinfo-end-itemize ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1266 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1267 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1268 (let ((stacktop
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1269 (texinfo-pop-stack 'itemize)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1270 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1271
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1272 (put 'enumerate 'texinfo-format 'texinfo-enumerate)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1273 (defun texinfo-enumerate ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1274 (texinfo-push-stack
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1275 'enumerate
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1276 (progn (skip-chars-forward " \t")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1277 (if (eolp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1278 1
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1279 (read (current-buffer)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1280 (if (and (symbolp (car (cdr (car texinfo-stack))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1281 (> 1 (length (symbol-name (car (cdr (car texinfo-stack)))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1282 (error
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1283 "@enumerate: Use a number or letter, eg: 1, A, a, 3, B, or d." ))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1284 (texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1285 (setq fill-column (- fill-column 5)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1286
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1287 (put 'enumerate 'texinfo-end 'texinfo-end-enumerate)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1288 (defun texinfo-end-enumerate ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1289 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1290 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1291 (let ((stacktop
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1292 (texinfo-pop-stack 'enumerate)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1293 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1294
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1295 ;; @alphaenumerate never became a standard part of Texinfo
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1296 (put 'alphaenumerate 'texinfo-format 'texinfo-alphaenumerate)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1297 (defun texinfo-alphaenumerate ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1298 (texinfo-push-stack 'alphaenumerate (1- ?a))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1299 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1300 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1301
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1302 (put 'alphaenumerate 'texinfo-end 'texinfo-end-alphaenumerate)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1303 (defun texinfo-end-alphaenumerate ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1304 (setq fill-column (+ fill-column 5))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1305 (texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1306 (let ((stacktop
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1307 (texinfo-pop-stack 'alphaenumerate)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1308 (texinfo-do-itemize (nth 1 stacktop))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1309
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1310 ;; @capsenumerate never became a standard part of Texinfo
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1311 (put 'capsenumerate 'texinfo-format 'texinfo-capsenumerate)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1312 (defun texinfo-capsenumerate ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1313 (texinfo-push-stack 'capsenumerate (1- ?A))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1314 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1315 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1316
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1317 (put 'capsenumerate 'texinfo-end 'texinfo-end-capsenumerate)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1318 (defun texinfo-end-capsenumerate ()
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1319 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1320 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1321 (let ((stacktop
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1322 (texinfo-pop-stack 'capsenumerate)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1323 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1324
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1325 ;; At the @end, indent all the lines within the construct
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1326 ;; except those marked with backspace. FROM says where
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1327 ;; construct started.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1328 (defun texinfo-do-itemize (from)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1329 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1330 (while (progn (forward-line -1)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1331 (>= (point) from))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1332 (if (= (following-char) ?\b)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1333 (save-excursion
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1334 (delete-char 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1335 (end-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1336 (delete-char 6))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1337 (if (not (looking-at "[ \t]*$"))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1338 (save-excursion (insert " ")))))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1339
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1340 (put 'item 'texinfo-format 'texinfo-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1341 (put 'itemx 'texinfo-format 'texinfo-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1342 (defun texinfo-item ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1343 (funcall (get (car (car texinfo-stack)) 'texinfo-item)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1344
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1345 (put 'itemize 'texinfo-item 'texinfo-itemize-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1346 (defun texinfo-itemize-item ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1347 ;; (texinfo-discard-line) ; Did not handle text on same line as @item.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1348 (delete-region (1+ (point)) (save-excursion (beginning-of-line) (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1349 (if (looking-at "[ \t]*[^ \t\n]+")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1350 ;; Text on same line as @item command.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1351 (insert "\b " (nth 1 (car texinfo-stack)) " \n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1352 ;; Else text on next line.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1353 (insert "\b " (nth 1 (car texinfo-stack)) " "))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1354 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1355
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1356 (put 'enumerate 'texinfo-item 'texinfo-enumerate-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1357 (defun texinfo-enumerate-item ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1358 (texinfo-discard-line)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1359 (let (enumerating-symbol)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1360 (cond ((integerp (car (cdr (car texinfo-stack))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1361 (setq enumerating-symbol (car (cdr (car texinfo-stack))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1362 (insert ?\b (format "%3d. " enumerating-symbol) ?\n)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1363 (setcar (cdr (car texinfo-stack)) (1+ enumerating-symbol)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1364 ((symbolp (car (cdr (car texinfo-stack))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1365 (setq enumerating-symbol
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1366 (symbol-name (car (cdr (car texinfo-stack)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1367 (if (or (equal ?\[ (string-to-char enumerating-symbol))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1368 (equal ?\{ (string-to-char enumerating-symbol)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1369 (error
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1370 "Too many items in enumerated list; alphabet ends at Z."))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1371 (insert ?\b (format "%3s. " enumerating-symbol) ?\n)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1372 (setcar (cdr (car texinfo-stack))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1373 (make-symbol
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1374 (char-to-string
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1375 (1+
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1376 (string-to-char enumerating-symbol))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1377 (t
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1378 (error
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1379 "@enumerate: Use a number or letter, eg: 1, A, a, 3, B or d." )))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1380 (forward-line -1)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1381
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1382 (put 'alphaenumerate 'texinfo-item 'texinfo-alphaenumerate-item)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1383 (defun texinfo-alphaenumerate-item ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1384 (texinfo-discard-line)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1385 (let ((next (1+ (car (cdr (car texinfo-stack))))))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1386 (if (> next ?z)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1387 (error "More than 26 items in @alphaenumerate; get a bigger alphabet."))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1388 (setcar (cdr (car texinfo-stack)) next)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1389 (insert "\b " next ". \n"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1390 (forward-line -1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1391
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1392 (put 'capsenumerate 'texinfo-item 'texinfo-capsenumerate-item)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1393 (defun texinfo-capsenumerate-item ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1394 (texinfo-discard-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1395 (let ((next (1+ (car (cdr (car texinfo-stack))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1396 (if (> next ?Z)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1397 (error "More than 26 items in @capsenumerate; get a bigger alphabet."))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1398 (setcar (cdr (car texinfo-stack)) next)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1399 (insert "\b " next ". \n"))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1400 (forward-line -1))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1401
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1402
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1403 ;;; @table
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1404
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1405 ; The `@table' command produces two-column tables.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1406
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1407 (put 'table 'texinfo-format 'texinfo-table)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1408 (defun texinfo-table ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1409 (texinfo-push-stack
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1410 'table
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1411 (progn (skip-chars-forward " \t")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1412 (if (eolp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1413 "@asis"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1414 (texinfo-parse-line-arg))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1415 (texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1416 (setq fill-column (- fill-column 5)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1417
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1418 (put 'table 'texinfo-item 'texinfo-table-item)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1419 (defun texinfo-table-item ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1420 (let ((arg (texinfo-parse-arg-discard))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1421 (itemfont (car (cdr (car texinfo-stack)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1422 (insert ?\b itemfont ?\{ arg "}\n \n"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1423 (forward-line -2))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1424
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1425 (put 'table 'texinfo-end 'texinfo-end-table)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1426 (defun texinfo-end-table ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1427 (setq fill-column (+ fill-column 5))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1428 (texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1429 (let ((stacktop
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1430 (texinfo-pop-stack 'table)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1431 (texinfo-do-itemize (nth 1 stacktop))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1432
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1433 ;; @description appears to be an undocumented variant on @table that
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1434 ;; does not require an arg. It fails in texinfo.tex 2.58 and is not
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1435 ;; part of makeinfo.c The command appears to be a relic of the past.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1436 (put 'description 'texinfo-end 'texinfo-end-table)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1437 (put 'description 'texinfo-format 'texinfo-description)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1438 (defun texinfo-description ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1439 (texinfo-push-stack 'table "@asis")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1440 (setq fill-column (- fill-column 5))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1441 (texinfo-discard-line))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1442
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1443
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1444 ;;; @ftable, @vtable
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1445
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1446 ; The `@ftable' and `@vtable' commands are like the `@table' command
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1447 ; but they also insert each entry in the first column of the table
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1448 ; into the function or variable index.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1449
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1450 ;; Handle the @ftable and @vtable commands:
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1451
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1452 (put 'ftable 'texinfo-format 'texinfo-ftable)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1453 (put 'vtable 'texinfo-format 'texinfo-vtable)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1454
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1455 (defun texinfo-ftable () (texinfo-indextable 'ftable))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1456 (defun texinfo-vtable () (texinfo-indextable 'vtable))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1457
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1458 (defun texinfo-indextable (table-type)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1459 (texinfo-push-stack table-type (texinfo-parse-arg-discard))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1460 (setq fill-column (- fill-column 5)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1461
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1462 ;; Handle the @item commands within ftable and vtable:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1463
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1464 (put 'ftable 'texinfo-item 'texinfo-ftable-item)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1465 (put 'vtable 'texinfo-item 'texinfo-vtable-item)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1466
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1467 (defun texinfo-ftable-item () (texinfo-indextable-item 'texinfo-findex))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1468 (defun texinfo-vtable-item () (texinfo-indextable-item 'texinfo-vindex))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1469
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1470 (defun texinfo-indextable-item (index-type)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1471 (let ((item (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1472 (itemfont (car (cdr (car texinfo-stack))))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1473 (indexvar index-type))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1474 (insert ?\b itemfont ?\{ item "}\n \n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1475 (set indexvar
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1476 (cons
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1477 (list item texinfo-last-node)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1478 (symbol-value indexvar)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1479 (forward-line -2)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1480
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1481 ;; Handle @end ftable, @end vtable
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1482
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1483 (put 'ftable 'texinfo-end 'texinfo-end-ftable)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1484 (put 'vtable 'texinfo-end 'texinfo-end-vtable)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1485
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1486 (defun texinfo-end-ftable () (texinfo-end-indextable 'ftable))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1487 (defun texinfo-end-vtable () (texinfo-end-indextable 'vtable))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1488
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1489 (defun texinfo-end-indextable (table-type)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1490 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1491 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1492 (let ((stacktop
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1493 (texinfo-pop-stack table-type)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1494 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1495
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1496
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1497 ;;; @ifinfo, @iftex, @tex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1498
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1499 (put 'ifinfo 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1500 (put 'ifinfo 'texinfo-end 'texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1501
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1502 (put 'iftex 'texinfo-format 'texinfo-format-iftex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1503 (defun texinfo-format-iftex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1504 (delete-region texinfo-command-start
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1505 (progn (re-search-forward "@end iftex[ \t]*\n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1506 (point))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1507
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1508 (put 'tex 'texinfo-format 'texinfo-format-tex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1509 (defun texinfo-format-tex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1510 (delete-region texinfo-command-start
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1511 (progn (re-search-forward "@end tex[ \t]*\n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1512 (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1513
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1514
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1515 ;;; @titlepage
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1516
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1517 (put 'titlepage 'texinfo-format 'texinfo-format-titlepage)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1518 (defun texinfo-format-titlepage ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1519 (delete-region texinfo-command-start
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1520 (progn (re-search-forward "@end titlepage[ \t]*\n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1521 (point))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1522
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1523 (put 'endtitlepage 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1524
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1525 ; @titlespec an alternative titling command; ignored by Info
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1526
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1527 (put 'titlespec 'texinfo-format 'texinfo-format-titlespec)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1528 (defun texinfo-format-titlespec ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1529 (delete-region texinfo-command-start
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1530 (progn (re-search-forward "@end titlespec[ \t]*\n")
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1531 (point))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1532
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1533 (put 'endtitlespec 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1534
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1535
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1536 ;;; @today
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1537
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1538 (put 'today 'texinfo-format 'texinfo-format-today)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1539
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1540 ; Produces Day Month Year style of output. eg `1 Jan 1900'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1541 ; The `@today{}' command requires a pair of braces, like `@dots{}'.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1542 (defun texinfo-format-today ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1543 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1544 (insert (format "%s %s %s"
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1545 (substring (current-time-string) 8 10)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1546 (substring (current-time-string) 4 7)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1547 (substring (current-time-string) -4))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1548
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1549
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1550 ;;; @ignore
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1551
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1552 (put 'ignore 'texinfo-format 'texinfo-format-ignore)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1553 (defun texinfo-format-ignore ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1554 (delete-region texinfo-command-start
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1555 (progn (re-search-forward "@end ignore[ \t]*\n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1556 (point))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1557
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1558 (put 'endignore 'texinfo-format 'texinfo-discard-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1559
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1560
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1561 ;;; Define the Info enclosure command: @definfoenclose
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1562
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1563 ; A `@definfoenclose' command may be used to define a highlighting
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1564 ; command for Info, but not for TeX. A command defined using
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1565 ; `@definfoenclose' marks text by enclosing it in strings that precede
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1566 ; and follow the text.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1567 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1568 ; Presumably, if you define a command with `@definfoenclose` for Info,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1569 ; you will also define the same command in the TeX definitions file,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1570 ; `texinfo.tex' in a manner appropriate for typesetting.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1571 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1572 ; Write a `@definfoenclose' command on a line and follow it with three
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1573 ; arguments separated by commas (commas are used as separators in an
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1574 ; `@node' line in the same way). The first argument to
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1575 ; `@definfoenclose' is the @-command name \(without the `@'\); the
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1576 ; second argument is the Info start delimiter string; and the third
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1577 ; argument is the Info end delimiter string. The latter two arguments
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1578 ; enclose the highlighted text in the Info file. A delimiter string
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1579 ; may contain spaces. Neither the start nor end delimiter is
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1580 ; required. However, if you do not provide a start delimiter, you
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1581 ; must follow the command name with two commas in a row; otherwise,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1582 ; the Info formatting commands will misinterpret the end delimiter
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1583 ; string as a start delimiter string.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1584 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1585 ; An enclosure command defined this way takes one argument in braces.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1586 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1587 ; For example, you can write:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1588 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1589 ; @ifinfo
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1590 ; @definfoenclose phoo, //, \\
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1591 ; @end ifinfo
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1592 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1593 ; near the beginning of a Texinfo file at the beginning of the lines
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1594 ; to define `@phoo' as an Info formatting command that inserts `//'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1595 ; before and `\\' after the argument to `@phoo'. You can then write
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1596 ; `@phoo{bar}' wherever you want `//bar\\' highlighted in Info.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1597 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1598 ; Also, for TeX formatting, you could write
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1599 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1600 ; @iftex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1601 ; @global@let@phoo=@i
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1602 ; @end iftex
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1603 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1604 ; to define `@phoo' as a command that causes TeX to typeset
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1605 ; the argument to `@phoo' in italics.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1606 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1607 ; Note that each definition applies to its own formatter: one for TeX,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1608 ; the other for texinfo-format-buffer or texinfo-format-region.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1609 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1610 ; Here is another example: write
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1611 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1612 ; @definfoenclose headword, , :
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1613 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1614 ; near the beginning of the file, to define `@headword' as an Info
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1615 ; formatting command that inserts nothing before and a colon after the
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1616 ; argument to `@headword'.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1617
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1618 (put 'definfoenclose 'texinfo-format 'texinfo-define-info-enclosure)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1619 (defun texinfo-define-info-enclosure ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1620 (let* ((args (texinfo-format-parse-line-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1621 (command-name (nth 0 args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1622 (beginning-delimiter (or (nth 1 args) ""))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1623 (end-delimiter (or (nth 2 args) "")))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1624 (texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1625 (setq texinfo-enclosure-list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1626 (cons
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1627 (list command-name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1628 (list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1629 beginning-delimiter
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1630 end-delimiter))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1631 texinfo-enclosure-list))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1632
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1633
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1634 ;;; @var, @code and the like
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1635
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1636 (put 'var 'texinfo-format 'texinfo-format-var)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1637 ; @sc a small caps font for TeX; formatted as `var' in Info
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1638 (put 'sc 'texinfo-format 'texinfo-format-var)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1639 (defun texinfo-format-var ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1640 (insert (upcase (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1641 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1642
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1643 ; various noops
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1644
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1645 (put 'b 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1646 (put 'i 'texinfo-format 'texinfo-format-noop)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1647 (put 'r 'texinfo-format 'texinfo-format-noop)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1648 (put 't 'texinfo-format 'texinfo-format-noop)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1649 (put 'w 'texinfo-format 'texinfo-format-noop)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1650 (put 'asis 'texinfo-format 'texinfo-format-noop)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1651 (put 'dmn 'texinfo-format 'texinfo-format-noop)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1652 (put 'key 'texinfo-format 'texinfo-format-noop)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1653 (put 'math 'texinfo-format 'texinfo-format-noop)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1654 (put 'titlefont 'texinfo-format 'texinfo-format-noop)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1655 (defun texinfo-format-noop ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1656 (insert (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1657 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1658
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1659 (put 'cite 'texinfo-format 'texinfo-format-code)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1660 (put 'code 'texinfo-format 'texinfo-format-code)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1661 (put 'file 'texinfo-format 'texinfo-format-code)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1662 (put 'kbd 'texinfo-format 'texinfo-format-code)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1663 (put 'samp 'texinfo-format 'texinfo-format-code)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1664 (defun texinfo-format-code ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1665 (insert "`" (texinfo-parse-arg-discard) "'")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1666 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1667
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1668 (put 'emph 'texinfo-format 'texinfo-format-emph)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1669 (put 'strong 'texinfo-format 'texinfo-format-emph)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1670 (defun texinfo-format-emph ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1671 (insert "*" (texinfo-parse-arg-discard) "*")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1672 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1673
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1674 (put 'dfn 'texinfo-format 'texinfo-format-defn)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1675 (put 'defn 'texinfo-format 'texinfo-format-defn)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1676 (defun texinfo-format-defn ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1677 (insert "\"" (texinfo-parse-arg-discard) "\"")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1678 (goto-char texinfo-command-start))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1679
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1680 (put 'bullet 'texinfo-format 'texinfo-format-bullet)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1681 (defun texinfo-format-bullet ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1682 "Insert an asterisk.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1683 If used within a line, follow `@bullet' with braces."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1684 (texinfo-optional-braces-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1685 (insert "*"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1686
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1687
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1688 ;;; @example, @lisp, @quotation, @display, @smalllisp, @smallexample
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1689
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1690 (put 'display 'texinfo-format 'texinfo-format-example)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1691 (put 'example 'texinfo-format 'texinfo-format-example)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1692 (put 'lisp 'texinfo-format 'texinfo-format-example)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1693 (put 'quotation 'texinfo-format 'texinfo-format-example)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1694 (put 'smallexample 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1695 (put 'smalllisp 'texinfo-format 'texinfo-format-example)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1696 (defun texinfo-format-example ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1697 (texinfo-push-stack 'example nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1698 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1699 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1700
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1701 (put 'example 'texinfo-end 'texinfo-end-example)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1702 (put 'display 'texinfo-end 'texinfo-end-example)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1703 (put 'lisp 'texinfo-end 'texinfo-end-example)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1704 (put 'quotation 'texinfo-end 'texinfo-end-example)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1705 (put 'smallexample 'texinfo-end 'texinfo-end-example)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1706 (put 'smalllisp 'texinfo-end 'texinfo-end-example)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1707 (defun texinfo-end-example ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1708 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1709 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1710 (let ((stacktop
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1711 (texinfo-pop-stack 'example)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1712 (texinfo-do-itemize (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1713
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1714 (put 'exdent 'texinfo-format 'texinfo-format-exdent)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1715 (defun texinfo-format-exdent ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1716 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1717 (delete-region (point)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1718 (progn
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1719 (skip-chars-forward " ")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1720 (point)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1721 (insert ?\b)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1722 ;; Cancel out the deletion that texinfo-do-itemize
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1723 ;; is going to do at the end of this line.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1724 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1725 (end-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1726 (insert "\n ")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1727
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1728
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1729 ;;; @cartouche
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1730
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1731 ; The @cartouche command is a noop in Info; in a printed manual,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1732 ; it makes a box with rounded corners.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1733
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1734 (put 'cartouche 'texinfo-format 'texinfo-discard-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1735 (put 'cartouche 'texinfo-end 'texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1736
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1737
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1738 ;;; @flushleft and @format
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1739
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1740 ; The @flushleft command left justifies every line but leaves the
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1741 ; right end ragged. As far as Info is concerned, @flushleft is a
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1742 ; `do-nothing' command
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1743
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1744 ; The @format command is similar to @example except that it does not
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1745 ; indent; this means that in Info, @format is similar to @flushleft.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1746
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1747 (put 'format 'texinfo-format 'texinfo-format-flushleft)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1748 (put 'flushleft 'texinfo-format 'texinfo-format-flushleft)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1749 (defun texinfo-format-flushleft ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1750 (texinfo-discard-line))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1751
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1752 (put 'format 'texinfo-end 'texinfo-end-flushleft)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1753 (put 'flushleft 'texinfo-end 'texinfo-end-flushleft)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1754 (defun texinfo-end-flushleft ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1755 (texinfo-discard-command))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1756
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1757
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1758 ;;; @flushright
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1759
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1760 ; The @flushright command right justifies every line but leaves the
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1761 ; left end ragged. Spaces and tabs at the right ends of lines are
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1762 ; removed so that visible text lines up on the right side.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1763
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1764 (put 'flushright 'texinfo-format 'texinfo-format-flushright)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1765 (defun texinfo-format-flushright ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1766 (texinfo-push-stack 'flushright nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1767 (texinfo-discard-line))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1768
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1769 (put 'flushright 'texinfo-end 'texinfo-end-flushright)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1770 (defun texinfo-end-flushright ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1771 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1772
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1773 (let ((stacktop
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1774 (texinfo-pop-stack 'flushright)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1775
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1776 (texinfo-do-flushright (nth 1 stacktop))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1777
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1778 (defun texinfo-do-flushright (from)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1779 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1780 (while (progn (forward-line -1)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1781 (>= (point) from))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1782
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1783 (beginning-of-line)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1784 (insert
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1785 (make-string
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1786 (- fill-column
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1787 (save-excursion
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1788 (end-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1789 (skip-chars-backward " \t")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1790 (delete-region (point) (progn (end-of-line) (point)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1791 (current-column)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1792 ? )))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1793
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1794
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1795 ;;; @ctrl, @TeX, @copyright, @minus, @dots
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1796
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1797 (put 'ctrl 'texinfo-format 'texinfo-format-ctrl)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1798 (defun texinfo-format-ctrl ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1799 (let ((str (texinfo-parse-arg-discard)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1800 (insert (logand 31 (aref str 0)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1801
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1802 (put 'TeX 'texinfo-format 'texinfo-format-TeX)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1803 (defun texinfo-format-TeX ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1804 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1805 (insert "TeX"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1806
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1807 (put 'copyright 'texinfo-format 'texinfo-format-copyright)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1808 (defun texinfo-format-copyright ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1809 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1810 (insert "(C)"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1811
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1812 (put 'minus 'texinfo-format 'texinfo-format-minus)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1813 (defun texinfo-format-minus ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1814 "Insert a minus sign.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1815 If used within a line, follow `@minus' with braces."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1816 (texinfo-optional-braces-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1817 (insert "-"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1818
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1819 (put 'dots 'texinfo-format 'texinfo-format-dots)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1820 (defun texinfo-format-dots ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1821 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1822 (insert "..."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1823
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1824
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1825 ;;; Refilling and indenting: @refill, @paragraphindent, @noindent
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1826
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1827 ;;; Indent only those paragraphs that are refilled as a result of an
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1828 ;;; @refill command.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1829
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1830 ; * If the value is `asis', do not change the existing indentation at
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1831 ; the starts of paragraphs.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1832
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1833 ; * If the value zero, delete any existing indentation.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1834
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1835 ; * If the value is greater than zero, indent each paragraph by that
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1836 ; number of spaces.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1837
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1838 ;;; But do not refill paragraphs with an @refill command that are
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1839 ;;; preceded by @noindent or are part of a table, list, or deffn.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1840
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1841 (defvar texinfo-paragraph-indent "asis"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1842 "Number of spaces for @refill to indent a paragraph; else to leave as is.")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1843
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1844 (put 'paragraphindent 'texinfo-format 'texinfo-paragraphindent)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1845
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1846 (defun texinfo-paragraphindent ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1847 "Specify the number of spaces for @refill to indent a paragraph.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1848 Default is to leave the number of spaces as is."
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1849 (let ((arg (texinfo-parse-arg-discard)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1850 (if (string= "asis" arg)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1851 (setq texinfo-paragraph-indent "asis")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1852 (setq texinfo-paragraph-indent (string-to-int arg)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1853
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1854 (put 'refill 'texinfo-format 'texinfo-format-refill)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1855 (defun texinfo-format-refill ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1856 "Refill paragraph. Also, indent first line as set by @paragraphindent.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1857 Default is to leave paragraph indentation as is."
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1858 (texinfo-discard-command)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1859 (forward-paragraph -1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1860 (if (looking-at "[ \t\n]*$") (forward-line 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1861 ;; Do not indent if an entry in a list, table, or deffn,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1862 ;; or if paragraph is preceded by @noindent.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1863 ;; Otherwise, indent
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1864 (cond
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1865 ;; delete a @noindent line and do not indent paragraph
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1866 ((save-excursion (forward-line -1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1867 (looking-at "^@noindent"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1868 (forward-line -1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1869 (delete-region (point) (progn (forward-line 1) (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1870 ;; do nothing if "asis"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1871 ((equal texinfo-paragraph-indent "asis"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1872 ;; do no indenting in list, etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1873 ((> texinfo-stack-depth 0))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1874 ;; otherwise delete existing whitespace and indent
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1875 (t
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1876 (delete-region (point) (progn (skip-chars-forward " \t") (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1877 (insert (make-string texinfo-paragraph-indent ? ))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1878 (forward-paragraph 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1879 (forward-line -1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1880 (end-of-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1881 ;; Do not fill a section title line with asterisks, hyphens, etc. that
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1882 ;; are used to underline it. This could occur if the line following
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1883 ;; the underlining is not an index entry and has text within it.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1884 (let* ((previous-paragraph-separate paragraph-separate)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1885 (paragraph-separate (concat paragraph-separate "\\|^[=*---.]+"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1886 (previous-paragraph-start paragraph-start)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1887 (paragraph-start (concat paragraph-start "\\|^[=*---.]+")))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1888 (unwind-protect
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1889 (fill-paragraph nil)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1890 (setq paragraph-separate previous-paragraph-separate)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1891 (setq paragraph-start previous-paragraph-start))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1892
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1893 (put 'noindent 'texinfo-format 'texinfo-noindent)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1894 (defun texinfo-noindent ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1895 (save-excursion
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1896 (forward-paragraph 1)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1897 (if (search-backward "@refill"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1898 (save-excursion (forward-line -1) (point)) t)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1899 () ; leave @noindent command so @refill command knows not to indent
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1900 ;; else
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1901 (texinfo-discard-line))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1902
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1903
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1904 ;;; Index generation
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1905
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1906 (put 'vindex 'texinfo-format 'texinfo-format-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1907 (defun texinfo-format-vindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1908 (texinfo-index 'texinfo-vindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1909
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1910 (put 'cindex 'texinfo-format 'texinfo-format-cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1911 (defun texinfo-format-cindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1912 (texinfo-index 'texinfo-cindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1913
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1914 (put 'findex 'texinfo-format 'texinfo-format-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1915 (defun texinfo-format-findex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1916 (texinfo-index 'texinfo-findex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1917
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1918 (put 'pindex 'texinfo-format 'texinfo-format-pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1919 (defun texinfo-format-pindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1920 (texinfo-index 'texinfo-pindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1921
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1922 (put 'tindex 'texinfo-format 'texinfo-format-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1923 (defun texinfo-format-tindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1924 (texinfo-index 'texinfo-tindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1925
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1926 (put 'kindex 'texinfo-format 'texinfo-format-kindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1927 (defun texinfo-format-kindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1928 (texinfo-index 'texinfo-kindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1929
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1930 (defun texinfo-index (indexvar)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1931 (let ((arg (texinfo-parse-expanded-arg)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1932 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1933 (set indexvar
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1934 (cons (list arg
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1935 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1936 ;; Region formatting may not provide last node position.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1937 (if texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1938 (1+ (count-lines texinfo-last-node-pos (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1939 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1940 (symbol-value indexvar)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1941
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1942 (defconst texinfo-indexvar-alist
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1943 '(("cp" . texinfo-cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1944 ("fn" . texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1945 ("vr" . texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1946 ("tp" . texinfo-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1947 ("pg" . texinfo-pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1948 ("ky" . texinfo-kindex)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1949
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1950
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1951 ;;; @defindex @defcodeindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1952 (put 'defindex 'texinfo-format 'texinfo-format-defindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1953 (put 'defcodeindex 'texinfo-format 'texinfo-format-defindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1954
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1955 (defun texinfo-format-defindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1956 (let* ((index-name (texinfo-parse-arg-discard)) ; eg: `aa'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1957 (indexing-command (intern (concat index-name "index")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1958 (index-formatting-command ; eg: `texinfo-format-aaindex'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1959 (intern (concat "texinfo-format-" index-name "index")))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1960 (index-alist-name ; eg: `texinfo-aaindex'
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1961 (intern (concat "texinfo-" index-name "index"))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1962
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1963 (set index-alist-name nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1964
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1965 (put indexing-command ; eg, aaindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1966 'texinfo-format
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1967 index-formatting-command) ; eg, texinfo-format-aaindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1968
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1969 ;; eg: "aa" . texinfo-aaindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1970 (or (assoc index-name texinfo-indexvar-alist)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1971 (setq texinfo-indexvar-alist
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1972 (cons
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1973 (cons index-name
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1974 index-alist-name)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1975 texinfo-indexvar-alist)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1976
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1977 (fset index-formatting-command
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1978 (list 'lambda 'nil
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1979 (list 'texinfo-index
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1980 (list 'quote index-alist-name))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1981
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1982
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1983 ;;; @synindex @syncodeindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1984
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1985 (put 'synindex 'texinfo-format 'texinfo-format-synindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1986 (put 'syncodeindex 'texinfo-format 'texinfo-format-synindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1987
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1988 (defun texinfo-format-synindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1989 (let* ((args (texinfo-parse-arg-discard))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1990 (second (cdr (read-from-string args)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1991 (joiner (symbol-name (car (read-from-string args))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1992 (joined (symbol-name (car (read-from-string args second)))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1993
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1994 (if (assoc joiner texinfo-short-index-cmds-alist)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1995 (put
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1996 (cdr (assoc joiner texinfo-short-index-cmds-alist))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1997 'texinfo-format
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1998 (or (cdr (assoc joined texinfo-short-index-format-cmds-alist))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
1999 (intern (concat "texinfo-format-" joined "index"))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2000 (put
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2001 (intern (concat joiner "index"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2002 'texinfo-format
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2003 (or (cdr(assoc joined texinfo-short-index-format-cmds-alist))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2004 (intern (concat "texinfo-format-" joined "index")))))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2005
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2006 (defconst texinfo-short-index-cmds-alist
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2007 '(("cp" . cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2008 ("fn" . findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2009 ("vr" . vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2010 ("tp" . tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2011 ("pg" . pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2012 ("ky" . kindex)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2013
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2014 (defconst texinfo-short-index-format-cmds-alist
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2015 '(("cp" . texinfo-format-cindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2016 ("fn" . texinfo-format-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2017 ("vr" . texinfo-format-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2018 ("tp" . texinfo-format-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2019 ("pg" . texinfo-format-pindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2020 ("ky" . texinfo-format-kindex)))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2021
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2022
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2023 ;;; Sort and index (for VMS)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2024
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2025 ;; Sort an index which is in the current buffer between START and END.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2026 ;; Used on VMS, where the `sort' utility is not available.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2027 (defun texinfo-sort-region (start end)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2028 (require 'sort)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2029 (save-restriction
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2030 (narrow-to-region start end)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2031 (sort-subr nil 'forward-line 'end-of-line 'texinfo-sort-startkeyfun)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2032
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2033 ;; Subroutine for sorting an index.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2034 ;; At start of a line, return a string to sort the line under.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2035 (defun texinfo-sort-startkeyfun ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2036 (let ((line
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2037 (buffer-substring (point) (save-excursion (end-of-line) (point)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2038 ;; Canonicalize whitespace and eliminate funny chars.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2039 (while (string-match "[ \t][ \t]+\\|[^a-z0-9 ]+" line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2040 (setq line (concat (substring line 0 (match-beginning 0))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2041 " "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2042 (substring line (match-end 0) (length line)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2043 line))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2044
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2045
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2046 ;;; @printindex
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2047
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2048 (put 'printindex 'texinfo-format 'texinfo-format-printindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2049
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2050 (defun texinfo-format-printindex ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2051 (let ((indexelts (symbol-value
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2052 (cdr (assoc (texinfo-parse-arg-discard)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2053 texinfo-indexvar-alist))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2054 opoint)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2055 (insert "\n* Menu:\n\n")
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2056 (setq opoint (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2057 (texinfo-print-index nil indexelts)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2058
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2059 (if (eq system-type 'vax-vms)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2060 (texinfo-sort-region opoint (point))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2061 (shell-command-on-region opoint (point) "sort -fd" 1))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2062
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2063 (defun texinfo-print-index (file indexelts)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2064 (while indexelts
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2065 (if (stringp (car (car indexelts)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2066 (progn
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2067 (insert "* " (car (car indexelts)) ": " )
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2068 (indent-to 32)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2069 (insert
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2070 (if file (concat "(" file ")") "")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2071 (nth 1 (car indexelts)) ".")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2072 (indent-to 54)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2073 (insert
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2074 (if (nth 2 (car indexelts))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2075 (format " %d." (nth 2 (car indexelts)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2076 "")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2077 "\n"))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2078 ;; index entries from @include'd file
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2079 (texinfo-print-index (nth 1 (car indexelts))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2080 (nth 2 (car indexelts))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2081 (setq indexelts (cdr indexelts))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2082
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2083
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2084 ;;; Glyphs: @equiv, @error, etc
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2085
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2086 ;; @equiv to show that two expressions are equivalent
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2087 ;; @error to show an error message
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2088 ;; @expansion to show what a macro expands to
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2089 ;; @point to show the location of point in an example
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2090 ;; @print to show what an evaluated expression prints
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2091 ;; @result to indicate the value returned by an expression
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2092
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2093 (put 'equiv 'texinfo-format 'texinfo-format-equiv)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2094 (defun texinfo-format-equiv ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2095 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2096 (insert "=="))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2097
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2098 (put 'error 'texinfo-format 'texinfo-format-error)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2099 (defun texinfo-format-error ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2100 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2101 (insert "error-->"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2102
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2103 (put 'expansion 'texinfo-format 'texinfo-format-expansion)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2104 (defun texinfo-format-expansion ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2105 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2106 (insert "==>"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2107
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2108 (put 'point 'texinfo-format 'texinfo-format-point)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2109 (defun texinfo-format-point ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2110 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2111 (insert "-!-"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2112
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2113 (put 'print 'texinfo-format 'texinfo-format-print)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2114 (defun texinfo-format-print ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2115 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2116 (insert "-|"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2117
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2118 (put 'result 'texinfo-format 'texinfo-format-result)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2119 (defun texinfo-format-result ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2120 (texinfo-parse-arg-discard)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2121 (insert "=>"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2122
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2123
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2124 ;;; Definition formatting: @deffn, @defun, etc
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2125
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2126 ;; What definition formatting produces:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2127 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2128 ;; @deffn category name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2129 ;; In Info, `Category: name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2130 ;; In index: name: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2131 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2132 ;; @defvr category name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2133 ;; In Info, `Category: name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2134 ;; In index: name: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2135 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2136 ;; @deftp category name attributes...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2137 ;; `category name attributes...' Note: @deftp args in lower case.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2138 ;; In index: name: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2139 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2140 ;; Specialized function-like or variable-like entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2141 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2142 ;; @defun, @defmac, @defspec, @defvar, @defopt
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2143 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2144 ;; @defun name args In Info, `Function: name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2145 ;; @defmac name args In Info, `Macro: name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2146 ;; @defvar name In Info, `Variable: name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2147 ;; etc.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2148 ;; In index: name: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2149 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2150 ;; Generalized typed-function-like or typed-variable-like entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2151 ;; @deftypefn category data-type name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2152 ;; In Info, `Category: data-type name args...'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2153 ;; @deftypevr category data-type name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2154 ;; In Info, `Category: data-type name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2155 ;; In index: name: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2156 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2157 ;; Specialized typed-function-like or typed-variable-like entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2158 ;; @deftypefun data-type name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2159 ;; In Info, `Function: data-type name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2160 ;; In index: name: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2161 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2162 ;; @deftypevar data-type name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2163 ;; In Info, `Variable: data-type name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2164 ;; In index: name: node. line#. but include args after name!?
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2165 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2166 ;; Generalized object oriented entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2167 ;; @defop category class name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2168 ;; In Info, `Category on class: name ARG'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2169 ;; In index: name on class: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2170 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2171 ;; @defcv category class name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2172 ;; In Info, `Category of class: name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2173 ;; In index: name of class: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2174 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2175 ;; Specialized object oriented entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2176 ;; @defmethod class name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2177 ;; In Info, `Method on class: name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2178 ;; In index: name on class: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2179 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2180 ;; @defivar class name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2181 ;; In Info, `Instance variable of class: name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2182 ;; In index: name of class: node. line#.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2183
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2184
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2185 ;;; The definition formatting functions
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2186
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2187 (defun texinfo-format-defun ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2188 (texinfo-push-stack 'defun nil)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2189 (setq fill-column (- fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2190 (texinfo-format-defun-1 t))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2191
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2192 (defun texinfo-end-defun ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2193 (setq fill-column (+ fill-column 5))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2194 (texinfo-discard-command)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2195 (let ((start (nth 1 (texinfo-pop-stack 'defun))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2196 (texinfo-do-itemize start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2197 ;; Delete extra newline inserted after header.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2198 (save-excursion
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2199 (goto-char start)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2200 (delete-char -1))))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2201
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2202 (defun texinfo-format-defunx ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2203 (texinfo-format-defun-1 nil))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2204
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2205 (defun texinfo-format-defun-1 (first-p)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2206 (let ((parse-args (texinfo-format-parse-defun-args))
4868
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2207 (texinfo-defun-type (get texinfo-command-name 'texinfo-defun-type)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2208 (texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2209 ;; Delete extra newline inserted after previous header line.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2210 (if (not first-p)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2211 (delete-char -1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2212 (funcall
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2213 (get texinfo-command-name 'texinfo-deffn-formatting-property) parse-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2214 ;; Insert extra newline so that paragraph filling does not mess
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2215 ;; with header line.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2216 (insert "\n\n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2217 (rplaca (cdr (cdr (car texinfo-stack))) (point))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2218 (funcall
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2219 (get texinfo-command-name 'texinfo-defun-indexing-property) parse-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2220
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2221 ;;; Formatting the first line of a definition
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2222
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2223 ;; @deffn, @defvr, @deftp
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2224 (put 'deffn 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2225 (put 'deffnx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2226 (put 'defvr 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2227 (put 'defvrx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2228 (put 'deftp 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2229 (put 'deftpx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2230 (defun texinfo-format-deffn (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2231 ;; Generalized function-like, variable-like, or generic data-type entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2232 ;; @deffn category name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2233 ;; In Info, `Category: name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2234 ;; @deftp category name attributes...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2235 ;; `category name attributes...' Note: @deftp args in lower case.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2236 (let ((category (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2237 (name (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2238 (args (cdr (cdr parsed-args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2239 (insert " -- " category ": " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2240 (while args
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2241 (insert " "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2242 (if (or (= ?& (aref (car args) 0))
4868
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2243 (eq (eval (car texinfo-defun-type)) 'deftp-type))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2244 (car args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2245 (upcase (car args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2246 (setq args (cdr args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2247
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2248 ;; @defun, @defmac, @defspec, @defvar, @defopt: Specialized, simple
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2249 (put 'defun 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2250 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2251 (put 'defunx 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2252 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2253 (put 'defmac 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2254 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2255 (put 'defmacx 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2256 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2257 (put 'defspec 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2258 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2259 (put 'defspecx 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2260 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2261 (put 'defvar 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2262 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2263 (put 'defvarx 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2264 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2265 (put 'defopt 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2266 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2267 (put 'defoptx 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2268 'texinfo-format-specialized-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2269 (defun texinfo-format-specialized-defun (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2270 ;; Specialized function-like or variable-like entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2271 ;; @defun name args In Info, `Function: Name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2272 ;; @defmac name args In Info, `Macro: Name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2273 ;; @defvar name In Info, `Variable: Name'
4868
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2274 ;; Use cdr of texinfo-defun-type to determine category:
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2275 (let ((category (car (cdr texinfo-defun-type)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2276 (name (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2277 (args (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2278 (insert " -- " category ": " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2279 (while args
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2280 (insert " "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2281 (if (= ?& (aref (car args) 0))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2282 (car args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2283 (upcase (car args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2284 (setq args (cdr args)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2285
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2286 ;; @deftypefn, @deftypevr: Generalized typed
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2287 (put 'deftypefn 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2288 (put 'deftypefnx 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2289 (put 'deftypevr 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2290 (put 'deftypevrx 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2291 (defun texinfo-format-deftypefn (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2292 ;; Generalized typed-function-like or typed-variable-like entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2293 ;; @deftypefn category data-type name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2294 ;; In Info, `Category: data-type name args...'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2295 ;; @deftypevr category data-type name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2296 ;; In Info, `Category: data-type name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2297 ;; Note: args in lower case, unless modified in command line.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2298 (let ((category (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2299 (data-type (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2300 (name (car (cdr (cdr parsed-args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2301 (args (cdr (cdr (cdr parsed-args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2302 (insert " -- " category ": " data-type " " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2303 (while args
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2304 (insert " " (car args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2305 (setq args (cdr args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2306
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2307 ;; @deftypefun, @deftypevar: Specialized typed
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2308 (put 'deftypefun 'texinfo-deffn-formatting-property 'texinfo-format-deftypefun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2309 (put 'deftypefunx 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2310 'texinfo-format-deftypefun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2311 (put 'deftypevar 'texinfo-deffn-formatting-property 'texinfo-format-deftypefun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2312 (put 'deftypevarx 'texinfo-deffn-formatting-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2313 'texinfo-format-deftypefun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2314 (defun texinfo-format-deftypefun (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2315 ;; Specialized typed-function-like or typed-variable-like entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2316 ;; @deftypefun data-type name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2317 ;; In Info, `Function: data-type name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2318 ;; @deftypevar data-type name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2319 ;; In Info, `Variable: data-type name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2320 ;; Note: args in lower case, unless modified in command line.
4868
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2321 ;; Use cdr of texinfo-defun-type to determine category:
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2322 (let ((category (car (cdr texinfo-defun-type)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2323 (data-type (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2324 (name (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2325 (args (cdr (cdr parsed-args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2326 (insert " -- " category ": " data-type " " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2327 (while args
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2328 (insert " " (car args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2329 (setq args (cdr args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2330
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2331 ;; @defop: Generalized object-oriented
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2332 (put 'defop 'texinfo-deffn-formatting-property 'texinfo-format-defop)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2333 (put 'defopx 'texinfo-deffn-formatting-property 'texinfo-format-defop)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2334 (defun texinfo-format-defop (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2335 ;; Generalized object oriented entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2336 ;; @defop category class name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2337 ;; In Info, `Category on class: name ARG'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2338 ;; Note: args in upper case; use of `on'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2339 (let ((category (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2340 (class (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2341 (name (car (cdr (cdr parsed-args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2342 (args (cdr (cdr (cdr parsed-args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2343 (insert " -- " category " on " class ": " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2344 (while args
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2345 (insert " " (upcase (car args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2346 (setq args (cdr args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2347
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2348 ;; @defcv: Generalized object-oriented
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2349 (put 'defcv 'texinfo-deffn-formatting-property 'texinfo-format-defcv)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2350 (put 'defcvx 'texinfo-deffn-formatting-property 'texinfo-format-defcv)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2351 (defun texinfo-format-defcv (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2352 ;; Generalized object oriented entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2353 ;; @defcv category class name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2354 ;; In Info, `Category of class: name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2355 ;; Note: args in upper case; use of `of'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2356 (let ((category (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2357 (class (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2358 (name (car (cdr (cdr parsed-args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2359 (args (cdr (cdr (cdr parsed-args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2360 (insert " -- " category " of " class ": " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2361 (while args
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2362 (insert " " (upcase (car args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2363 (setq args (cdr args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2364
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2365 ;; @defmethod: Specialized object-oriented
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2366 (put 'defmethod 'texinfo-deffn-formatting-property 'texinfo-format-defmethod)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2367 (put 'defmethodx 'texinfo-deffn-formatting-property 'texinfo-format-defmethod)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2368 (defun texinfo-format-defmethod (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2369 ;; Specialized object oriented entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2370 ;; @defmethod class name args...
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2371 ;; In Info, `Method on class: name ARGS'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2372 ;; Note: args in upper case; use of `on'
4868
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2373 ;; Use cdr of texinfo-defun-type to determine category:
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2374 (let ((category (car (cdr texinfo-defun-type)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2375 (class (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2376 (name (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2377 (args (cdr (cdr parsed-args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2378 (insert " -- " category " on " class ": " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2379 (while args
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2380 (insert " " (upcase (car args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2381 (setq args (cdr args)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2382
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2383 ;; @defivar: Specialized object-oriented
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2384 (put 'defivar 'texinfo-deffn-formatting-property 'texinfo-format-defivar)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2385 (put 'defivarx 'texinfo-deffn-formatting-property 'texinfo-format-defivar)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2386 (defun texinfo-format-defivar (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2387 ;; Specialized object oriented entity:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2388 ;; @defivar class name
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2389 ;; In Info, `Instance variable of class: name'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2390 ;; Note: args in upper case; use of `of'
4868
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2391 ;; Use cdr of texinfo-defun-type to determine category:
6de32c7b6045 (texinfo-format-begin-end): Bind cmd locally.
Richard M. Stallman <rms@gnu.org>
parents: 4769
diff changeset
2392 (let ((category (car (cdr texinfo-defun-type)))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2393 (class (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2394 (name (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2395 (args (cdr (cdr parsed-args))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2396 (insert " -- " category " of " class ": " name)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2397 (while args
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2398 (insert " " (upcase (car args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2399 (setq args (cdr args)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2400
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2401
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2402 ;;; Indexing for definitions
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2403
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2404 ;; An index entry has three parts: the `entry proper', the node name, and the
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2405 ;; line number. Depending on the which command is used, the entry is
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2406 ;; formatted differently:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2407 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2408 ;; @defun,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2409 ;; @defmac,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2410 ;; @defspec,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2411 ;; @defvar,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2412 ;; @defopt all use their 1st argument as the entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2413 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2414 ;; @deffn,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2415 ;; @defvr,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2416 ;; @deftp
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2417 ;; @deftypefun
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2418 ;; @deftypevar all use their 2nd argument as the entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2419 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2420 ;; @deftypefn,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2421 ;; @deftypevr both use their 3rd argument as the entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2422 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2423 ;; @defmethod uses its 2nd and 1st arguments as an entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2424 ;; formatted: NAME on CLASS
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2425
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2426 ;; @defop uses its 3rd and 2nd arguments as an entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2427 ;; formatted: NAME on CLASS
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2428 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2429 ;; @defivar uses its 2nd and 1st arguments as an entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2430 ;; formatted: NAME of CLASS
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2431 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2432 ;; @defcv uses its 3rd and 2nd argument as an entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2433 ;; formatted: NAME of CLASS
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2434
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2435 (put 'defun 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2436 (put 'defunx 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2437 (put 'defmac 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2438 (put 'defmacx 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2439 (put 'defspec 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2440 (put 'defspecx 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2441 (put 'defvar 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2442 (put 'defvarx 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2443 (put 'defopt 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2444 (put 'defoptx 'texinfo-defun-indexing-property 'texinfo-index-defun)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2445 (defun texinfo-index-defun (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2446 ;; use 1st parsed-arg as entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2447 ;; `index-list' will be texinfo-findex or the like
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2448 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2449 (set index-list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2450 (cons
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2451 ;; Three elements: entry-proper, node-name, line-number
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2452 (list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2453 (car parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2454 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2455 ;; Region formatting may not provide last node position.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2456 (if texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2457 (1+ (count-lines texinfo-last-node-pos (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2458 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2459 (symbol-value index-list)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2460
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2461 (put 'deffn 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2462 (put 'deffnx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2463 (put 'defvr 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2464 (put 'defvrx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2465 (put 'deftp 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2466 (put 'deftpx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2467 (put 'deftypefun 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2468 (put 'deftypefunx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2469 (put 'deftypevar 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2470 (put 'deftypevarx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2471 (defun texinfo-index-deffn (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2472 ;; use 2nd parsed-arg as entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2473 ;; `index-list' will be texinfo-findex or the like
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2474 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2475 (set index-list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2476 (cons
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2477 ;; Three elements: entry-proper, node-name, line-number
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2478 (list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2479 (car (cdr parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2480 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2481 ;; Region formatting may not provide last node position.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2482 (if texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2483 (1+ (count-lines texinfo-last-node-pos (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2484 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2485 (symbol-value index-list)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2486
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2487 (put 'deftypefn 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2488 (put 'deftypefnx 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2489 (put 'deftypevr 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2490 (put 'deftypevrx 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2491 (defun texinfo-index-deftypefn (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2492 ;; use 3rd parsed-arg as entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2493 ;; `index-list' will be texinfo-findex or the like
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2494 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2495 (set index-list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2496 (cons
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2497 ;; Three elements: entry-proper, node-name, line-number
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2498 (list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2499 (car (cdr (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2500 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2501 ;; Region formatting may not provide last node position.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2502 (if texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2503 (1+ (count-lines texinfo-last-node-pos (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2504 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2505 (symbol-value index-list)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2506
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2507 (put 'defmethod 'texinfo-defun-indexing-property 'texinfo-index-defmethod)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2508 (put 'defmethodx 'texinfo-defun-indexing-property 'texinfo-index-defmethod)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2509 (defun texinfo-index-defmethod (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2510 ;; use 2nd on 1st parsed-arg as entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2511 ;; `index-list' will be texinfo-findex or the like
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2512 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2513 (set index-list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2514 (cons
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2515 ;; Three elements: entry-proper, node-name, line-number
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2516 (list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2517 (format "%s on %s"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2518 (car (cdr parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2519 (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2520 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2521 ;; Region formatting may not provide last node position.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2522 (if texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2523 (1+ (count-lines texinfo-last-node-pos (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2524 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2525 (symbol-value index-list)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2526
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2527 (put 'defop 'texinfo-defun-indexing-property 'texinfo-index-defop)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2528 (put 'defopx 'texinfo-defun-indexing-property 'texinfo-index-defop)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2529 (defun texinfo-index-defop (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2530 ;; use 3rd on 2nd parsed-arg as entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2531 ;; `index-list' will be texinfo-findex or the like
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2532 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2533 (set index-list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2534 (cons
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2535 ;; Three elements: entry-proper, node-name, line-number
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2536 (list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2537 (format "%s on %s"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2538 (car (cdr (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2539 (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2540 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2541 ;; Region formatting may not provide last node position.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2542 (if texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2543 (1+ (count-lines texinfo-last-node-pos (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2544 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2545 (symbol-value index-list)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2546
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2547 (put 'defivar 'texinfo-defun-indexing-property 'texinfo-index-defivar)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2548 (put 'defivarx 'texinfo-defun-indexing-property 'texinfo-index-defivar)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2549 (defun texinfo-index-defivar (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2550 ;; use 2nd of 1st parsed-arg as entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2551 ;; `index-list' will be texinfo-findex or the like
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2552 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2553 (set index-list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2554 (cons
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2555 ;; Three elements: entry-proper, node-name, line-number
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2556 (list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2557 (format "%s of %s"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2558 (car (cdr parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2559 (car parsed-args))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2560 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2561 ;; Region formatting may not provide last node position.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2562 (if texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2563 (1+ (count-lines texinfo-last-node-pos (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2564 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2565 (symbol-value index-list)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2566
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2567 (put 'defcv 'texinfo-defun-indexing-property 'texinfo-index-defcv)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2568 (put 'defcvx 'texinfo-defun-indexing-property 'texinfo-index-defcv)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2569 (defun texinfo-index-defcv (parsed-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2570 ;; use 3rd of 2nd parsed-arg as entry-proper
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2571 ;; `index-list' will be texinfo-findex or the like
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2572 (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2573 (set index-list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2574 (cons
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2575 ;; Three elements: entry-proper, node-name, line-number
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2576 (list
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2577 (format "%s of %s"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2578 (car (cdr (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2579 (car (cdr parsed-args)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2580 texinfo-last-node
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2581 ;; Region formatting may not provide last node position.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2582 (if texinfo-last-node-pos
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2583 (1+ (count-lines texinfo-last-node-pos (point)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2584 1))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2585 (symbol-value index-list)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2586
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2587
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2588 ;;; Properties for definitions
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2589
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2590 ;; Each definition command has six properties:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2591 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2592 ;; 1. texinfo-deffn-formatting-property to format definition line
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2593 ;; 2. texinfo-defun-indexing-property to create index entry
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2594 ;; 3. texinfo-format formatting command
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2595 ;; 4. texinfo-end end formatting command
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2596 ;; 5. texinfo-defun-type type of deffn to format
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2597 ;; 6. texinfo-defun-index type of index to use
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2598 ;;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2599 ;; The `x' forms of each definition command are used for the second
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2600 ;; and subsequent header lines.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2601
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2602 ;; The texinfo-deffn-formatting-property and texinfo-defun-indexing-property
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2603 ;; are listed just before the appropriate formatting and indexing commands.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2604
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2605 (put 'deffn 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2606 (put 'deffnx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2607 (put 'deffn 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2608 (put 'deffn 'texinfo-defun-type '('deffn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2609 (put 'deffnx 'texinfo-defun-type '('deffn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2610 (put 'deffn 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2611 (put 'deffnx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2612
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2613 (put 'defun 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2614 (put 'defunx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2615 (put 'defun 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2616 (put 'defun 'texinfo-defun-type '('defun-type "Function"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2617 (put 'defunx 'texinfo-defun-type '('defun-type "Function"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2618 (put 'defun 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2619 (put 'defunx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2620
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2621 (put 'defmac 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2622 (put 'defmacx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2623 (put 'defmac 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2624 (put 'defmac 'texinfo-defun-type '('defun-type "Macro"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2625 (put 'defmacx 'texinfo-defun-type '('defun-type "Macro"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2626 (put 'defmac 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2627 (put 'defmacx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2628
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2629 (put 'defspec 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2630 (put 'defspecx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2631 (put 'defspec 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2632 (put 'defspec 'texinfo-defun-type '('defun-type "Special form"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2633 (put 'defspecx 'texinfo-defun-type '('defun-type "Special form"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2634 (put 'defspec 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2635 (put 'defspecx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2636
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2637 (put 'defvr 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2638 (put 'defvrx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2639 (put 'defvr 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2640 (put 'defvr 'texinfo-defun-type '('deffn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2641 (put 'defvrx 'texinfo-defun-type '('deffn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2642 (put 'defvr 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2643 (put 'defvrx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2644
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2645 (put 'defvar 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2646 (put 'defvarx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2647 (put 'defvar 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2648 (put 'defvar 'texinfo-defun-type '('defun-type "Variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2649 (put 'defvarx 'texinfo-defun-type '('defun-type "Variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2650 (put 'defvar 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2651 (put 'defvarx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2652
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2653 (put 'defconst 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2654 (put 'defconstx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2655 (put 'defconst 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2656 (put 'defconst 'texinfo-defun-type '('defun-type "Constant"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2657 (put 'defconstx 'texinfo-defun-type '('defun-type "Constant"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2658 (put 'defconst 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2659 (put 'defconstx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2660
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2661 (put 'defcmd 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2662 (put 'defcmdx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2663 (put 'defcmd 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2664 (put 'defcmd 'texinfo-defun-type '('defun-type "Command"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2665 (put 'defcmdx 'texinfo-defun-type '('defun-type "Command"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2666 (put 'defcmd 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2667 (put 'defcmdx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2668
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2669 (put 'defopt 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2670 (put 'defoptx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2671 (put 'defopt 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2672 (put 'defopt 'texinfo-defun-type '('defun-type "User Option"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2673 (put 'defoptx 'texinfo-defun-type '('defun-type "User Option"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2674 (put 'defopt 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2675 (put 'defoptx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2676
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2677 (put 'deftp 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2678 (put 'deftpx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2679 (put 'deftp 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2680 (put 'deftp 'texinfo-defun-type '('deftp-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2681 (put 'deftpx 'texinfo-defun-type '('deftp-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2682 (put 'deftp 'texinfo-defun-index 'texinfo-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2683 (put 'deftpx 'texinfo-defun-index 'texinfo-tindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2684
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2685 ;;; Object-oriented stuff is a little hairier.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2686
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2687 (put 'defop 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2688 (put 'defopx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2689 (put 'defop 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2690 (put 'defop 'texinfo-defun-type '('defop-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2691 (put 'defopx 'texinfo-defun-type '('defop-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2692 (put 'defop 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2693 (put 'defopx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2694
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2695 (put 'defmethod 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2696 (put 'defmethodx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2697 (put 'defmethod 'texinfo-end 'texinfo-end-defun)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2698 (put 'defmethod 'texinfo-defun-type '('defmethod-type "Method"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2699 (put 'defmethodx 'texinfo-defun-type '('defmethod-type "Method"))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2700 (put 'defmethod 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2701 (put 'defmethodx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2702
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2703 (put 'defcv 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2704 (put 'defcvx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2705 (put 'defcv 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2706 (put 'defcv 'texinfo-defun-type '('defop-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2707 (put 'defcvx 'texinfo-defun-type '('defop-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2708 (put 'defcv 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2709 (put 'defcvx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2710
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2711 (put 'defivar 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2712 (put 'defivarx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2713 (put 'defivar 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2714 (put 'defivar 'texinfo-defun-type '('defmethod-type "Instance variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2715 (put 'defivarx 'texinfo-defun-type '('defmethod-type "Instance variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2716 (put 'defivar 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2717 (put 'defivarx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2718
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2719 ;;; Typed functions and variables
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2720
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2721 (put 'deftypefn 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2722 (put 'deftypefnx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2723 (put 'deftypefn 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2724 (put 'deftypefn 'texinfo-defun-type '('deftypefn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2725 (put 'deftypefnx 'texinfo-defun-type '('deftypefn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2726 (put 'deftypefn 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2727 (put 'deftypefnx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2728
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2729 (put 'deftypefun 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2730 (put 'deftypefunx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2731 (put 'deftypefun 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2732 (put 'deftypefun 'texinfo-defun-type '('deftypefun-type "Function"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2733 (put 'deftypefunx 'texinfo-defun-type '('deftypefun-type "Function"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2734 (put 'deftypefun 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2735 (put 'deftypefunx 'texinfo-defun-index 'texinfo-findex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2736
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2737 (put 'deftypevr 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2738 (put 'deftypevrx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2739 (put 'deftypevr 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2740 (put 'deftypevr 'texinfo-defun-type '('deftypefn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2741 (put 'deftypevrx 'texinfo-defun-type '('deftypefn-type nil))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2742 (put 'deftypevr 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2743 (put 'deftypevrx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2744
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2745 (put 'deftypevar 'texinfo-format 'texinfo-format-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2746 (put 'deftypevarx 'texinfo-format 'texinfo-format-defunx)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2747 (put 'deftypevar 'texinfo-end 'texinfo-end-defun)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2748 (put 'deftypevar 'texinfo-defun-type '('deftypevar-type "Variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2749 (put 'deftypevarx 'texinfo-defun-type '('deftypevar-type "Variable"))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2750 (put 'deftypevar 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2751 (put 'deftypevarx 'texinfo-defun-index 'texinfo-vindex)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2752
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2753
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2754 ;;; @set, @clear, @ifset, @ifclear
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2755
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2756 ;; If a flag is set with @set FLAG, then text between @ifset and @end
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2757 ;; ifset is formatted normally, but if the flag is is cleared with
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2758 ;; @clear FLAG, then the text is not formatted; it is ignored.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2759
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2760 ;; If a flag is cleared with @clear FLAG, then text between @ifclear
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2761 ;; and @end ifclear is formatted normally, but if the flag is is set with
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2762 ;; @set FLAG, then the text is not formatted; it is ignored. @ifclear
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2763 ;; is the opposite of @ifset.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2764
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2765 ;; If a flag is set to a string with @set FLAG,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2766 ;; replace @value{FLAG} with the string.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2767 ;; If a flag with a value is cleared,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2768 ;; @value{FLAG} is invalid,
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2769 ;; as if there had never been any @set FLAG previously.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2770
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2771 (put 'clear 'texinfo-format 'texinfo-clear)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2772 (defun texinfo-clear ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2773 "Clear the value of the flag."
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2774 (let* ((arg (texinfo-parse-arg-discard))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2775 (flag (car (read-from-string arg)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2776 (value (substring arg (cdr (read-from-string arg)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2777 (put flag 'texinfo-whether-setp 'flag-cleared)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2778 (put flag 'texinfo-set-value "")))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2779
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2780 (put 'set 'texinfo-format 'texinfo-set)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2781 (defun texinfo-set ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2782 "Set the value of the flag, optionally to a string.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2783 The command `@set foo This is a string.'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2784 sets flag foo to the value: `This is a string.'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2785 The command `@value{foo}' expands to the value."
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2786 (let* ((arg (texinfo-parse-arg-discard))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2787 (flag (car (read-from-string arg)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2788 (value (substring arg (cdr (read-from-string arg)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2789 (put flag 'texinfo-whether-setp 'flag-set)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2790 (put flag 'texinfo-set-value value)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2791
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2792 (put 'value 'texinfo-format 'texinfo-value)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2793 (defun texinfo-value ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2794 "Insert the string to which the flag is set.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2795 The command `@set foo This is a string.'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2796 sets flag foo to the value: `This is a string.'
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2797 The command `@value{foo}' expands to the value."
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2798 (let ((arg (texinfo-parse-arg-discard)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2799 (cond ((and
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2800 (eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2801 'flag-set)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2802 (get (car (read-from-string arg)) 'texinfo-set-value))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2803 (insert (get (car (read-from-string arg)) 'texinfo-set-value)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2804 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2805 'flag-cleared)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2806 (insert (format "{No value for \"%s\"}" arg)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2807 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) nil)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2808 (insert (format "{No value for \"%s\"}" arg))))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2809
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2810 (put 'ifset 'texinfo-end 'texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2811 (put 'ifset 'texinfo-format 'texinfo-if-set)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2812 (defun texinfo-if-set ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2813 "If set, continue formatting; else do not format region up to @end ifset"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2814 (let ((arg (texinfo-parse-arg-discard)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2815 (cond
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2816 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2817 'flag-set)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2818 ;; Format the text (i.e., do not remove it); do nothing here.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2819 ())
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2820 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2821 'flag-cleared)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2822 ;; Clear region (i.e., cause the text to be ignored).
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2823 (delete-region texinfo-command-start
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2824 (progn (re-search-forward "@end ifset[ \t]*\n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2825 (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2826 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2827 nil)
5118
eec34ce70181 (texinfo-if-set, texinfo-if-clear): Act appropriately when flat neither
Robert J. Chassell <bob@rattlesnake.com>
parents: 4982
diff changeset
2828 ;; In this case flag is neither set nor cleared.
eec34ce70181 (texinfo-if-set, texinfo-if-clear): Act appropriately when flat neither
Robert J. Chassell <bob@rattlesnake.com>
parents: 4982
diff changeset
2829 ;; Act as if set, i.e. do nothing.
eec34ce70181 (texinfo-if-set, texinfo-if-clear): Act appropriately when flat neither
Robert J. Chassell <bob@rattlesnake.com>
parents: 4982
diff changeset
2830 ()))))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2831
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2832 (put 'ifclear 'texinfo-end 'texinfo-discard-command)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2833 (put 'ifclear 'texinfo-format 'texinfo-if-clear)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2834 (defun texinfo-if-clear ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2835 "If clear, continue formatting; if set, do not format up to @end ifset"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2836 (let ((arg (texinfo-parse-arg-discard)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2837 (cond
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2838 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2839 'flag-set)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2840 ;; Clear region (i.e., cause the text to be ignored).
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2841 (delete-region texinfo-command-start
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2842 (progn (re-search-forward "@end ifclear[ \t]*\n")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2843 (point))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2844 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2845 'flag-cleared)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2846 ;; Format the text (i.e., do not remove it); do nothing here.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2847 ())
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2848 ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2849 nil)
5118
eec34ce70181 (texinfo-if-set, texinfo-if-clear): Act appropriately when flat neither
Robert J. Chassell <bob@rattlesnake.com>
parents: 4982
diff changeset
2850 ;; In this case flag is neither set nor cleared.
eec34ce70181 (texinfo-if-set, texinfo-if-clear): Act appropriately when flat neither
Robert J. Chassell <bob@rattlesnake.com>
parents: 4982
diff changeset
2851 ;; Act as if clear, i.e. do nothing.
eec34ce70181 (texinfo-if-set, texinfo-if-clear): Act appropriately when flat neither
Robert J. Chassell <bob@rattlesnake.com>
parents: 4982
diff changeset
2852 ()))))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2853
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2854
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2855 ;;; Process included files: `@include' command
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2856
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2857 ;; Updated 19 October 1990
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2858 ;; In the original version, include files were ignored by Info but
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2859 ;; incorporated in to the printed manual. To make references to the
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2860 ;; included file, the Texinfo source file has to refer to the included
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2861 ;; files using the `(filename)nodename' format for refering to other
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2862 ;; Info files. Also, the included files had to be formatted on their
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2863 ;; own. It was just like they were another file.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2864
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2865 ;; Currently, include files are inserted into the buffer that is
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2866 ;; formatted for Info. If large, the resulting info file is split and
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2867 ;; tagified. For current include files to work, the master menu must
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2868 ;; refer to all the nodes, and the highest level nodes in the include
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2869 ;; files must have the correct next, prev, and up pointers.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2870
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2871 ;; The included file may have an @setfilename and even an @settitle,
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2872 ;; but not an `\input texinfo' line.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2873
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2874 ;; Updated 24 March 1993
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2875 ;; In order for @raisesections and @lowersections to work, included
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2876 ;; files must be inserted into the buffer holding the outer file
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2877 ;; before other Info formatting takes place. So @include is no longer
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2878 ;; is treated like other @-commands.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2879 (put 'include 'texinfo-format 'texinfo-format-noop)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2880
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2881 ; Original definition:
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2882 ; (defun texinfo-format-include ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2883 ; (let ((filename (texinfo-parse-arg-discard))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2884 ; (default-directory input-directory)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2885 ; subindex)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2886 ; (setq subindex
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2887 ; (save-excursion
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2888 ; (progn (find-file
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2889 ; (cond ((file-readable-p (concat filename ".texinfo"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2890 ; (concat filename ".texinfo"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2891 ; ((file-readable-p (concat filename ".texi"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2892 ; (concat filename ".texi"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2893 ; ((file-readable-p (concat filename ".tex"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2894 ; (concat filename ".tex"))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2895 ; ((file-readable-p filename)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2896 ; filename)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2897 ; (t (error "@include'd file %s not found"
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2898 ; filename))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2899 ; (texinfo-format-buffer-1))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2900 ; (texinfo-subindex 'texinfo-vindex (car subindex) (nth 1 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2901 ; (texinfo-subindex 'texinfo-findex (car subindex) (nth 2 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2902 ; (texinfo-subindex 'texinfo-cindex (car subindex) (nth 3 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2903 ; (texinfo-subindex 'texinfo-pindex (car subindex) (nth 4 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2904 ; (texinfo-subindex 'texinfo-tindex (car subindex) (nth 5 subindex))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2905 ; (texinfo-subindex 'texinfo-kindex (car subindex) (nth 6 subindex))))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2906 ;
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2907 ;(defun texinfo-subindex (indexvar file content)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2908 ; (set indexvar (cons (list 'recurse file content)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2909 ; (symbol-value indexvar))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2910
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2911 ; Second definition:
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2912 ; (put 'include 'texinfo-format 'texinfo-format-include)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2913 ; (defun texinfo-format-include ()
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2914 ; (let ((filename (concat input-directory
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2915 ; (texinfo-parse-arg-discard)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2916 ; (default-directory input-directory))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2917 ; (message "Reading: %s" filename)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2918 ; (save-excursion
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2919 ; (save-restriction
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2920 ; (narrow-to-region
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2921 ; (point)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2922 ; (+ (point) (car (cdr (insert-file-contents filename)))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2923 ; (goto-char (point-min))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2924 ; (texinfo-append-refill)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2925 ; (texinfo-format-convert (point-min) (point-max))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2926 ; (setq last-input-buffer input-buffer) ; to bypass setfilename
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2927 ; ))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2928
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2929
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2930 ;;; Numerous commands do nothing in Texinfo
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2931
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2932 ;; These commands are defined in texinfo.tex for printed output.
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2933
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2934 (put 'bye 'texinfo-format 'texinfo-discard-line)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2935 (put 'c 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2936 (put 'comment 'texinfo-format 'texinfo-discard-line-with-args)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2937 (put 'contents 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2938 (put 'finalout 'texinfo-format 'texinfo-discard-line)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2939 (put 'group 'texinfo-end 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2940 (put 'group 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2941 (put 'headings 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2942 (put 'hsize 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2943 (put 'itemindent 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2944 (put 'lispnarrowing 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2945 (put 'need 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2946 (put 'nopara 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2947 (put 'page 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2948 (put 'parindent 'texinfo-format 'texinfo-discard-line-with-args)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2949 (put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2950 (put 'setq 'texinfo-format 'texinfo-discard-line-with-args)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2951 (put 'settitle 'texinfo-format 'texinfo-discard-line-with-args)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2952 (put 'setx 'texinfo-format 'texinfo-discard-line-with-args)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2953 (put 'shortcontents 'texinfo-format 'texinfo-discard-line-with-args)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2954 (put 'smallbook 'texinfo-format 'texinfo-discard-line)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2955 (put 'summarycontents 'texinfo-format 'texinfo-discard-line-with-args)
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2956
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2957
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2958 ;;; Some commands cannot be handled
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2959
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2960 (defun texinfo-unsupported ()
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2961 (error "%s is not handled by texinfo"
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2962 (buffer-substring texinfo-command-start texinfo-command-end)))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2963
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2964 ;;; Batch formatting
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2965
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2966 (defun batch-texinfo-format ()
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2967 "Runs texinfo-format-buffer on the files remaining on the command line.
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2968 Must be used only with -batch, and kills emacs on completion.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2969 Each file will be processed even if an error occurred previously.
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2970 For example, invoke
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2971 \"emacs -batch -funcall batch-texinfo-format $docs/ ~/*.texinfo\"."
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2972 (if (not noninteractive)
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2973 (error "batch-texinfo-format may only be used -batch."))
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2974 (let ((version-control t)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2975 (auto-save-default nil)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2976 (find-file-run-dired nil)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2977 (kept-old-versions 259259)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2978 (kept-new-versions 259259))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2979 (let ((error 0)
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2980 file
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2981 (files ()))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2982 (while command-line-args-left
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2983 (setq file (expand-file-name (car command-line-args-left)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2984 (cond ((not (file-exists-p file))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2985 (message ">> %s does not exist!" file)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2986 (setq error 1
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2987 command-line-args-left (cdr command-line-args-left)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2988 ((file-directory-p file)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2989 (setq command-line-args-left
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2990 (nconc (directory-files file)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2991 (cdr command-line-args-left))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2992 (t
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2993 (setq files (cons file files)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2994 command-line-args-left (cdr command-line-args-left)))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
2995 (while files
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2996 (setq file (car files)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2997 files (cdr files))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2998 (condition-case err
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
2999 (progn
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3000 (if buffer-file-name (kill-buffer (current-buffer)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3001 (find-file file)
4769
d1b5ca8f5493 (texinfo-format-region texinfo-format-buffer): Add ###autoload cookies.
Brian Fox <bfox@gnu.org>
parents: 4396
diff changeset
3002 (buffer-disable-undo (current-buffer))
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3003 (set-buffer-modified-p nil)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3004 (texinfo-mode)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3005 (message "texinfo formatting %s..." file)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3006 (texinfo-format-buffer nil)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3007 (if (buffer-modified-p)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3008 (progn (message "Saving modified %s" (buffer-file-name))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3009 (save-buffer))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3010 (error
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3011 (message ">> Error: %s" (prin1-to-string err))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3012 (message ">> point at")
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3013 (let ((s (buffer-substring (point)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3014 (min (+ (point) 100)
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3015 (point-max))))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3016 (tem 0))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3017 (while (setq tem (string-match "\n+" s tem))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3018 (setq s (concat (substring s 0 (match-beginning 0))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3019 "\n>> "
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3020 (substring s (match-end 0)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3021 tem (1+ tem)))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3022 (message ">> %s" s))
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3023 (setq error 1))))
189
70bc47d3c6c9 Initial revision
Brian Preble <rassilon@gnu.org>
parents:
diff changeset
3024 (kill-emacs error))))
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
3025
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3026
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3027 ;;; Place `provide' at end of file.
3456
57089987a2de Provide texinfmt.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
3028 (provide 'texinfmt)
57089987a2de Provide texinfmt.
Richard M. Stallman <rms@gnu.org>
parents: 2233
diff changeset
3029
4396
0ab53cbfac0e Installed the version from the Texinfo package.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
3030 ;;; texinfmt.el ends here.