annotate lisp/textmodes/texinfmt.el @ 13337:84acc3adcd63

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