annotate lispref/permute-index @ 46512:8e08ec435afd

(move-to-column-force): Add autoload cookie to obsolescence declaration.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 18 Jul 2002 06:14:35 +0000
parents c189486396ff
children 23a1cea22d13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41200
c189486396ff Don't depend on csh-specific features. Replace
Eli Zaretskii <eliz@gnu.org>
parents: 41131
diff changeset
1 #!/bin/sh
41131
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2 # Generate a permuted index of all names.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
3 # The result is a file called index.fns.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
4
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
5 # Copyright (C) 2001 Free Software Foundation, Inc.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
6 #
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
7 # This file is part of GNU Emacs.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
8 #
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
9 # GNU Emacs is free software; you can redistribute it and/or modify
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
10 # it under the terms of the GNU General Public License as published by
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
11 # the Free Software Foundation; either version 2, or (at your option)
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
12 # any later version.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
13 #
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
14 # GNU Emacs is distributed in the hope that it will be useful,
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
17 # GNU General Public License for more details.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
18 #
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
19 # You should have received a copy of the GNU General Public License
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
20 # along with GNU Emacs; see the file COPYING. If not, write to the
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
21 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
22 # Boston, MA 02111-1307, USA.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
23
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
24 # You will need to modify this for your needs.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
25
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
26
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
27 set TEXINDEX=texindex # path to texindex command
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
28 #set EMACS=gnuemacs # your emacs command
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
29 #set TEX=tex # your tex command
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
30
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
31 set MANUAL=elisp # the base name of the manual
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
32
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
33 # goto 3
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
34
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
35 1:
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
36 echo "Extract raw index from texinfo fn index."
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
37 # Let texindex combine duplicate entries, later.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
38 # But it wants to protect non-alphanumerics thus confusing ptx.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
39 # Also change `\ ' to just a ` ', since texindex will fail. This is produced
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
40 # by `@findex two words' in an example environment (no doubt among others).
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
41 # delete wrapper parens
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
42 # change dots {} to dots{}
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
43 # change {-} to char form, so ptx wont ignore it.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
44 # delete leading \entry {
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
45 # change '\ ' to ' '
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
46 # change lines with = < > since they mess up field extraction.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
47 # separate into fields delimited by "
41200
c189486396ff Don't depend on csh-specific features. Replace
Eli Zaretskii <eliz@gnu.org>
parents: 41131
diff changeset
48 rm -f permuted.raw
41131
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
49 cat ${MANUAL}.fn | \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
50 sed \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
51 -e 's/(\([^)]*\))/\1/' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
52 -e 's/\\dots {}/(\\dots{})/' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
53 -e "s/{-}/{{\\tt\\char'055}}/" \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54 -e 's,^[^ ]* {,,' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
55 -e 's, },},' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
56 -e 's,\\ , ,g' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
57 -e 's/{\\tt\\char61}/=/' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
58 -e 's/{\\tt\\gtr}/>/' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
59 -e 's/{\\tt\\less}/</' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
60 -e 's/}{/"/g' \
41200
c189486396ff Don't depend on csh-specific features. Replace
Eli Zaretskii <eliz@gnu.org>
parents: 41131
diff changeset
61 | awk -F\" '{print $2, $1}' > permuted.raw
41131
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
62
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
63 2:
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
64 # Build break file for ptx.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
65 cat <<EOF > permuted.break
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
66 -
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
67 :
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
68 EOF
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
69 # Build the ignore file for ptx.
41200
c189486396ff Don't depend on csh-specific features. Replace
Eli Zaretskii <eliz@gnu.org>
parents: 41131
diff changeset
70 # We would like to ignore "and", "or", and "for",
41131
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
71 # but ptx ignores ignore words even if they stand alone.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
72 cat <<EOF > permuted.ignore
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
73 the
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
74 in
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
75 to
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
76 as
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
77 a
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
78 an
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
79 of
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
80 on
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
81 them
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
82 how
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
83 from
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
84 by
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
85 EOF
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
86
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
87 echo "Make troff permuted index."
41200
c189486396ff Don't depend on csh-specific features. Replace
Eli Zaretskii <eliz@gnu.org>
parents: 41131
diff changeset
88 rm -f permuted.t
41131
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
89 ptx -i permuted.ignore -b permuted.break -f -r -w 144 \
41200
c189486396ff Don't depend on csh-specific features. Replace
Eli Zaretskii <eliz@gnu.org>
parents: 41131
diff changeset
90 < permuted.raw > permuted.t
41131
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
91
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
92 3:
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
93 echo "Extract the desired fields."
41200
c189486396ff Don't depend on csh-specific features. Replace
Eli Zaretskii <eliz@gnu.org>
parents: 41131
diff changeset
94 rm -f permuted.fields
c189486396ff Don't depend on csh-specific features. Replace
Eli Zaretskii <eliz@gnu.org>
parents: 41131
diff changeset
95 awk -F\" '{printf "%s\"%s\"%s\n", $4,$6,$9}' permuted.t > permuted.fields
41131
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
96
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
97 4:
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
98 echo "Format for texindex."
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
99 # delete lines that start with "and ", "for "
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
100 sed < permuted.fields \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
101 -e 's/=/{\\tt\\char61}/' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
102 -e 's/>/{\\tt\\gtr}/' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
103 -e 's/</{\\tt\\less}/' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
104 -e '/"and /d' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
105 -e '/"for /d' \
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
106 | awk -F\" 'NF>0 {if ($1=="") {\
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
107 print "\entry {" $2 "}{" 0+$3 "}{" $2 "}" }\
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
108 else {\
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
109 print "\entry {" $2 ", " $1 "}{" 0+$3 "}{" $2 ", " $1 "}"} }'\
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
110 > permuted.fn
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
112 5:
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
113 echo "Sort with texindex."
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
114 ${TEXINDEX} permuted.fn
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
115 #mv permuted.fns ${MANUAL}.fns
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
116
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
117 # The resulting permuted.fns will be read when we run TeX
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
118 # on the manual the second time. Or you can use permuted.texinfo here.
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
119 #${TEX} permuted.texinfo
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
120
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
121 6:
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
122 echo "Clean up."
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
123 rm -f permuted.fields permuted.t permuted.raw
acbf83fe6df1 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
124 rm -f permuted.break permuted.ignore permuted.fn