annotate lisp/textmodes/texinfmt.el @ 14875:27f8bccdb985

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