annotate lisp/packages/man.el @ 82:6a378aca36af r20-0b91

Import from CVS: tag r20-0b91
author cvs
date Mon, 13 Aug 2007 09:07:36 +0200
parents 1ce6082ce73f
children 364816949b59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; man.el --- browse UNIX manual pages
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
2 ;; Keywords: help
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
4 ;; Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
5 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
19 ;; along with XEmacs; see the file COPYING. If not, write to the Free
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
20 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
22 ;; Mostly rewritten by Alan K. Stebbens <aks@hub.ucsb.edu> 11-apr-90.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
23 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
24 ;; o Match multiple man pages using TOPIC as a simple pattern
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
25 ;; o Search unformatted pages, even when formatted matches are found
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
26 ;; o Query the user as to which pages are desired
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
27 ;; o Use of the prefix arg to toggle/bypass the above features
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
28 ;; o Buffers named by the first topic in the buffer
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
29 ;; o Automatic uncompress for compressed man pages (.Z, .z, and .gz)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
30 ;; o View the resulting buffer using M-x view mode
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
31 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
32 ;; Modified 16-mar-91 by Jamie Zawinski <jwz@lucid.com> to default the
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
33 ;; manual topic to the symbol at point, just like find-tag does.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
34 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
35 ;; Modified 22-mar-93 by jwz to use multiple fonts and follow xrefs with mouse.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
36 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
37 ;; Modified 16-apr-93 by Dave Gillespie <daveg@synaptics.com> to make
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
38 ;; apropos work nicely; work correctly when bold or italic is unavailable;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
39 ;; reuse old buffer if topic is re-selected (in Manual-topic-buffer mode).
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
40 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
41 ;; Modified 4-apr-94 by jwz: merged in Tibor Polgar's code for manpath.conf.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
42 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
43 ;; Modified 19-apr-94 by Tibor Polgar <tlp00@spg.amdahl.com> to add support for
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
44 ;; $PAGER variable to be emacsclient and properly process man pages (assuming
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
45 ;; the man pages were built by man in /tmp. also fixed bug with man list being
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
46 ;; backwards.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
47 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
48 ;; Modified 23-aug-94 by Tibor Polgar <tlp00@spg.amdahl.com> to add support for
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
49 ;; displaying only one instance of a man page (Manual-unique-man-sections-only)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
50 ;; Fixed some more man page ordering bugs, bug with Manual-query-multiple-pages.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
51 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
52 ;; Modified 29-nov-94 by Ben Wing <wing@spg.amdahl.com>: small fixes
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
53 ;; that should hopefully make things work under HPUX and IRIX.;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
54 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
55 ;; Modified 15-jul-95 by Dale Atems <atems@physics.wayne.edu>:
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
56 ;; some extensive rewriting to make things work right (more or less)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
57 ;; under IRIX.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
58 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
59 ;; This file defines "manual-entry", and the remaining definitions all
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
60 ;; begin with "Manual-". This makes the autocompletion on "M-x man" work.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
61 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
62 ;; Variables of interest:
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
63 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
64 ;; Manual-program
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
65 ;; Manual-topic-buffer
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
66 ;; Manual-buffer-view-mode
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
67 ;; Manual-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
68 ;; Manual-formatted-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
69 ;; Manual-match-topic-exactly
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
70 ;; Manual-query-multiple-pages
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
71 ;; Manual-page-history
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
72 ;; Manual-subdirectory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
73 ;; Manual-man-page-section-ids
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
74 ;; Manual-formatted-page-prefix
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
75 ;; Manual-unformatted-page-prefix
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
76 ;; Manual-use-full-section-ids
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
78 (defvar Manual-program "man" "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
79 *Name of the program to invoke in order to format the source man pages.")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
80
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
81 (defvar Manual-section-switch (if (eq system-type 'usg-unix-v) "-s" nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
82 "SysV needs this to work right.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
84 (defvar Manual-topic-buffer t "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
85 *Non-nil means \\[Manual-entry] should output the manual entry for TOPIC into
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
86 a buffer named *man TOPIC*, otherwise, it should name the buffer
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
87 *Manual Entry*.")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
88
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
89 (defvar Manual-buffer-view-mode t "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
90 *Whether manual buffers should be placed in view-mode.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
91 nil means leave the buffer in fundamental-mode in another window.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
92 t means use `view-buffer' to display the man page in the current window.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
93 Any other value means use `view-buffer-other-window'.")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
94
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
95 (defvar Manual-match-topic-exactly t "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
96 *Non-nil means that \\[manual-entry] will match the given TOPIC exactly, rather
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
97 apply it as a pattern. When this is nil, and \"Manual-query-multiple-pages\"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
98 is non-nil, then \\[manual-entry] will query you for all matching TOPICs.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
99 This variable only has affect on the preformatted man pages (the \"cat\" files),
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
100 since the \"man\" command always does exact topic matches.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
102 (defvar Manual-query-multiple-pages nil "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
103 *Non-nil means that \\[manual-entry] will query the user about multiple man
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
104 pages which match the given topic. The query is done using the function
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
105 \"y-or-n-p\". If this variable is nil, all man pages with topics matching the
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
106 topic given to \\[manual-entry] will be inserted into the temporary buffer.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
107 See the variable \"Manual-match-topic-exactly\" to control the matching.")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
108
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
109 (defvar Manual-unique-man-sections-only nil
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
110 "*Only present one man page per section. This variable is useful if the same or
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
111 up/down level man pages for the same entry are present in mulitple man paths.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
112 When set to t, only the first entry found in a section is displayed, the others
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
113 are ignored without any messages or warnings. Note that duplicates can occur if
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
114 the system has both formatted and unformatted version of the same page.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
116 (defvar Manual-mode-hook nil
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
117 "Function or functions run on entry to Manual-mode.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
119 (defvar Manual-directory-list nil "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
120 *A list of directories used with the \"man\" command, where each directory
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
121 contains a set of \"man?\" and \"cat?\" subdirectories. If this variable is nil,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
122 it is initialized by \\[Manual-directory-list-init].")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
123
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
124 (defvar Manual-formatted-directory-list nil "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
125 A list of directories containing formatted man pages. Initialized by
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
126 \\[Manual-directory-list-init].")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
127
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
128 (defvar Manual-unformatted-directory-list nil "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
129 A list of directories containing the unformatted (source) man pages.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
130 Initialized by \\[Manual-directory-list-init].")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
131
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
132 (defvar Manual-page-history nil "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
133 A list of names of previously visited man page buffers.")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
134
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
135 (defvar Manual-manpath-config-file "/usr/lib/manpath.config"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
136 "*Location of the manpath.config file, if any.")
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
137
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
138 (defvar Manual-apropos-switch "-k"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
139 "*Man apropos switch")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
140
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
141 ;; New variables.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
142
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
143 (defvar Manual-subdirectory-list nil "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
144 A list of all the subdirectories in which man pages may be found.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
145 Iniialized by Manual-directory-list-init.")
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 8
diff changeset
146
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
147 ;; This is for SGI systems; don't know what it should be otherwise.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
148 (defvar Manual-man-page-section-ids "1nl6823457poD" "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
149 String containing all suffix characters for \"cat\" and \"man\"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
150 that identify valid sections of the Un*x manual.")
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 8
diff changeset
151
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
152 (defvar Manual-formatted-page-prefix "cat" "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
153 Prefix for directories where formatted man pages are to be found.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
154 Defaults to \"cat\".")
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 8
diff changeset
155
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
156 (defvar Manual-unformatted-page-prefix "man" "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
157 Prefix for directories where unformatted man pages are to be found.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
158 Defaults to \"man\".")
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 8
diff changeset
159
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
160 (defvar Manual-leaf-signature "" "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
161 Regexp for identifying \"leaf\" subdirectories in the search path.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
162 If empty, initialized by Manual-directory-list-init.")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
163
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
164 (defvar Manual-use-full-section-ids t "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
165 If non-nil, pass full section ids to Manual-program, otherwise pass
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
166 only the first character. Defaults to 't'.")
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 8
diff changeset
167
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
168 (defvar Manual-use-subdirectory-list (eq system-type 'irix) "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
169 This makes manual-entry work correctly on SGI machines but it
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
170 imposes a large startup cost which is why it is not simply on by
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
171 default on all systems.")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
172
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
173 (defvar Manual-use-rosetta-man (not (null (locate-file "rman" exec-path))) "\
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
174 If non-nil, use RosettaMan (rman) to filter man pages.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
175 This makes man-page cleanup virtually instantaneous, instead of
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
176 potentially taking a long time.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
177
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
178 Here is information on RosettaMan, from Neal.Becker@comsat.com (Neal Becker):
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
179
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
180 RosettaMan is a filter for UNIX manual pages. It takes as input man
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
181 pages formatted for a variety of UNIX flavors (not [tn]roff source)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
182 and produces as output a variety of file formats. Currently
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
183 RosettaMan accepts man pages as formatted by the following flavors of
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
184 UNIX: Hewlett-Packard HP-UX, AT&T System V, SunOS, Sun Solaris, OSF/1,
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
185 DEC Ultrix, SGI IRIX, Linux, SCO; and produces output for the following
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
186 formats: printable ASCII only (stripping page headers and footers),
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
187 section and subsection headers only, TkMan, [tn]roff, Ensemble, RTF,
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
188 SGML (soon--I finally found a DTD), HTML, MIME, LaTeX, LaTeX 2e, Perl 5's pod.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
189
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
190 RosettaMan improves on other man page filters in several ways: (1) its
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
191 analysis recognizes the structural pieces of man pages, enabling high
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
192 quality output, (2) its modular structure permits easy augmentation of
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
193 output formats, (3) it accepts man pages formatted with the varient
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
194 macros of many different flavors of UNIX, and (4) it doesn't require
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
195 modification or cooperation with any other program.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
196
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
197 RosettaMan is a rewrite of TkMan's man page filter, called bs2tk. (If
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
198 you haven't heard about TkMan, a hypertext man page browser, you
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
199 should grab it via anonymous ftp from ftp.cs.berkeley.edu:
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
200 /ucb/people/phelps/tkman.tar.Z.) Whereas bs2tk generated output only for
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
201 TkMan, RosettaMan generalizes the process so that the analysis can be
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
202 leveraged to new output formats. A single analysis engine recognizes
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
203 section heads, subsection heads, body text, lists, references to other
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
204 man pages, boldface, italics, bold italics, special characters (like
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
205 bullets), tables (to a degree) and strips out page headers and
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
206 footers. The engine sends signals to the selected output functions so
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
207 that an enhancement in the engine improves the quality of output of
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
208 all of them. Output format functions are easy to add, and thus far
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
209 average about about 75 lines of C code each.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
210
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
211
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
212
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
213 *** NOTES ON CURRENT VERSION ***
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
214
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
215 Help! I'm looking for people to help with the following projects.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
216 \(1) Better RTF output format. The current one works, but could be
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
217 made better. (2) Roff macros that produce text that is easily
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
218 parsable. RosettaMan handles a great variety, but some things, like
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
219 H-P's tables, are intractable. If you write an output format or
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
220 otherwise improve RosettaMan, please send in your code so that I may
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
221 share the wealth in future releases.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
222
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
223 This version can try to identify tables (turn this on with the -T
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
224 switch) by looking for lines with a large amount of interword spacing,
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
225 reasoning that this is space between columns of a table. This
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
226 heuristic doesn't always work and sometimes misidentifies ordinary
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
227 text as tables. In general I think it is impossible to perfectly
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
228 identify tables from nroff formatted text. However, I do think the
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
229 heuristics can be tuned, so if you have a collection of manual pages
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
230 with unrecognized tables, send me the lot, in formatted form (i.e.,
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
231 after formatting with nroff -man), and uuencode them to preserve the
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
232 control characters. Better, if you can think of heuristics that
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
233 distinguish tables from ordinary text, I'd like to hear them.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
234
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
235
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
236 Notes for HTML consumers: This filter does real (heuristic)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
237 parsing--no <PRE>! Man page references are turned into hypertext links.")
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
238
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
239 (make-face 'man-italic)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
240 (or (face-differs-from-default-p 'man-italic)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
241 (copy-face 'italic 'man-italic))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
242 ;; XEmacs (from Darrell Kindred): underlining is annoying due to
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
243 ;; large blank spaces in this face.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
244 ;; (or (face-differs-from-default-p 'man-italic)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
245 ;; (set-face-underline-p 'man-italic t))
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 8
diff changeset
246
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
247 (make-face 'man-bold)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
248 (or (face-differs-from-default-p 'man-bold)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
249 (copy-face 'bold 'man-bold))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
250 (or (face-differs-from-default-p 'man-bold)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
251 (copy-face 'man-italic 'man-bold))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
253 (make-face 'man-heading)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
254 (or (face-differs-from-default-p 'man-heading)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
255 (copy-face 'man-bold 'man-heading))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
257 (make-face 'man-xref)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
258 (or (face-differs-from-default-p 'man-xref)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
259 (set-face-underline-p 'man-xref t))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
260
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
261 ;; Manual-directory-list-init
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
262 ;; Initialize the directory lists.
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
263
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
264 (defun Manual-directory-list-init (&optional arg)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
265 "Initialize the Manual-directory-list variable from $MANPATH
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
266 if it is not already set, or if a prefix argument is provided."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
267 (interactive "P")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
268 (if arg (setq Manual-directory-list nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
269 (if (null Manual-directory-list)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
270 (let ((manpath (getenv "MANPATH"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
271 (global (Manual-manpath-config-contents))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
272 (dirlist nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
273 dir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
274 (cond ((and manpath global)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
275 (setq manpath (concat manpath ":" global)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
276 (global
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
277 (setq manpath global))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
278 ((not manpath)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
279 ;; XEmacs - (bpw/stig) Unix-specifix hack for lusers w/ no manpath
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
280 (setq manpath "/usr/local/man:/usr/share/man:/usr/contrib/man:/usr/X11/man:/usr/man:/usr/catman")))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
281 ;; Make sure that any changes we've made internally are seen by man.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
282 (setenv "MANPATH" manpath)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
283 (while (string-match "\\`:*\\([^:]+\\)" manpath)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
284 (setq dir (substring manpath (match-beginning 1) (match-end 1)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
285 (and (not (member dir dirlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
286 (setq dirlist (cons dir dirlist)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
287 (setq manpath (substring manpath (match-end 0))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
288 (setq dirlist (nreverse dirlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
289 (setq Manual-directory-list dirlist)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
290 (setq Manual-subdirectory-list nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
291 (setq Manual-formatted-directory-list nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
292 (setq Manual-unformatted-directory-list nil)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
293 (if (string-equal Manual-leaf-signature "")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
294 (setq Manual-leaf-signature
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
295 (concat "/\\("
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
296 Manual-formatted-page-prefix
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
297 "\\|" Manual-unformatted-page-prefix
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
298 "\\)"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
299 "[" Manual-man-page-section-ids
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
300 "].?/.")))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
301 (if Manual-use-subdirectory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
302 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
303 (if (null Manual-subdirectory-list)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
304 (setq Manual-subdirectory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
305 (Manual-all-subdirectories Manual-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
306 Manual-leaf-signature nil)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
307 (if (null Manual-formatted-directory-list)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
308 (setq Manual-formatted-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
309 (Manual-filter-subdirectories Manual-subdirectory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
310 Manual-formatted-page-prefix)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
311 (if (null Manual-unformatted-directory-list)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
312 (setq Manual-unformatted-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
313 (Manual-filter-subdirectories Manual-subdirectory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
314 Manual-unformatted-page-prefix))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
315 (if (null Manual-formatted-directory-list)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
316 (setq Manual-formatted-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
317 (Manual-select-subdirectories Manual-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
318 Manual-formatted-page-prefix)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
319 (if (null Manual-unformatted-directory-list)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
320 (setq Manual-unformatted-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
321 (Manual-select-subdirectories Manual-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
322 Manual-unformatted-page-prefix)))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
323
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
324
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
325 (defun Manual-manpath-config-contents ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
326 "Parse the `Manual-manpath-config-file' file, if any.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
327 Returns a string like in $MANPATH."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
328 (if (and Manual-manpath-config-file
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
329 (file-readable-p Manual-manpath-config-file))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
330 (let ((buf (get-buffer-create " *Manual-config*"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
331 path)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
332 (set-buffer buf)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
333 (buffer-disable-undo buf)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
334 (erase-buffer)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
335 (insert-file-contents Manual-manpath-config-file)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
336 (while (re-search-forward "^\\(MANDATORY_MANPATH\\|MANPATH_MAP\\)"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
337 nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
338 (and (re-search-forward "\\(/[^ \t\n]+\\)[ \t]*$")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
339 (setq path (concat path (buffer-substring (match-beginning 1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
340 (match-end 1))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
341 ":"))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
342 (kill-buffer buf)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
343 path)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
344 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
345 ;; manual-entry -- The "main" user function
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
346 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ;;;###autoload
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
349 (defun manual-entry (topic &optional arg silent)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
350 "Display the Unix manual entry (or entries) for TOPIC.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
351 If prefix arg is given, modify the search according to the value:
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
352 2 = complement default exact matching of the TOPIC name;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
353 exact matching default is specified by `Manual-match-topic-exactly'
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
354 3 = force a search of the unformatted man directories
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
355 4 = both 2 and 3
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
356 The manual entries are searched according to the variable
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
357 Manual-directory-list, which should be a list of directories. If
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
358 Manual-directory-list is nil, \\[Manual-directory-list-init] is
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
359 invoked to create this list from the MANPATH environment variable.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
360 See the variable Manual-topic-buffer which controls how the buffer
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
361 is named. See also the variables Manual-match-topic-exactly,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
362 Manual-query-multiple-pages, and Manual-buffer-view-mode."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
363 (interactive
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
364 (list (let* ((fmh "-A-Za-z0-9_.")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
365 (default (save-excursion
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
366 (buffer-substring
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
367 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
368 (re-search-backward "\\sw" nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
369 (skip-chars-backward fmh) (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
370 (progn (skip-chars-forward fmh) (point)))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
371 (thing (read-string
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
372 (if (equal default "") "Manual entry: "
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
373 (concat "Manual entry: (default " default ") ")))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
374 (if (equal thing "") default thing))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
375 (prefix-numeric-value current-prefix-arg)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
376 ;;(interactive "sManual entry (topic): \np")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
377 (or arg (setq arg 1))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
378 (Manual-directory-list-init nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
379 (let ((exact (if (or (= arg 2) (= arg 4))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
380 (not Manual-match-topic-exactly)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
381 Manual-match-topic-exactly))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
382 (force (if (>= arg 3)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
383 t
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
384 nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
385 section fmtlist manlist apropos-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
386 (let ((case-fold-search nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
387 (if (and (null section)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
388 (string-match
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
389 "\\`[ \t]*\\([^( \t]+\\)[ \t]*(\\(.+\\))[ \t]*\\'" topic))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
390 (setq section (substring topic (match-beginning 2)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
391 (match-end 2))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
392 topic (substring topic (match-beginning 1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
393 (match-end 1)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
394 (if (string-match "\\`[ \t]*-k[ \t]+\\([^ \t]+\\)\\'" topic)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
395 (setq section "-k"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
396 topic (substring topic (match-beginning 1))))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
397 (if (equal section "-k")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
398 (setq apropos-mode t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
399 (or silent
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
400 (message "Looking for formatted entry for %s%s..."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
401 topic (if section (concat "(" section ")") "")))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
402 (setq fmtlist (Manual-select-man-pages
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
403 Manual-formatted-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
404 topic section exact '()))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
405 (if (or force (not section) (null fmtlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
406 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
407 (or silent
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
408 (message "%sooking for unformatted entry for %s%s..."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
409 (if fmtlist "L" "No formatted entry, l")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
410 topic (if section (concat "(" section ")") "")))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
411 (setq manlist (Manual-select-man-pages
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
412 Manual-unformatted-directory-list
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
413 topic section exact (if force '() fmtlist))))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
414
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
415 ;; Delete duplicate man pages (a file of the same name in multiple
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
416 ;; directories.)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
417 (or nil ;force
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
418 (let ((rest (append fmtlist manlist)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
419 (while rest
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
420 (let ((rest2 (cdr rest)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
421 (while rest2
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
422 (if (equal (file-name-nondirectory (car rest))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
423 (file-name-nondirectory (car rest2)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
424 (setq fmtlist (delq (car rest2) fmtlist)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
425 manlist (delq (car rest2) manlist)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
426 (setq rest2 (cdr rest2))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
427 (setq rest (cdr rest)))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
428
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
429 (if (not (or fmtlist manlist apropos-mode))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
430 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
431 (message "No entries found for %s%s" topic
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
432 (if section (concat "(" section ")") ""))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
433 nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
434 (let ((bufname (cond ((not Manual-topic-buffer)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
435 ;; What's the point of retaining this?
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
436 (if apropos-mode
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
437 "*Manual Apropos*"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
438 "*Manual Entry*"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
439 (apropos-mode
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
440 (concat "*man apropos " topic "*"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
441 (t
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
442 (concat "*man "
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
443 (cond (exact
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
444 (if section
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
445 (concat topic "." section)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
446 topic))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
447 ((or (cdr fmtlist) (cdr manlist)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
448 (and fmtlist manlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
449 ;; more than one entry found
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
450 (concat topic "..."))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
451 (t
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
452 (file-name-nondirectory
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
453 (car (or fmtlist manlist)))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
454 "*"))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
455 (temp-buffer-show-function
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
456 (cond ((eq 't Manual-buffer-view-mode) 'view-buffer)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
457 ((eq 'nil Manual-buffer-view-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
458 temp-buffer-show-function)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
459 (t 'view-buffer-other-window))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
460
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
461 (if apropos-mode
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
462 (setq manlist (list (format "%s.%s" topic section))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
463
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
464 (cond
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
465 ((and Manual-topic-buffer (get-buffer bufname))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
466 ;; reselect an old man page buffer if it exists already.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
467 (save-excursion
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
468 (set-buffer (get-buffer bufname))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
469 (Manual-mode))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
470 (if temp-buffer-show-function
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
471 (funcall temp-buffer-show-function (get-buffer bufname))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
472 (display-buffer bufname)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
473 (t
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
474 (with-output-to-temp-buffer bufname
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
475 (buffer-disable-undo standard-output)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
476 (save-excursion
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
477 (set-buffer standard-output)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
478 (setq buffer-read-only nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
479 (erase-buffer)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
480 (Manual-insert-pages fmtlist manlist apropos-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
481 (set-buffer-modified-p nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
482 (Manual-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
483 ))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
484 (setq Manual-page-history
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
485 (cons (buffer-name)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
486 (delete (buffer-name) Manual-page-history)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
487 (message nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
488 t))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
489
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
490 (defun Manpage-apropos (topic &optional arg silent)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
491 "Apropos on Unix manual pages for TOPIC.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
492 It calls the function `manual-entry'. Look at this function for
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
493 further description. Look also at the variable `Manual-apropos-switch',
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
494 if this function doesn't work on your system."
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
495 (interactive
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
496 (list (let* ((fmh "-A-Za-z0-9_.")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
497 (default (save-excursion
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
498 (buffer-substring
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
499 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
500 (re-search-backward "\\sw" nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
501 (skip-chars-backward fmh) (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
502 (progn (skip-chars-forward fmh) (point)))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
503 (thing (read-string
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
504 (if (equal default "") "Manual entry: "
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
505 (concat "Manual entry: (default " default ") ")))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
506 (if (equal thing "") default thing))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
507 (prefix-numeric-value current-prefix-arg)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
508 (manual-entry (concat Manual-apropos-switch " " topic) arg silent))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
509
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
510 (defun Manual-insert-pages (fmtlist manlist apropos-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
511 (let ((sep (make-string 65 ?-))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
512 name start end topic section)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
513 (while fmtlist ; insert any formatted files
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
514 (setq name (car fmtlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
515 (goto-char (point-max))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
516 (setq start (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
517 ;; In case the file can't be read or uncompressed or
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
518 ;; something like that.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
519 (condition-case ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
520 (Manual-insert-man-file name)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
521 (file-error nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
522 (goto-char (point-max))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
523 (setq end (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
524 (save-excursion
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
525 (save-restriction
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
526 (message "Cleaning manual entry for %s..."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
527 (file-name-nondirectory name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
528 (narrow-to-region start end)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
529 (Manual-nuke-nroff-bs)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
530 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
531 (insert "File: " name "\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
532 (goto-char (point-max))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
533 ))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
534 (if (or (cdr fmtlist) manlist)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
535 (insert "\n\n" sep "\n"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
536 (setq fmtlist (cdr fmtlist)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
537
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
538 (while manlist ; process any unformatted files
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
539 (setq name (car manlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
540 (or (string-match "\\([^/]+\\)\\.\\([^./]+\\)\\(\\.gz\\'\\)" name)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
541 (string-match "\\([^/]+\\)\\.\\([^./]+\\)\\'" name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
542 (setq topic (substring name (match-beginning 1) (match-end 1)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
543 (setq section (substring name (match-beginning 2) (match-end 2)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
544 ;; This won't work under IRIX, because SGI man accepts only the
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
545 ;; "main" (one-character) section id, not full section ids
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
546 ;; like 1M, 3X, etc. Put (setq Manual-use-full-section-ids nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
547 ;; in your .emacs to work around this problem.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
548 (if (not (or Manual-use-full-section-ids (string-equal section "")))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
549 (setq section (substring section 0 1)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
550 (message "Invoking man %s%s %s..."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
551 (if Manual-section-switch
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
552 (concat Manual-section-switch " ")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
553 "")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
554 section topic)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
555 (setq start (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
556 (Manual-run-formatter name topic section)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
557 (setq end (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
558 (save-excursion
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
559 (save-restriction
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
560 (message "Cleaning manual entry for %s(%s)..." topic section)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
561 (narrow-to-region start end)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
562 (Manual-nuke-nroff-bs apropos-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
563 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
564 (insert "File: " name "\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
565 (goto-char (point-max))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
566 ))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
567 (if (cdr manlist)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
568 (insert "\n\n" sep "\n"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
569 (setq manlist (cdr manlist))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
570 (if (< (buffer-size) 200)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
571 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
572 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
573 (if (looking-at "^File: ")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
574 (forward-line 1))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
575 (error (buffer-substring (point) (progn (end-of-line) (point))))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
576 nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
577
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
578 (defvar Manual-entry-switches '("-s")
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
579 "Switches for `manual-entry' including switch for section (at the end).")
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
580 (defvar Manual-apropos-switches nil
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
581 "Additional switches for `Manpage-apropos' excluding switch `-k'.")
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
582
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
583 (defun Manual-run-formatter (name topic section)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
584 (cond ((string-match "roff\\'" Manual-program)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
585 ;; kludge kludge
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
586 (call-process Manual-program nil t nil "-Tman" "-man" name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
587 (t
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
588 (apply 'call-process Manual-program nil t nil
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
589 (append (if apropos-mode
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
590 Manual-apropos-switches
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
591 Manual-entry-switches)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 76
diff changeset
592 (list section topic))))))
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
593
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
594 (defvar Manual-mode-map
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
595 (let ((m (make-sparse-keymap)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
596 (set-keymap-name m 'Manual-mode-map)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
597 (define-key m "l" 'Manual-last-page)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
598 (define-key m 'button2 'Manual-follow-xref)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
599 (define-key m 'button3 'Manual-popup-menu)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
600 m))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
601
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
602 (defun Manual-mode ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
603 (kill-all-local-variables)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
604 (setq buffer-read-only t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
605 (use-local-map Manual-mode-map)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
606 (setq major-mode 'Manual-mode
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
607 mode-name "Manual")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
608 ;; man pages with long lines are buggy!
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
609 ;; This looks slightly better if they only
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
610 ;; overran by a couple of chars.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
611 (setq truncate-lines t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
612 ;; turn off horizontal scrollbars in this buffer
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
613 (when (featurep 'scrollbar)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
614 (set-specifier scrollbar-height (cons (current-buffer) 0)))
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
615 (run-hooks 'Manual-mode-hook))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
616
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
617 (defun Manual-last-page ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
618 (interactive)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
619 (while (or (not (get-buffer (car (or Manual-page-history
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
620 (error "No more history.")))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
621 (eq (get-buffer (car Manual-page-history)) (current-buffer)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
622 (setq Manual-page-history (cdr Manual-page-history)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
623 (switch-to-buffer (car Manual-page-history)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
624
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
625
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
626 ;; Manual-select-subdirectories
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
627 ;; Given a DIRLIST and a SUBDIR name, return all subdirectories of the former which
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
628 ;; match the latter.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
629
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
630 (defun Manual-select-subdirectories (dirlist subdir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
631 (let ((dirs '())
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
632 (case-fold-search nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
633 (match (concat "\\`" (regexp-quote subdir)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
634 d)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
635 (while dirlist
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
636 (setq d (car dirlist) dirlist (cdr dirlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
637 (if (file-directory-p d)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
638 (let ((files (directory-files d t match nil 'dirs-only))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
639 (dir-temp '()))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
640 (while files
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
641 (if (file-executable-p (car files))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
642 (setq dir-temp (cons (file-name-as-directory (car files))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
643 dir-temp)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
644 (setq files (cdr files)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
645 (and dir-temp
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
646 (setq dirs (append dirs (nreverse dir-temp)))))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
647 dirs))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
648
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
649
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
650 ;; Manual-filter-subdirectories
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
651 ;; Given a DIRLIST and a SUBDIR name, return all members of the former
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
652 ;; which match the latter.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
653
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
654 (defun Manual-filter-subdirectories (dirlist subdir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
655 (let ((match (concat
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
656 "/"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
657 (regexp-quote subdir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
658 "[" Manual-man-page-section-ids "]"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
659 slist dir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
660 (while dirlist
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
661 (setq dir (car dirlist) dirlist (cdr dirlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
662 (if (and (file-executable-p dir) (string-match match dir))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
663 (setq slist (cons dir slist))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
664 (nreverse slist)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
665
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
666
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
667 (defun Manual-all-subdirectories (dirlist leaf-signature dirs &optional silent) "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
668 Given a DIRLIST, return a backward-sorted list of all subdirectories
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
669 thereof, prepended to DIRS if non-nil. This function calls itself
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
670 recursively until subdirectories matching LEAF-SIGNATURE are reached,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
671 or the hierarchy has been thoroughly searched. This code is a modified
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
672 version of a function written by Tim Bradshaw (tfb@ed.ac.uk)."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
673 (Manual-all-subdirectories-noloop dirlist leaf-signature dirs nil silent))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
674
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
675 (defun Manual-all-subdirectories-noloop (dirlist leaf-signature dirs been &optional silent) "\
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
676 Does the job of manual-all-subdirectories and keeps track of where it
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
677 has been to avoid loops."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
678 (let (dir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
679 (while dirlist
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
680 (setq dir (car dirlist) dirlist (cdr dirlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
681 (if (file-directory-p dir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
682 (let ((dir-temp (cons (file-name-as-directory dir) dirs)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
683 ;; Without feedback the user might wonder about the delay!
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
684 (or silent (message
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
685 "Building list of search directories... %s"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
686 (car dir-temp)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
687 (if (member (file-truename dir) been)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
688 () ; Ignore. We have been here before
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
689 (setq been (cons (file-truename dir) been))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
690 (setq dirs
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
691 (if (string-match leaf-signature dir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
692 dir-temp
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
693 (Manual-all-subdirectories-noloop
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
694 (directory-files dir t "[^.]$" nil 'dirs-only)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
695 leaf-signature dir-temp been silent))))))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
696 dirs)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
697
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
698
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
699 (defvar Manual-bogus-file-pattern "\\.\\(lpr\\|ps\\|PS\\)\\'"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
700 "Some systems have files in the man/man*/ directories which aren't man pages.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
701 This pattern is used to prune those files.")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
702
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
703 ;; Manual-select-man-pages
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
704 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
705 ;; Given a DIRLIST, discover all filenames which complete given the TOPIC
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
706 ;; and SECTION.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
707
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
708 ;; ## Note: BSD man looks for .../man1/foo.1 and .../man1/$MACHINE/foo.1
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
709
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
710 ;; ## Fixed for SGI IRIX 5.x on Sat Jul 15 1995 by Dale Atems
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
711 ;; (atems@physics.wayne.edu).
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
712
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
713 (defun Manual-select-man-pages (dirlist topic section exact shadow)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
714 (let ((case-fold-search nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
715 (and section
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
716 (let ((l '())
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
717 ;;(match (concat (substring section 0 1) "/?\\'"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
718 ;; ^^^
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
719 ;; We'll lose any pages inside subdirectories of the "standard"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
720 ;; ones if we insist on this! The following regexp should
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
721 ;; match any directory ending with the full section id or
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
722 ;; its first character, or any direct subdirectory thereof:
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
723 (match (concat "\\("
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
724 (regexp-quote section)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
725 "\\|"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
726 (substring section 0 1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
727 "\\)/?"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
728 d)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
729 (while dirlist
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
730 (setq d (car dirlist) dirlist (cdr dirlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
731 (if (string-match match d)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
732 (setq l (cons d l))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
733 (setq dirlist l)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
734 (if shadow
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
735 (setq shadow (concat "/\\("
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
736 (mapconcat #'(lambda (n)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
737 (regexp-quote
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
738 (file-name-nondirectory n)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
739 shadow
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
740 "\\|")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
741 "\\)\\'")))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
742 (let ((manlist '())
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
743 (match (concat "\\`"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
744 (regexp-quote topic)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
745 ;; **Note: on IRIX the preformatted pages
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
746 ;; are packed, so they end with ".z". This
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
747 ;; way you miss them if you specify a
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
748 ;; section. I don't see any point to it here
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
749 ;; even on BSD systems since we're looking
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
750 ;; one level down already, but I can't test
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
751 ;; this. More thought needed (???)
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
752
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
753 (cond ((and section
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
754 (not Manual-use-subdirectory-list))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
755 (concat "\\." (regexp-quote section)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
756 (exact
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
757 ;; If Manual-match-topic-exactly is
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
758 ;; set, then we must make sure the
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
759 ;; completions are exact, except for
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
760 ;; trailing weird characters after
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
761 ;; the section.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
762 "\\.")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
763 (t
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
764 ""))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
765 dir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
766 (while dirlist
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
767 (setq dir (car dirlist) dirlist (cdr dirlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
768 (if (not (file-directory-p dir))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
769 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
770 (message "warning: %s is not a directory" dir)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
771 ;;(sit-for 1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
772 )
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
773 (let ((files (directory-files dir t match nil t))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
774 f)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
775 (while files
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
776 (setq f (car files) files (cdr files))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
777 (cond ((string-match Manual-bogus-file-pattern f)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
778 ;(message "Bogus fule %s" f) (sit-for 2)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
779 )
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
780 ((and shadow (string-match shadow f))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
781 ;(message "Shadowed %s" f) (sit-for 2)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
782 )
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
783 ((not (file-readable-p f))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
784 ;(message "Losing with %s" f) (sit-for 2)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
785 )
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
786 (t
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
787 (setq manlist (cons f manlist))))))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
788 (setq manlist (nreverse manlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
789 (and Manual-unique-man-sections-only
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
790 (setq manlist (Manual-clean-to-unique-pages-only manlist)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
791 (if (and manlist Manual-query-multiple-pages)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
792 (apply #'append
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
793 (mapcar #'(lambda (page)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
794 (and page
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
795 (y-or-n-p (format "Read %s? " page))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
796 (list page)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
797 manlist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
798 manlist))))
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
799
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
800 (defun Manual-clean-to-unique-pages-only (manlist)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
801 "Prune the current list of pages down to a unique set."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
802 (let (page-name unique-pages)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
803 (apply 'append
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
804 (mapcar '(lambda (page)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
805 (cond (page
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
806 (and (string-match ".*/\\(.*\\)" page)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
807 (setq page-name (substring page (match-beginning 1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
808 (match-end 1)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
809 ;; try to clip off .Z, .gz suffixes
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
810 (and (string-match "\\(.*\\)\\.\\(.+\\)\\.\\(.+\\)"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
811 page-name)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
812 (setq page-name
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
813 (substring page-name (match-beginning 1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
814 (match-end 2)))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
815 ;; add Manual-unique-pages if it isn't there
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
816 ;; and return file
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
817 (if (and unique-pages
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
818 page-name
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
819 (string-match (concat "\\b" page-name "\\b")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
820 unique-pages))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
821 nil
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
822 (setq unique-pages (concat unique-pages
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
823 page-name
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
824 " "))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
825 (list page)))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
826 manlist))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
827
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
828
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
829
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
830 (defun Manual-insert-man-file (name)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
831 ;; Insert manual file (unpacked as necessary) into buffer
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
832 (cond ((equal (substring name -3) ".gz")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
833 (call-process "gunzip" nil t nil "--stdout" name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
834 ((or (equal (substring name -2) ".Z")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
835 ;; HPUX uses directory names that end in .Z and compressed
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
836 ;; files that don't. How gratuitously random.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
837 (let ((case-fold-search nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
838 (string-match "\\.Z/" name)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
839 (call-process "zcat" name t nil)) ;; XEmacs change for HPUX
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
840 ((equal (substring name -2) ".z")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
841 (call-process "pcat" nil t nil name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
842 (t
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
843 (insert-file-contents name))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
844
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
845 (defmacro Manual-delete-char (n)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
846 ;; in v19, delete-char is compiled as a function call, but delete-region
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
847 ;; is byte-coded, so it's much faster. (We were spending 40% of our time
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
848 ;; in delete-char alone.)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
849 (list 'delete-region '(point) (list '+ '(point) n)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
850
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
851 ;; Hint: BS stands form more things than "back space"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
852 (defun Manual-nuke-nroff-bs (&optional apropos-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
853 (interactive "*")
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
854 (if Manual-use-rosetta-man
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
855 (call-process-region (point-min) (point-max) "rman" t t nil)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
856 ;;
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
857 ;; turn underlining into italics
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
858 ;;
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
859 (goto-char (point-min))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
860 (while (search-forward "_\b" nil t)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
861 ;; searching for underscore-backspace and then comparing the following
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
862 ;; chars until the sequence ends turns out to be much faster than searching
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
863 ;; for a regexp which matches the whole sequence.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
864 (let ((s (match-beginning 0)))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
865 (goto-char s)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
866 (while (and (= (following-char) ?_)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
867 (= (char-after (1+ (point))) ?\b))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
868 (Manual-delete-char 2)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
869 (forward-char 1))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
870 (set-extent-face (make-extent s (point)) 'man-italic)))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
871 ;;
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
872 ;; turn overstriking into bold
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
873 ;;
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
874 (goto-char (point-min))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
875 (while (re-search-forward "\\([^\n]\\)\\(\b\\1\\)" nil t)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
876 ;; Surprisingly, searching for the above regexp is faster than searching
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
877 ;; for a backspace and then comparing the preceding and following chars,
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
878 ;; I presume because there are many false matches, meaning more funcalls
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
879 ;; to re-search-forward.
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
880 (let ((s (match-beginning 0)))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
881 (goto-char s)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
882 ;; Some systems (SGI) overstrike multiple times, eg, "M\bM\bM\bM".
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
883 (while (looking-at "\\([^\n]\\)\\(\b\\1\\)+")
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
884 (delete-region (+ (point) 1) (match-end 0))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
885 (forward-char 1))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
886 (set-extent-face (make-extent s (point)) 'man-bold)))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
887 ;;
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
888 ;; hack bullets: o^H+ --> +
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
889 (goto-char (point-min))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
890 (while (search-forward "\b" nil t)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
891 (Manual-delete-char -2))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
892
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
893 (if (> (buffer-size) 100) ; minor kludge
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
894 (Manual-nuke-nroff-bs-footers))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
895 ) ;; not Manual-use-rosetta-man
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
896 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
897 ;; turn subsection header lines into bold
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
898 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
899 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
900 (if apropos-mode
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
901 (while (re-search-forward "[a-zA-Z0-9] ([0-9]" nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
902 (forward-char -2)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
903 (delete-backward-char 1))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
904
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
905 ;; (while (re-search-forward "^[^ \t\n]" nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
906 ;; (set-extent-face (make-extent (match-beginning 0)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
907 ;; (progn (end-of-line) (point)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
908 ;; 'man-heading))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
909
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
910 ;; boldface the first line
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
911 (if (looking-at "[^ \t\n].*$")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
912 (set-extent-face (make-extent (match-beginning 0) (match-end 0))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
913 'man-bold))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
914
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
915 ;; boldface subsequent title lines
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
916 ;; Regexp to match section headers changed to match a non-indented
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
917 ;; line preceded by a blank line and followed by an indented line.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
918 ;; This seems to work ok for manual pages but gives better results
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
919 ;; with other nroff'd files
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
920 (while (re-search-forward "\n\n\\([^ \t\n].*\\)\n[ \t]+[^ \t\n]" nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
921 (goto-char (match-end 1))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
922 (set-extent-face (make-extent (match-beginning 1) (match-end 1))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
923 'man-heading)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
924 (forward-line 1))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
925 )
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
926
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
927 (if Manual-use-rosetta-man
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
928 nil
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
929 ;; Zap ESC7, ESC8, and ESC9
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
930 ;; This is for Sun man pages like "man 1 csh"
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
931 (goto-char (point-min))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
932 (while (re-search-forward "\e[789]" nil t)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
933 (replace-match "")))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 74
diff changeset
934
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
935 ;; Nuke blanks lines at start.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
936 ;; (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
937 ;; (skip-chars-forward "\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
938 ;; (delete-region (point-min) (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
939
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
940 (Manual-mouseify-xrefs)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
941 )
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
942
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
943 (fset 'nuke-nroff-bs 'Manual-nuke-nroff-bs) ; use old name
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
944
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
945
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
946 (defun Manual-nuke-nroff-bs-footers ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
947 ;; Nuke headers and footers.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
948 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
949 ;; nroff assumes pages are 66 lines high. We assume that, and that the
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
950 ;; first and last line on each page is expendible. There is no way to
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
951 ;; tell the difference between a page break in the middle of a paragraph
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
952 ;; and a page break between paragraphs (the amount of extra whitespace
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
953 ;; that nroff inserts is the same in both cases) so this might strip out
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
954 ;; a blank line were one should remain. I think that's better than
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
955 ;; leaving in a blank line where there shouldn't be one. (Need I say
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
956 ;; it: FMH.)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
957 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
958 ;; Note that if nroff spits out error messages, pages will be more than
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
959 ;; 66 lines high, and we'll lose badly. That's ok because standard
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
960 ;; nroff doesn't do any diagnostics, and the "gnroff" wrapper for groff
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
961 ;; turns off error messages for compatibility. (At least, it's supposed
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
962 ;; to.)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
963 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
964 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
965 ;; first lose the status output
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
966 (let ((case-fold-search t))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
967 (if (and (not (looking-at "[^\n]*warning"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
968 (looking-at "Reformatting.*\n"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
969 (delete-region (match-beginning 0) (match-end 0))))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
970
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
971 ;; kludge around a groff bug where it won't keep quiet about some
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
972 ;; warnings even with -Wall or -Ww.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
973 (cond ((looking-at "grotty:")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
974 (while (looking-at "grotty:")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
975 (delete-region (point) (progn (forward-line 1) (point))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
976 (if (looking-at " *done\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
977 (delete-region (point) (match-end 0)))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
978
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
979 (let ((pages '())
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
980 p)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
981 ;; collect the page boundary markers before we start deleting, to make
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
982 ;; it easier to strip things out without changing the page sizes.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
983 (while (not (eobp))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
984 (forward-line 66)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
985 (setq pages (cons (point-marker) pages)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
986 (setq pages (nreverse pages))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
987 (while pages
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
988 (goto-char (car pages))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
989 (set-marker (car pages) nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
990 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
991 ;; The lines are: 3 blank; footer; 6 blank; header; 3 blank.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
992 ;; We're in between the previous footer and the following header,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
993 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
994 ;; First lose 3 blank lines, the header, and then 3 more.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
995 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
996 (setq p (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
997 (skip-chars-forward "\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
998 (delete-region p (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
999 (and (looking-at "[^\n]+\n\n?\n?\n?")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1000 (delete-region (match-beginning 0) (match-end 0)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1001 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1002 ;; Next lose the footer, and the 3 blank lines after, and before it.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1003 ;; But don't lose the last footer of the manual entry; that contains
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1004 ;; the "last change" date, so it's not completely uninteresting.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1005 ;; (Actually lose all blank lines before it; sh(1) needs this.)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1006 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1007 (skip-chars-backward "\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1008 (beginning-of-line)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1009 (if (null (cdr pages))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1010 nil
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1011 (and (looking-at "[^\n]+\n\n?\n?\n?")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1012 (delete-region (match-beginning 0) (match-end 0))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1013 (setq p (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1014 (skip-chars-backward "\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1015 (if (> (- p (point)) 4)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1016 (delete-region (+ 2 (point)) p)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1017 (delete-region (1+ (point)) p))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1018 ; (and (looking-at "\n\n?\n?")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1019 ; (delete-region (match-beginning 0) (match-end 0)))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1020
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1021 (setq pages (cdr pages)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1022 ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1023 ;; Now nuke the extra blank lines at the beginning and end.
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1024 (goto-char (point-min))
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1025 (if (looking-at "\n+")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1026 (delete-region (match-beginning 0) (match-end 0)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1027 (forward-line 1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1028 (if (looking-at "\n\n+")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1029 (delete-region (1+ (match-beginning 0)) (match-end 0)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1030 (goto-char (point-max))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1031 (skip-chars-backward "\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1032 (delete-region (point) (point-max))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1033 (beginning-of-line)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1034 (forward-char -1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1035 (setq p (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1036 (skip-chars-backward "\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1037 (if (= ?\n (following-char)) (forward-char 1))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1038 (if (> (point) (1+ p))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1039 (delete-region (point) p))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1040 ))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1041
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1042 ;(defun Manual-nuke-nroff-bs-footers ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1043 ; ;; Nuke headers: "MORE(1) UNIX Programmer's Manual MORE(1)"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1044 ; (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1045 ; (while (re-search-forward "^ *\\([A-Za-z][-_A-Za-z0-9]*([0-9A-Za-z]+)\\).*\\1$" nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1046 ; (replace-match ""))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1047 ;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1048 ; ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1049 ; ;; it would appear that we have a choice between sometimes introducing
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1050 ; ;; an extra blank line when a paragraph was broken by a footer, and
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1051 ; ;; sometimes not putting in a blank line between two paragraphs when
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1052 ; ;; a footer appeared right between them. FMH; I choose the latter.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1053 ; ;;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1054 ;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1055 ; ;; Nuke footers: "Printed 12/3/85 27 April 1981 1"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1056 ; ;; Sun appear to be on drugz:
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1057 ; ;; "Sun Release 3.0B Last change: 1 February 1985 1"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1058 ; ;; HP are even worse!
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1059 ; ;; " Hewlett-Packard -1- (printed 12/31/99)" FMHWA12ID!!
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1060 ; ;; System V (well WICATs anyway):
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1061 ; ;; "Page 1 (printed 7/24/85)"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1062 ; ;; Who is administering PCP to these corporate bozos?
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1063 ; (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1064 ; (while (re-search-forward
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1065 ; (cond
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1066 ; ((eq system-type 'hpux)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1067 ; "\n\n?[ \t]*Hewlett-Packard\\(\\| Company\\)[ \t]*- [0-9]* -.*\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1068 ; ((eq system-type 'dgux-unix)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1069 ; "\n\n?[ \t]*Licensed material--.*Page [0-9]*\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1070 ; ((eq system-type 'usg-unix-v)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1071 ; "\n\n? *Page [0-9]*.*(printed [0-9/]*)\n")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1072 ; (t
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1073 ; "\n\n?\\(Printed\\|Sun Release\\) [0-9].*[0-9]\n"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1074 ; nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1075 ; (replace-match ""))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1076 ;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1077 ; ;; Also, hack X footers:
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1078 ; ;; "X Version 11 Last change: Release 5 1"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1079 ; (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1080 ; (while (re-search-forward "\n\n?X Version [^\n]+\n" nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1081 ; (replace-match ""))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1082 ;
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1083 ; ;; Crunch blank lines
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1084 ; (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1085 ; (while (re-search-forward "\n\n\n\n*" nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1086 ; (replace-match "\n\n"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1087 ; )
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
1088
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1089 (defun Manual-mouseify-xrefs ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1090 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1091 (forward-line 1)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1092 (let ((case-fold-search nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1093 s e name extent)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1094 ;; possibly it would be faster to rewrite this expression to search for
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1095 ;; a less common sequence first (like "([0-9]") and then back up to see
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1096 ;; if it's really a match. This function is 15% of the total time, 13%
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1097 ;; of which is this call to re-search-forward.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1098 (while (re-search-forward "[a-zA-Z_][-a-zA-Z0-9_.]*([0-9][a-zA-Z0-9]*)"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1099 nil t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1100 (setq s (match-beginning 0)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1101 e (match-end 0)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1102 name (buffer-substring s e))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1103 (goto-char s)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1104 (skip-chars-backward " \t")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1105 (if (and (bolp)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1106 (progn (backward-char 1) (= (preceding-char) ?-)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1107 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1108 (setq s (point))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1109 (skip-chars-backward "-a-zA-Z0-9_.")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1110 (setq name (concat (buffer-substring (point) (1- s)) name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1111 (setq s (point))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1112 ;; if there are upper case letters in the section, downcase them.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1113 (if (string-match "(.*[A-Z]+.*)$" name)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1114 (setq name (concat (substring name 0 (match-beginning 0))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1115 (downcase (substring name (match-beginning 0))))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1116 ;; (setq already-fontified (extent-at s))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1117 (setq extent (make-extent s e))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1118 (set-extent-property extent 'man (list 'Manual-follow-xref name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1119 (set-extent-property extent 'highlight t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1120 ;; (if (not already-fontified)...
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1121 (set-extent-face extent 'man-xref)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1122 (goto-char e))))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1123
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1124 (defun Manual-follow-xref (&optional name-or-event)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1125 "Invoke `manual-entry' on the cross-reference under the mouse.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1126 When invoked noninteractively, the arg may be an xref string to parse instead."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1127 (interactive "e")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1128 (if (eventp name-or-event)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1129 (let* ((p (event-point name-or-event))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1130 (extent (and p (extent-at p
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1131 (event-buffer name-or-event)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1132 'highlight)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1133 (data (and extent (extent-property extent 'man))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1134 (if (eq (car-safe data) 'Manual-follow-xref)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1135 (eval data)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1136 (error "no manual cross-reference there.")))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1137 (let ((Manual-match-topic-exactly t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1138 (Manual-query-multiple-pages nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1139 (or (manual-entry name-or-event)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1140 ;; If that didn't work, maybe it's in a different section than the
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1141 ;; man page writer expected. For example, man pages tend assume
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1142 ;; that all user programs are in section 1, but X tends to generate
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1143 ;; makefiles that put things in section "n" instead...
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1144 (and (string-match "[ \t]*([^)]+)\\'" name-or-event)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1145 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1146 (message "No entries found for %s; checking other sections..."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1147 name-or-event)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1148 (manual-entry
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1149 (substring name-or-event 0 (match-beginning 0))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1150 nil t)))))))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1151
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1152 (defun Manual-popup-menu (&optional event)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1153 "Pops up a menu of cross-references in this manual page.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1154 If there is a cross-reference under the mouse button which invoked this
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1155 command, it will be the first item on the menu. Otherwise, they are
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1156 on the menu in the order in which they appear in the buffer."
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1157 (interactive "e")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1158 (let ((buffer (current-buffer))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1159 (sep "---")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1160 (prefix "Show Manual Page for ")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1161 xref items)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1162 (cond (event
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1163 (setq buffer (event-buffer event))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1164 (let* ((p (event-point event))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1165 (extent (and p (extent-at p buffer 'highlight)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1166 (data (and extent (extent-property extent 'man))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1167 (if (eq (car-safe data) 'Manual-follow-xref)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1168 (setq xref (nth 1 data))))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1169 (if xref (setq items (list sep xref)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1170 (map-extents #'(lambda (extent ignore)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1171 (let ((data (extent-property extent 'man)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1172 (if (and (eq (car-safe data) 'Manual-follow-xref)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1173 (not (member (nth 1 data) items)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1174 (setq items (cons (nth 1 data) items)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1175 nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1176 buffer)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1177 (if (eq sep (car items)) (setq items (cdr items)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1178 (let ((popup-menu-titles nil))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1179 (popup-menu
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1180 (cons "Manual Entry"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1181 (mapcar #'(lambda (item)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1182 (if (eq item sep)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1183 item
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1184 (vector (concat prefix item)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1185 (list 'Manual-follow-xref item) t)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1186 (nreverse items)))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
1187
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1188 (defun pager-cleanup-hook ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1189 "cleanup man page if called via $PAGER"
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1190 (let ((buf-name (or buffer-file-name (buffer-name))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1191 (if (and (or (string-match "^/tmp/man[0-9]+" buf-name)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1192 (string-match ".*/man/\\(man\\|cat\\)[1-9a-z]/" buf-name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1193 (not (string-match Manual-bogus-file-pattern buf-name)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1194 (let (buffer manpage)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1195 (require 'man)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1196 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1197 (setq buffer-read-only nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1198 (Manual-nuke-nroff-bs)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1199 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1200 (if (re-search-forward "[^ \t]")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1201 (goto-char (- (point) 1)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1202 (if (looking-at "\\([a-zA-Z0-9]+\\)[ \t]*(")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1203 (setq manpage (buffer-substring (match-beginning 1) (match-end 1)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1204 (setq manpage "???"))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1205 (setq buffer
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1206 (rename-buffer
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1207 (generate-new-buffer-name (concat "*man " manpage "*"))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1208 (setq buffer-file-name nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1209 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1210 (insert (format "%s\n" buf-name))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1211 (goto-char (point-min))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1212 (buffer-disable-undo buffer)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1213 (set-buffer-modified-p nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1214 (Manual-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1215 ))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
1216
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 72
diff changeset
1217 (add-hook 'server-visit-hook 'pager-cleanup-hook)
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1218 (provide 'man)