Mercurial > emacs
annotate lisp/man.el @ 23871:921e06395776
(texinfo-tex-buffer): Bind
tex-start-options-string to empty string.
(texinfo-tex-region): Use texinfo-tex-trailer as documented.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Mon, 14 Dec 1998 10:17:50 +0000 |
parents | 3d09886cb53e |
children | 71f071c1bdf7 |
rev | line source |
---|---|
3235 | 1 ;;; man.el --- browse UNIX manual pages |
2 | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
3 ;; Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. |
3235 | 4 |
5 ;; Author: Barry A. Warsaw <bwarsaw@cen.com> | |
6 ;; Keywords: help | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
7 ;; Adapted-By: ESR, pot |
3235 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
3235 | 25 |
26 ;;; Commentary: | |
27 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
28 ;; This code provides a function, `man', with which you can browse |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
29 ;; UNIX manual pages. Formatting is done in background so that you |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
30 ;; can continue to use your Emacs while processing is going on. |
3235 | 31 ;; |
32 ;; The mode also supports hypertext-like following of manual page SEE | |
33 ;; ALSO references, and other features. See below or do `?' in a | |
34 ;; manual page buffer for details. | |
35 | |
36 ;; ========== Credits and History ========== | |
37 ;; In mid 1991, several people posted some interesting improvements to | |
38 ;; man.el from the standard emacs 18.57 distribution. I liked many of | |
14040 | 39 ;; these, but wanted everything in one single package, so I decided |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
40 ;; to incorporate them into a single manual browsing mode. While |
3235 | 41 ;; much of the code here has been rewritten, and some features added, |
42 ;; these folks deserve lots of credit for providing the initial | |
43 ;; excellent packages on which this one is based. | |
44 | |
45 ;; Nick Duffek <duffek@chaos.cs.brandeis.edu>, posted a very nice | |
46 ;; improvement which retrieved and cleaned the manpages in a | |
47 ;; background process, and which correctly deciphered such options as | |
48 ;; man -k. | |
49 | |
50 ;; Eric Rose <erose@jessica.stanford.edu>, submitted manual.el which | |
51 ;; provided a very nice manual browsing mode. | |
52 | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3307
diff
changeset
|
53 ;; This package was available as `superman.el' from the LCD package |
3235 | 54 ;; for some time before it was accepted into Emacs 19. The entry |
55 ;; point and some other names have been changed to make it a drop-in | |
56 ;; replacement for the old man.el package. | |
57 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
58 ;; Francesco Potorti` <pot@cnuce.cnr.it> cleaned it up thoroughly, |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
59 ;; making it faster, more robust and more tolerant of different |
14040 | 60 ;; systems' man idiosyncrasies. |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
61 |
3235 | 62 ;; ========== Features ========== |
63 ;; + Runs "man" in the background and pipes the results through a | |
64 ;; series of sed and awk scripts so that all retrieving and cleaning | |
65 ;; is done in the background. The cleaning commands are configurable. | |
66 ;; + Syntax is the same as Un*x man | |
67 ;; + Functionality is the same as Un*x man, including "man -k" and | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
68 ;; "man <section>", etc. |
3235 | 69 ;; + Provides a manual browsing mode with keybindings for traversing |
70 ;; the sections of a manpage, following references in the SEE ALSO | |
71 ;; section, and more. | |
72 ;; + Multiple manpages created with the same man command are put into | |
73 ;; a narrowed buffer circular list. | |
74 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
75 ;; ============= TODO =========== |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
76 ;; - Add a command for printing. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
77 ;; - The awk script deletes multiple blank lines. This behaviour does |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
78 ;; not allow to understand if there was indeed a blank line at the |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
79 ;; end or beginning of a page (after the header, or before the |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
80 ;; footer). A different algorithm should be used. It is easy to |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
81 ;; compute how many blank lines there are before and after the page |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
82 ;; headers, and after the page footer. But it is possible to compute |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
83 ;; the number of blank lines before the page footer by euristhics |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
84 ;; only. Is it worth doing? |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
85 ;; - Allow a user option to mean that all the manpages should go in |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
86 ;; the same buffer, where they can be browsed with M-n and M-p. |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
87 ;; - Allow completion on the manpage name when calling man. This |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
88 ;; requires a reliable list of places where manpages can be found. The |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
89 ;; drawback would be that if the list is not complete, the user might |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
90 ;; be led to believe that the manpages in the missing directories do |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
91 ;; not exist. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
92 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
93 |
3235 | 94 ;;; Code: |
95 | |
96 (require 'assoc) | |
97 | |
98 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
99 ;; empty defvars (keep the compiler quiet) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
100 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
101 (defgroup man nil |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
102 "Browse UNIX manual pages." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
103 :prefix "Man-" |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
104 :group 'help) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
105 |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
106 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
107 (defvar Man-notify) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
108 (defvar Man-current-page) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
109 (defvar Man-page-list) |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
110 (defcustom Man-filter-list nil |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
111 "*Manpage cleaning filter command phrases. |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
112 This variable contains a list of the following form: |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
113 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
114 '((command-string phrase-string*)*) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
115 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
116 Each phrase-string is concatenated onto the command-string to form a |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
117 command filter. The (standard) output (and standard error) of the Un*x |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
118 man command is piped through each command filter in the order the |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
119 commands appear in the association list. The final output is placed in |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
120 the manpage buffer." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
121 :type '(repeat (list (string :tag "Command String") |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
122 (repeat :inline t |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
123 (string :tag "Phrase String")))) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
124 :group 'man) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
125 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
126 (defvar Man-original-frame) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
127 (defvar Man-arguments) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
128 (defvar Man-sections-alist) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
129 (defvar Man-refpages-alist) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
130 (defvar Man-uses-untabify-flag t |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
131 "When non-nil use `untabify' instead of Man-untabify-command.") |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
132 (defvar Man-page-mode-string) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
133 (defvar Man-sed-script nil |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
134 "Script for sed to nuke backspaces and ANSI codes from manpages.") |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
135 |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
136 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
3235 | 137 ;; user variables |
138 | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
139 (defcustom Man-fontify-manpage-flag t |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
140 "*Make up the manpage with fonts." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
141 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
142 :group 'man) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
143 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
144 (defcustom Man-overstrike-face 'bold |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
145 "*Face to use when fontifying overstrike." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
146 :type 'face |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
147 :group 'man) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
148 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
149 (defcustom Man-underline-face 'underline |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
150 "*Face to use when fontifying underlining." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
151 :type 'face |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
152 :group 'man) |
6676
7251020c1c79
(manual-program): New (actually reintroduced) variable.
Karl Heuer <kwzh@gnu.org>
parents:
6613
diff
changeset
|
153 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
154 ;; Use the value of the obsolete user option Man-notify, if set. |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
155 (defcustom Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly) |
3235 | 156 "*Selects the behavior when manpage is ready. |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
157 This variable may have one of the following values, where (sf) means |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
158 that the frames are switched, so the manpage is displayed in the frame |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
159 where the man command was called from: |
3235 | 160 |
4915
c0523a78e6a5
(Man-frame-parameters): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4444
diff
changeset
|
161 newframe -- put the manpage in its own frame (see `Man-frame-parameters') |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
162 pushy -- make the manpage the current buffer in the current window |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
163 bully -- make the manpage the current buffer and only window (sf) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
164 aggressive -- make the manpage the current buffer in the other window (sf) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
165 friendly -- display manpage in the other window but don't make current (sf) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
166 polite -- don't display manpage, but prints message and beep when ready |
3235 | 167 quiet -- like `polite', but don't beep |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
168 meek -- make no indication that the manpage is ready |
3235 | 169 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
170 Any other value of `Man-notify-method' is equivalent to `meek'." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
171 :type '(radio (const newframe) (const pushy) (const bully) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
172 (const aggressive) (const friendly) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
173 (const polite) (const quiet) (const meek)) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
174 :group 'man) |
3235 | 175 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
176 (defcustom Man-frame-parameters nil |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
177 "*Frame parameter list for creating a new frame for a manual page." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
178 :type 'sexp |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
179 :group 'man) |
4915
c0523a78e6a5
(Man-frame-parameters): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4444
diff
changeset
|
180 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
181 (defcustom Man-downcase-section-letters-flag t |
3235 | 182 "*Letters in sections are converted to lower case. |
183 Some Un*x man commands can't handle uppercase letters in sections, for | |
184 example \"man 2V chmod\", but they are often displayed in the manpage | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
185 with the upper case letter. When this variable is t, the section |
3235 | 186 letter (e.g., \"2V\") is converted to lowercase (e.g., \"2v\") before |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
187 being sent to the man background process." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
188 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
189 :group 'man) |
3235 | 190 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
191 (defcustom Man-circular-pages-flag t |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
192 "*If t, the manpage list is treated as circular for traversal." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
193 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
194 :group 'man) |
3235 | 195 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
196 (defcustom Man-section-translations-alist |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
197 (list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
198 '("3C++" . "3") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
199 ;; Some systems have a real 3x man section, so let's comment this. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
200 ;; '("3X" . "3") ; Xlib man pages |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
201 '("3X11" . "3") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
202 '("1-UCB" . "")) |
3235 | 203 "*Association list of bogus sections to real section numbers. |
204 Some manpages (e.g. the Sun C++ 2.1 manpages) have section numbers in | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
205 their references which Un*x `man' does not recognize. This |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3307
diff
changeset
|
206 association list is used to translate those sections, when found, to |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
207 the associated section number." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
208 :type '(repeat (cons (string :tag "Bogus Section") |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
209 (string :tag "Real Section"))) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
210 :group 'man) |
3235 | 211 |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
212 (defvar manual-program "man" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
213 "The name of the program that produces man pages.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
214 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
215 (defvar Man-untabify-command "pr" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
216 "Command used for untabifying.") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
217 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
218 (defvar Man-untabify-command-args (list "-t" "-e") |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
219 "List of arguments to be passed to Man-untabify-command (which see).") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
220 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
221 (defvar Man-sed-command "sed" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
222 "Command used for processing sed scripts.") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
223 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
224 (defvar Man-awk-command "awk" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
225 "Command used for processing awk scripts.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
226 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
227 (defvar Man-mode-line-format |
20463
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
228 '("-" |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
229 mode-line-mule-info |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
230 mode-line-modified |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
231 mode-line-frame-identification |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
232 mode-line-buffer-identification " " |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
233 global-mode-string |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
234 " " Man-page-mode-string |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
235 " %[(" mode-name mode-line-process minor-mode-alist "%n)%]--" |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
236 (line-number-mode "L%l--") |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
237 (column-number-mode "C%c--") |
08329ac11410
(Man-mode-line-format): Update to include the new format
Andreas Schwab <schwab@suse.de>
parents:
20266
diff
changeset
|
238 (-3 . "%p") "-%-") |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
239 "Mode line format for manual mode buffer.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
240 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
241 (defvar Man-mode-map nil |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
242 "Keymap for Man mode.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
243 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
244 (defvar Man-mode-hook nil |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
245 "Hook run when Man mode is enabled.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
246 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
247 (defvar Man-cooked-hook nil |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
248 "Hook run after removing backspaces but before Man-mode processing.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
249 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
250 (defvar Man-name-regexp "[-a-zA-Z0-9_][-a-zA-Z0-9_.]*" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
251 "Regular expression describing the name of a manpage (without section).") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
252 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
253 (defvar Man-section-regexp "[0-9][a-zA-Z+]*\\|[LNln]" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
254 "Regular expression describing a manpage section within parentheses.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
255 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
256 (defvar Man-page-header-regexp |
23644
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
257 (if (and (string-match "-solaris2\\." system-configuration) |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
258 (not (string-match "-solaris2\\.[123435]$" system-configuration))) |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
259 (concat "^[-A-Za-z0-9_].*[ \t]\\(" Man-name-regexp |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
260 "(\\(" Man-section-regexp "\\))\\)$") |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
261 (concat "^[ \t]*\\(" Man-name-regexp |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
262 "(\\(" Man-section-regexp "\\))\\).*\\1")) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
263 "Regular expression describing the heading of a page.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
264 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
265 (defvar Man-heading-regexp "^\\([A-Z][A-Z ]+\\)$" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
266 "Regular expression describing a manpage heading entry.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
267 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
268 (defvar Man-see-also-regexp "SEE ALSO" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
269 "Regular expression for SEE ALSO heading (or your equivalent). |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
270 This regexp should not start with a `^' character.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
271 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
272 (defvar Man-first-heading-regexp "^[ \t]*NAME$\\|^[ \t]*No manual entry fo.*$" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
273 "Regular expression describing first heading on a manpage. |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
274 This regular expression should start with a `^' character.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
275 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
276 (defvar Man-reference-regexp |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
277 (concat "\\(" Man-name-regexp "\\)(\\(" Man-section-regexp "\\))") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
278 "Regular expression describing a reference in the SEE ALSO section.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
279 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
280 (defvar Man-switches "" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
281 "Switches passed to the man command, as a single string.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
282 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
283 (defvar Man-specified-section-option |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
284 (if (string-match "-solaris[0-9.]*$" system-configuration) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
285 "-s" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
286 "") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
287 "Option that indicates a specified a manual section name.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
288 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
289 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
290 ;; end user variables |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
291 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
292 ;; other variables and keymap initializations |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
293 (make-variable-buffer-local 'Man-sections-alist) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
294 (make-variable-buffer-local 'Man-refpages-alist) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
295 (make-variable-buffer-local 'Man-page-list) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
296 (make-variable-buffer-local 'Man-current-page) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
297 (make-variable-buffer-local 'Man-page-mode-string) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
298 (make-variable-buffer-local 'Man-original-frame) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
299 (make-variable-buffer-local 'Man-arguments) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
300 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
301 (setq-default Man-sections-alist nil) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
302 (setq-default Man-refpages-alist nil) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
303 (setq-default Man-page-list nil) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
304 (setq-default Man-current-page 0) |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
305 (setq-default Man-page-mode-string "1 of 1") |
3235 | 306 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
307 (defconst Man-sysv-sed-script "\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
308 /\b/ { s/_\b//g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
309 s/\b_//g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
310 s/o\b+/o/g |
9867
57ee6c3a0a3c
* man.el (Man-berkeley-sed-script, Man-sysv-sed-script,
Francesco Potortì <pot@gnu.org>
parents:
9838
diff
changeset
|
311 s/+\bo/o/g |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
312 :ovstrk |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
313 s/\\(.\\)\b\\1/\\1/g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
314 t ovstrk |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
315 } |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
316 /\e\\[[0-9][0-9]*m/ s///g" |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
317 "Script for sysV-like sed to nuke backspaces and ANSI codes from manpages.") |
3235 | 318 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
319 (defconst Man-berkeley-sed-script "\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
320 /\b/ { s/_\b//g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
321 s/\b_//g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
322 s/o\b+/o/g\\ |
9867
57ee6c3a0a3c
* man.el (Man-berkeley-sed-script, Man-sysv-sed-script,
Francesco Potortì <pot@gnu.org>
parents:
9838
diff
changeset
|
323 s/+\bo/o/g\\ |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
324 :ovstrk\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
325 s/\\(.\\)\b\\1/\\1/g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
326 t ovstrk\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
327 }\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
328 /\e\\[[0-9][0-9]*m/ s///g" |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
329 "Script for berkeley-like sed to nuke backspaces and ANSI codes from manpages.") |
3235 | 330 |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
331 (defvar man-mode-syntax-table |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
332 (let ((table (copy-syntax-table (standard-syntax-table)))) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
333 (modify-syntax-entry ?. "w" table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
334 (modify-syntax-entry ?_ "w" table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
335 table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
336 "Syntax table used in Man mode buffers.") |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
337 |
3235 | 338 (if Man-mode-map |
339 nil | |
340 (setq Man-mode-map (make-keymap)) | |
341 (suppress-keymap Man-mode-map) | |
342 (define-key Man-mode-map " " 'scroll-up) | |
343 (define-key Man-mode-map "\177" 'scroll-down) | |
344 (define-key Man-mode-map "n" 'Man-next-section) | |
345 (define-key Man-mode-map "p" 'Man-previous-section) | |
346 (define-key Man-mode-map "\en" 'Man-next-manpage) | |
347 (define-key Man-mode-map "\ep" 'Man-previous-manpage) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
348 (define-key Man-mode-map ">" 'end-of-buffer) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
349 (define-key Man-mode-map "<" 'beginning-of-buffer) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
350 (define-key Man-mode-map "." 'beginning-of-buffer) |
3235 | 351 (define-key Man-mode-map "r" 'Man-follow-manual-reference) |
352 (define-key Man-mode-map "g" 'Man-goto-section) | |
353 (define-key Man-mode-map "s" 'Man-goto-see-also-section) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
354 (define-key Man-mode-map "k" 'Man-kill) |
3235 | 355 (define-key Man-mode-map "q" 'Man-quit) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
356 (define-key Man-mode-map "m" 'man) |
17129 | 357 (define-key Man-mode-map "\r" 'man-follow) |
3235 | 358 (define-key Man-mode-map "?" 'describe-mode) |
359 ) | |
360 | |
361 | |
362 ;; ====================================================================== | |
363 ;; utilities | |
364 | |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
365 (defun Man-init-defvars () |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
366 "Used for initialising variables based on the value of window-system. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
367 This is necessary if one wants to dump man.el with emacs." |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
368 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
369 ;; The following is necessary until fonts are implemented on |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
370 ;; terminals. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
371 (setq Man-fontify-manpage-flag (and Man-fontify-manpage-flag |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
372 window-system)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
373 |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
374 ;; Avoid possible error in call-process by using a directory that must exist. |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
375 (let ((default-directory "/")) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
376 (setq Man-sed-script |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
377 (cond |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
378 (Man-fontify-manpage-flag |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
379 nil) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
380 ((= 0 (call-process Man-sed-command nil nil nil Man-sysv-sed-script)) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
381 Man-sysv-sed-script) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
382 ((= 0 (call-process Man-sed-command nil nil nil Man-berkeley-sed-script)) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
383 Man-berkeley-sed-script) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
384 (t |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
385 nil)))) |
3235 | 386 |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
387 (setq Man-filter-list |
23267
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
388 ;; Avoid trailing nil which confuses customize. |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
389 (apply 'list |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
390 (cons |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
391 Man-sed-command |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
392 (list |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
393 (if Man-sed-script |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
394 (concat "-e '" Man-sed-script "'") |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
395 "") |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
396 "-e '/^[\001-\032][\001-\032]*$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
397 "-e '/\e[789]/s///g'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
398 "-e '/Reformatting page. Wait/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
399 "-e '/Reformatting entry. Wait/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
400 "-e '/^[ \t]*Hewlett-Packard[ \t]Company[ \t]*-[ \t][0-9]*[ \t]-/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
401 "-e '/^[ \t]*Hewlett-Packard[ \t]*-[ \t][0-9]*[ \t]-.*$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
402 "-e '/^[ \t][ \t]*-[ \t][0-9]*[ \t]-[ \t]*Formatted:.*[0-9]$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
403 "-e '/^[ \t]*Page[ \t][0-9]*.*(printed[ \t][0-9\\/]*)$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
404 "-e '/^Printed[ \t][0-9].*[0-9]$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
405 "-e '/^[ \t]*X[ \t]Version[ \t]1[01].*Release[ \t][0-9]/d'" |
16974
f4eb94106c89
(Man-init-defvars): Fix case in a char set range.
Richard M. Stallman <rms@gnu.org>
parents:
16973
diff
changeset
|
406 "-e '/^[A-Za-z].*Last[ \t]change:/d'" |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
407 "-e '/^Sun[ \t]Release[ \t][0-9].*[0-9]$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
408 "-e '/[ \t]*Copyright [0-9]* UNIX System Laboratories, Inc.$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
409 "-e '/^[ \t]*Rev\\..*Page [0-9][0-9]*$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
410 )) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
411 (cons |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
412 Man-awk-command |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
413 (list |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
414 "'\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
415 "BEGIN { blankline=0; anonblank=0; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
416 "/^$/ { if (anonblank==0) next; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
417 "{ anonblank=1; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
418 "/^$/ { blankline++; next; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
419 "{ if (blankline>0) { print \"\"; blankline=0; } print $0; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
420 "'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
421 )) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
422 (if (not Man-uses-untabify-flag) |
23267
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
423 ;; The outer list will be stripped off by apply. |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
424 (list (cons |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
425 Man-untabify-command |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
426 Man-untabify-command-args)) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
427 ))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
428 ) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
429 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
430 (defsubst Man-match-substring (&optional n string) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
431 "Return the substring matched by the last search. |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
432 Optional arg N means return the substring matched by the Nth paren |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
433 grouping. Optional second arg STRING means return a substring from |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
434 that string instead of from the current buffer." |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
435 (if (null n) (setq n 0)) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
436 (if string |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
437 (substring string (match-beginning n) (match-end n)) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
438 (buffer-substring (match-beginning n) (match-end n)))) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
439 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
440 (defsubst Man-make-page-mode-string () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
441 "Formats part of the mode line for Man mode." |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
442 (format "%s page %d of %d" |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
443 (or (nth 2 (nth (1- Man-current-page) Man-page-list)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
444 "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
445 Man-current-page |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
446 (length Man-page-list))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
447 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
448 (defsubst Man-build-man-command () |
3235 | 449 "Builds the entire background manpage and cleaning command." |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
450 (let ((command (concat manual-program " " Man-switches |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
451 ; Stock MS-DOS shells cannot redirect stderr; |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
452 ; `call-process' below sends it to /dev/null, |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
453 ; so we don't need `2>' even with DOS shells |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
454 ; which do support stderr redirection. |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
455 (if (not (fboundp 'start-process)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
456 " %s" |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
457 " %s 2>/dev/null"))) |
3235 | 458 (flist Man-filter-list)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
459 (while (and flist (car flist)) |
3235 | 460 (let ((pcom (car (car flist))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
461 (pargs (cdr (car flist)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
462 (setq command |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
463 (concat command " | " pcom " " |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
464 (mapconcat '(lambda (phrase) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
465 (if (not (stringp phrase)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
466 (error "Malformed Man-filter-list")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
467 phrase) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
468 pargs " "))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
469 (setq flist (cdr flist)))) |
3235 | 470 command)) |
471 | |
472 (defun Man-translate-references (ref) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
473 "Translates REF from \"chmod(2V)\" to \"2v chmod\" style. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
474 Leave it as is if already in that style. Possibly downcase and |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
475 translate the section (see the Man-downcase-section-letters-flag |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
476 and the Man-section-translations-alist variables)." |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
477 (let ((name "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
478 (section "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
479 (slist Man-section-translations-alist)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
480 (cond |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
481 ;; "chmod(2V)" case ? |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
482 ((string-match (concat "^" Man-reference-regexp "$") ref) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
483 (setq name (Man-match-substring 1 ref) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
484 section (Man-match-substring 2 ref))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
485 ;; "2v chmod" case ? |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
486 ((string-match (concat "^\\(" Man-section-regexp |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
487 "\\) +\\(" Man-name-regexp "\\)$") ref) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
488 (setq name (Man-match-substring 2 ref) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
489 section (Man-match-substring 1 ref)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
490 (if (string= name "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
491 ref ; Return the reference as is |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
492 (if Man-downcase-section-letters-flag |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
493 (setq section (downcase section))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
494 (while slist |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
495 (let ((s1 (car (car slist))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
496 (s2 (cdr (car slist)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
497 (setq slist (cdr slist)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
498 (if Man-downcase-section-letters-flag |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
499 (setq s1 (downcase s1))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
500 (if (not (string= s1 section)) nil |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
501 (setq section (if Man-downcase-section-letters-flag |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
502 (downcase s2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
503 s2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
504 slist nil)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
505 (concat Man-specified-section-option section " " name)))) |
3235 | 506 |
507 | |
508 ;; ====================================================================== | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
509 ;; default man entry: get word under point |
3235 | 510 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
511 (defsubst Man-default-man-entry () |
3235 | 512 "Make a guess at a default manual entry. |
513 This guess is based on the text surrounding the cursor, and the | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
514 default section number is selected from `Man-auto-section-alist'." |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
515 (let (word) |
3235 | 516 (save-excursion |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
517 ;; Default man entry title is any word the cursor is on, or if |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
518 ;; cursor not on a word, then nearest preceding word. |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
519 (setq word (current-word)) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
520 (if (string-match "[._]+$" word) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
521 (setq word (substring word 0 (match-beginning 0)))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
522 ;; If looking at something like ioctl(2) or brc(1M), include the |
10642
0e6b71f2ebad
* man.el (Man-default-man-entry): Remove text properties from result.
Francesco Potortì <pot@gnu.org>
parents:
10040
diff
changeset
|
523 ;; section number in the returned value. Remove text properties. |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
524 (forward-word 1) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
525 ;; Use `format' here to clear any text props from `word'. |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
526 (format "%s%s" |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
527 word |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
528 (if (looking-at |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
529 (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)")) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
530 (format "(%s)" (Man-match-substring 1)) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
531 ""))))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
532 |
3235 | 533 |
534 ;; ====================================================================== | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
535 ;; Top level command and background process sentinel |
3235 | 536 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
537 ;; For compatibility with older versions. |
4444 | 538 ;;;###autoload |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
539 (defalias 'manual-entry 'man) |
4444 | 540 |
3235 | 541 ;;;###autoload |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
542 (defun man (man-args) |
3235 | 543 "Get a Un*x manual page and put it in a buffer. |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
544 This command is the top-level command in the man package. It runs a Un*x |
3235 | 545 command to retrieve and clean a manpage in the background and places the |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
546 results in a Man mode (manpage browsing) buffer. See variable |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
547 `Man-notify-method' for what happens when the buffer is ready. |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
548 If a buffer already exists for this man page, it will display immediately." |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
549 (interactive |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
550 (list (let* ((default-entry (Man-default-man-entry)) |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
551 (input (read-string |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
552 (format "Manual entry%s: " |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
553 (if (string= default-entry "") |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
554 "" |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
555 (format " (default %s)" default-entry)))))) |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
556 (if (string= input "") |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
557 (if (string= default-entry "") |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
558 (error "No man args given") |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
559 default-entry) |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
560 input)))) |
4002
511feb3c2874
* man.el (Man-build-man-command): Don't leave a pipe symbol at the
Jim Blandy <jimb@redhat.com>
parents:
3909
diff
changeset
|
561 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
562 ;; Possibly translate the "subject(section)" syntax into the |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
563 ;; "section subject" syntax and possibly downcase the section. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
564 (setq man-args (Man-translate-references man-args)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
565 |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
566 (Man-getpage-in-background man-args)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
567 |
17129 | 568 ;;;###autoload |
569 (defun man-follow (man-args) | |
570 "Get a Un*x manual page of the item under point and put it in a buffer." | |
571 (interactive (list (Man-default-man-entry))) | |
572 (if (or (not man-args) | |
573 (string= man-args "")) | |
574 (error "No item under point") | |
575 (man man-args))) | |
3235 | 576 |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
577 (defun Man-getpage-in-background (topic) |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
578 "Uses TOPIC to build and fire off the manpage and cleaning command." |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
579 (let* ((man-args topic) |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
580 (bufname (concat "*Man " man-args "*")) |
3235 | 581 (buffer (get-buffer bufname))) |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
582 (if buffer |
3235 | 583 (Man-notify-when-ready buffer) |
6353
f00fc681daa4
(Man-build-man-command): Redirect desc 2 to /dev/null.
Richard M. Stallman <rms@gnu.org>
parents:
6292
diff
changeset
|
584 (require 'env) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
585 (message "Invoking %s %s in the background" manual-program man-args) |
3235 | 586 (setq buffer (generate-new-buffer bufname)) |
6363
e5d9ea7852bf
(Man-original-frame): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6362
diff
changeset
|
587 (save-excursion |
e5d9ea7852bf
(Man-original-frame): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6362
diff
changeset
|
588 (set-buffer buffer) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
589 (setq Man-original-frame (selected-frame)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
590 (setq Man-arguments man-args)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
591 (let ((process-environment (copy-sequence process-environment)) |
22217
e83578642825
(Man-getpage-in-background): Bind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21581
diff
changeset
|
592 ;; The following is so Awk script gets \n intact |
e83578642825
(Man-getpage-in-background): Bind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21581
diff
changeset
|
593 ;; But don't prevent decoding of the outside. |
e83578642825
(Man-getpage-in-background): Bind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21581
diff
changeset
|
594 (coding-system-for-write 'raw-text-unix) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
595 ;; Avoid possible error by using a directory that always exists. |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
596 (default-directory "/")) |
3713
c77a3da2d08d
(Man-getpage-in-background): Use TERM=dumb to prevent
Richard M. Stallman <rms@gnu.org>
parents:
3659
diff
changeset
|
597 ;; Prevent any attempt to use display terminal fanciness. |
c77a3da2d08d
(Man-getpage-in-background): Use TERM=dumb to prevent
Richard M. Stallman <rms@gnu.org>
parents:
3659
diff
changeset
|
598 (setenv "TERM" "dumb") |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
599 (if (fboundp 'start-process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
600 (set-process-sentinel |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
601 (start-process manual-program buffer "sh" "-c" |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
602 (format (Man-build-man-command) man-args)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
603 'Man-bgproc-sentinel) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
604 (progn |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
605 (let ((exit-status |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
606 (call-process shell-file-name nil (list buffer nil) nil "-c" |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
607 (format (Man-build-man-command) man-args))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
608 (msg "")) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
609 (or (and (numberp exit-status) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
610 (= exit-status 0)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
611 (and (numberp exit-status) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
612 (setq msg |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
613 (format "exited abnormally with code %d" |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
614 exit-status))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
615 (setq msg exit-status)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
616 (Man-bgproc-sentinel bufname msg)))))))) |
3235 | 617 |
618 (defun Man-notify-when-ready (man-buffer) | |
619 "Notify the user when MAN-BUFFER is ready. | |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
620 See the variable `Man-notify-method' for the different notification behaviors." |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
621 (let ((saved-frame (save-excursion |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
622 (set-buffer man-buffer) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
623 Man-original-frame))) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
624 (cond |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
625 ((eq Man-notify-method 'newframe) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
626 ;; Since we run asynchronously, perhaps while Emacs is waiting |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
627 ;; for input, we must not leave a different buffer current. We |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
628 ;; can't rely on the editor command loop to reselect the |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
629 ;; selected window's buffer. |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
630 (save-excursion |
21581
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
631 (let ((frame (make-frame Man-frame-parameters))) |
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
632 (set-window-buffer (frame-selected-window frame) man-buffer) |
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
633 (set-window-dedicated-p (frame-selected-window frame) t)))) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
634 ((eq Man-notify-method 'pushy) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
635 (switch-to-buffer man-buffer)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
636 ((eq Man-notify-method 'bully) |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
637 (and window-system |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
638 (frame-live-p saved-frame) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
639 (select-frame saved-frame)) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
640 (pop-to-buffer man-buffer) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
641 (delete-other-windows)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
642 ((eq Man-notify-method 'aggressive) |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
643 (and window-system |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
644 (frame-live-p saved-frame) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
645 (select-frame saved-frame)) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
646 (pop-to-buffer man-buffer)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
647 ((eq Man-notify-method 'friendly) |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
648 (and window-system |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
649 (frame-live-p saved-frame) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
650 (select-frame saved-frame)) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
651 (display-buffer man-buffer 'not-this-window)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
652 ((eq Man-notify-method 'polite) |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
653 (beep) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
654 (message "Manual buffer %s is ready" (buffer-name man-buffer))) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
655 ((eq Man-notify-method 'quiet) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
656 (message "Manual buffer %s is ready" (buffer-name man-buffer))) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
657 ((or (eq Man-notify-method 'meek) |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
658 t) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
659 (message "")) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
660 ))) |
3235 | 661 |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
662 (defun Man-softhyphen-to-minus () |
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
663 ;; \255 is some kind of dash in Latin-1. |
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
664 (goto-char (point-min)) |
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
665 (if enable-multibyte-characters |
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
666 (while (search-forward "\255" nil t) |
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
667 (if (= (preceding-char) ?\255) |
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
668 (replace-match "-"))) |
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
669 (while (search-forward "\255" nil t) (replace-match "-")))) |
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
670 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
671 (defun Man-fontify-manpage () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
672 "Convert overstriking and underlining to the correct fonts. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
673 Same for the ANSI bold and normal escape sequences." |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
674 (interactive) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
675 (message "Please wait: making up the %s man page..." Man-arguments) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
676 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
677 (while (search-forward "\e[1m" nil t) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
678 (delete-backward-char 4) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
679 (put-text-property (point) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
680 (progn (if (search-forward "\e[0m" nil 'move) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
681 (delete-backward-char 4)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
682 (point)) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
683 'face Man-overstrike-face)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
684 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
685 (while (search-forward "_\b" nil t) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
686 (backward-delete-char 2) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
687 (put-text-property (point) (1+ (point)) 'face Man-underline-face)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
688 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
689 (while (search-forward "\b_" nil t) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
690 (backward-delete-char 2) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
691 (put-text-property (1- (point)) (point) 'face Man-underline-face)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
692 (goto-char (point-min)) |
9210
8d35fd88194d
* man.el (Man-init-defvars, Man-cleanup-manpage,
Francesco Potortì <pot@gnu.org>
parents:
9177
diff
changeset
|
693 (while (re-search-forward "\\(.\\)\\(\b\\1\\)+" nil t) |
8d35fd88194d
* man.el (Man-init-defvars, Man-cleanup-manpage,
Francesco Potortì <pot@gnu.org>
parents:
9177
diff
changeset
|
694 (replace-match "\\1") |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
695 (put-text-property (1- (point)) (point) 'face Man-overstrike-face)) |
9210
8d35fd88194d
* man.el (Man-init-defvars, Man-cleanup-manpage,
Francesco Potortì <pot@gnu.org>
parents:
9177
diff
changeset
|
696 (goto-char (point-min)) |
9867
57ee6c3a0a3c
* man.el (Man-berkeley-sed-script, Man-sysv-sed-script,
Francesco Potortì <pot@gnu.org>
parents:
9838
diff
changeset
|
697 (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) |
57ee6c3a0a3c
* man.el (Man-berkeley-sed-script, Man-sysv-sed-script,
Francesco Potortì <pot@gnu.org>
parents:
9838
diff
changeset
|
698 (replace-match "o") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
699 (put-text-property (1- (point)) (point) 'face 'bold)) |
9210
8d35fd88194d
* man.el (Man-init-defvars, Man-cleanup-manpage,
Francesco Potortì <pot@gnu.org>
parents:
9177
diff
changeset
|
700 (goto-char (point-min)) |
9620
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
701 (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) |
9177 | 702 (replace-match "+") |
703 (put-text-property (1- (point)) (point) 'face 'bold)) | |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
704 (Man-softhyphen-to-minus) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
705 (message "%s man page made up" Man-arguments)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
706 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
707 (defun Man-cleanup-manpage () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
708 "Remove overstriking and underlining from the current buffer." |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
709 (interactive) |
9620
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
710 (message "Please wait: cleaning up the %s man page..." |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
711 Man-arguments) |
9675 | 712 (if (or (interactive-p) (not Man-sed-script)) |
9620
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
713 (progn |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
714 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
715 (while (search-forward "_\b" nil t) (backward-delete-char 2)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
716 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
717 (while (search-forward "\b_" nil t) (backward-delete-char 2)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
718 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
719 (while (re-search-forward "\\(.\\)\\(\b\\1\\)+" nil t) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
720 (replace-match "\\1")) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
721 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
722 (while (re-search-forward "\e\\[[0-9]+m" nil t) (replace-match "")) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
723 (goto-char (point-min)) |
9867
57ee6c3a0a3c
* man.el (Man-berkeley-sed-script, Man-sysv-sed-script,
Francesco Potortì <pot@gnu.org>
parents:
9838
diff
changeset
|
724 (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) (replace-match "o")) |
9620
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
725 )) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
726 (goto-char (point-min)) |
9620
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
727 (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) (replace-match "+")) |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
728 (Man-softhyphen-to-minus) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
729 (message "%s man page cleaned up" Man-arguments)) |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
730 |
3235 | 731 (defun Man-bgproc-sentinel (process msg) |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
732 "Manpage background process sentinel. |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
733 When manpage command is run asynchronously, PROCESS is the process |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
734 object for the manpage command; when manpage command is run |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
735 synchronously, PROCESS is the name of the buffer where the manpage |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
736 command is run. Second argument MSG is the exit message of the |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
737 manpage command." |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
738 (let ((Man-buffer (if (stringp process) (get-buffer process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
739 (process-buffer process))) |
3235 | 740 (delete-buff nil) |
8190
04aa77218846
(Man-bgproc-sentinel): Bind case-fold-search for just the
Richard M. Stallman <rms@gnu.org>
parents:
7518
diff
changeset
|
741 (err-mess nil)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
742 |
3235 | 743 (if (null (buffer-name Man-buffer)) ;; deleted buffer |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
744 (or (stringp process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
745 (set-process-buffer process nil)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
746 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
747 (save-excursion |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
748 (set-buffer Man-buffer) |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
749 (let ((case-fold-search nil)) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
750 (goto-char (point-min)) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
751 (cond ((or (looking-at "No \\(manual \\)*entry for") |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
752 (looking-at "[^\n]*: nothing appropriate$")) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
753 (setq err-mess (buffer-substring (point) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
754 (progn |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
755 (end-of-line) (point))) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
756 delete-buff t)) |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
757 ((or (stringp process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
758 (not (and (eq (process-status process) 'exit) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
759 (= (process-exit-status process) 0)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
760 (or (zerop (length msg)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
761 (progn |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
762 (setq err-mess |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
763 (concat (buffer-name Man-buffer) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
764 ": process " |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
765 (let ((eos (1- (length msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
766 (if (= (aref msg eos) ?\n) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
767 (substring msg 0 eos) msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
768 (goto-char (point-max)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
769 (insert (format "\nprocess %s" msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
770 )) |
16509
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
771 (if delete-buff |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
772 (kill-buffer Man-buffer) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
773 (if Man-fontify-manpage-flag |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
774 (Man-fontify-manpage) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
775 (Man-cleanup-manpage)) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
776 (run-hooks 'Man-cooked-hook) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
777 (Man-mode) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
778 (set-buffer-modified-p nil) |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
779 )) |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
780 ;; Restore case-fold-search before calling |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
781 ;; Man-notify-when-ready because it may switch buffers. |
3235 | 782 |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
783 (if (not delete-buff) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
784 (Man-notify-when-ready Man-buffer)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
785 |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
786 (if err-mess |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
787 (error err-mess)) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
788 )))) |
3235 | 789 |
790 | |
791 ;; ====================================================================== | |
792 ;; set up manual mode in buffer and build alists | |
793 | |
794 (defun Man-mode () | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
795 "A mode for browsing Un*x manual pages. |
3235 | 796 |
797 The following man commands are available in the buffer. Try | |
798 \"\\[describe-key] <key> RET\" for more information: | |
799 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
800 \\[man] Prompt to retrieve a new manpage. |
3235 | 801 \\[Man-follow-manual-reference] Retrieve reference in SEE ALSO section. |
802 \\[Man-next-manpage] Jump to next manpage in circular list. | |
803 \\[Man-previous-manpage] Jump to previous manpage in circular list. | |
804 \\[Man-next-section] Jump to next manpage section. | |
805 \\[Man-previous-section] Jump to previous manpage section. | |
806 \\[Man-goto-section] Go to a manpage section. | |
807 \\[Man-goto-see-also-section] Jumps to the SEE ALSO manpage section. | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
808 \\[Man-quit] Deletes the manpage window, bury its buffer. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
809 \\[Man-kill] Deletes the manpage window, kill its buffer. |
3235 | 810 \\[describe-mode] Prints this help text. |
811 | |
812 The following variables may be of some use. Try | |
813 \"\\[describe-variable] <variable-name> RET\" for more information: | |
814 | |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
815 Man-notify-method What happens when manpage formatting is done. |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
816 Man-downcase-section-letters-flag Force section letters to lower case. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
817 Man-circular-pages-flag Treat multiple manpage list as circular. |
3235 | 818 Man-auto-section-alist List of major modes and their section numbers. |
819 Man-section-translations-alist List of section numbers and their Un*x equiv. | |
820 Man-filter-list Background manpage filter command. | |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
821 Man-mode-line-format Mode line format for Man mode buffers. |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
822 Man-mode-map Keymap bindings for Man mode buffers. |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
823 Man-mode-hook Normal hook run on entry to Man mode. |
3235 | 824 Man-section-regexp Regexp describing manpage section letters. |
825 Man-heading-regexp Regexp describing section headers. | |
826 Man-see-also-regexp Regexp for SEE ALSO section (or your equiv). | |
827 Man-first-heading-regexp Regexp for first heading on a manpage. | |
828 Man-reference-regexp Regexp matching a references in SEE ALSO. | |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
829 Man-switches Background `man' command switches. |
3235 | 830 |
831 The following key bindings are currently in effect in the buffer: | |
832 \\{Man-mode-map}" | |
833 (interactive) | |
834 (setq major-mode 'Man-mode | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
835 mode-name "Man" |
3235 | 836 buffer-auto-save-file-name nil |
837 mode-line-format Man-mode-line-format | |
838 truncate-lines t | |
839 buffer-read-only t) | |
840 (buffer-disable-undo (current-buffer)) | |
841 (auto-fill-mode -1) | |
842 (use-local-map Man-mode-map) | |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
843 (set-syntax-table man-mode-syntax-table) |
3235 | 844 (Man-build-page-list) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
845 (Man-strip-page-headers) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
846 (Man-unindent) |
3619
062dbb10173d
(Man-mode): Run Man-mode-hook.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
847 (Man-goto-page 1) |
062dbb10173d
(Man-mode): Run Man-mode-hook.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
848 (run-hooks 'Man-mode-hook)) |
3235 | 849 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
850 (defsubst Man-build-section-alist () |
3235 | 851 "Build the association list of manpage sections." |
852 (setq Man-sections-alist nil) | |
853 (goto-char (point-min)) | |
7450 | 854 (let ((case-fold-search nil)) |
855 (while (re-search-forward Man-heading-regexp (point-max) t) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
856 (aput 'Man-sections-alist (Man-match-substring 1)) |
7450 | 857 (forward-line 1)))) |
3235 | 858 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
859 (defsubst Man-build-references-alist () |
3235 | 860 "Build the association list of references (in the SEE ALSO section)." |
861 (setq Man-refpages-alist nil) | |
862 (save-excursion | |
863 (if (Man-find-section Man-see-also-regexp) | |
864 (let ((start (progn (forward-line 1) (point))) | |
865 (end (progn | |
866 (Man-next-section 1) | |
867 (point))) | |
868 hyphenated | |
869 (runningpoint -1)) | |
7450 | 870 (save-restriction |
871 (narrow-to-region start end) | |
872 (goto-char (point-min)) | |
873 (back-to-indentation) | |
874 (while (and (not (eobp)) (/= (point) runningpoint)) | |
875 (setq runningpoint (point)) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
876 (if (re-search-forward Man-reference-regexp end t) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
877 (let* ((word (Man-match-substring 0)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
878 (len (1- (length word)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
879 (if hyphenated |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
880 (setq word (concat hyphenated word) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
881 hyphenated nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
882 (if (= (aref word len) ?-) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
883 (setq hyphenated (substring word 0 len)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
884 (aput 'Man-refpages-alist word)))) |
7450 | 885 (skip-chars-forward " \t\n,"))))))) |
3235 | 886 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
887 (defun Man-build-page-list () |
3235 | 888 "Build the list of separate manpages in the buffer." |
889 (setq Man-page-list nil) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
890 (let ((page-start (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
891 (page-end (point-max)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
892 (header "")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
893 (goto-char page-start) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
894 ;; (switch-to-buffer (current-buffer))(debug) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
895 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
896 (setq header |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
897 (if (looking-at Man-page-header-regexp) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
898 (Man-match-substring 1) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
899 nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
900 ;; Go past both the current and the next Man-first-heading-regexp |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
901 (if (re-search-forward Man-first-heading-regexp nil 'move 2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
902 (let ((p (progn (beginning-of-line) (point)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
903 ;; We assume that the page header is delimited by blank |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
904 ;; lines and that it contains at most one blank line. So |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
905 ;; if we back by three blank lines we will be sure to be |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
906 ;; before the page header but not before the possible |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
907 ;; previous page header. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
908 (search-backward "\n\n" nil t 3) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
909 (if (re-search-forward Man-page-header-regexp p 'move) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
910 (beginning-of-line)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
911 (setq page-end (point)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
912 (setq Man-page-list (append Man-page-list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
913 (list (list (copy-marker page-start) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
914 (copy-marker page-end) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
915 header)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
916 (setq page-start page-end) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
917 ))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
918 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
919 (defun Man-strip-page-headers () |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
920 "Strip all the page headers but the first from the manpage." |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
921 (let ((buffer-read-only nil) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
922 (case-fold-search nil) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
923 (page-list Man-page-list) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
924 (page ()) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
925 (header "")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
926 (while page-list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
927 (setq page (car page-list)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
928 (and (nth 2 page) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
929 (goto-char (car page)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
930 (re-search-forward Man-first-heading-regexp nil t) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
931 (setq header (buffer-substring (car page) (match-beginning 0))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
932 ;; Since the awk script collapses all successive blank |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
933 ;; lines into one, and since we don't want to get rid of |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
934 ;; the fast awk script, one must choose between adding |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
935 ;; spare blank lines between pages when there were none and |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
936 ;; deleting blank lines at page boundaries when there were |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
937 ;; some. We choose the first, so we comment the following |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
938 ;; line. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
939 ;; (setq header (concat "\n" header))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
940 (while (search-forward header (nth 1 page) t) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
941 (replace-match ""))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
942 (setq page-list (cdr page-list))))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
943 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
944 (defun Man-unindent () |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
945 "Delete the leading spaces that indent the manpage." |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
946 (let ((buffer-read-only nil) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
947 (case-fold-search nil) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
948 (page-list Man-page-list)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
949 (while page-list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
950 (let ((page (car page-list)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
951 (indent "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
952 (nindent 0)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
953 (narrow-to-region (car page) (car (cdr page))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
954 (if Man-uses-untabify-flag |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
955 (untabify (point-min) (point-max))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
956 (if (catch 'unindent |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
957 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
958 (if (not (re-search-forward Man-first-heading-regexp nil t)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
959 (throw 'unindent nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
960 (beginning-of-line) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
961 (setq indent (buffer-substring (point) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
962 (progn |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
963 (skip-chars-forward " ") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
964 (point)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
965 (setq nindent (length indent)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
966 (if (zerop nindent) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
967 (throw 'unindent nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
968 (setq indent (concat indent "\\|$")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
969 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
970 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
971 (if (looking-at indent) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
972 (forward-line 1) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
973 (throw 'unindent nil))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
974 (goto-char (point-min))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
975 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
976 (or (eolp) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
977 (delete-char nindent)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
978 (forward-line 1))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
979 (setq page-list (cdr page-list)) |
7450 | 980 )))) |
3235 | 981 |
982 | |
983 ;; ====================================================================== | |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
984 ;; Man mode commands |
3235 | 985 |
986 (defun Man-next-section (n) | |
987 "Move point to Nth next section (default 1)." | |
988 (interactive "p") | |
7450 | 989 (let ((case-fold-search nil)) |
990 (if (looking-at Man-heading-regexp) | |
991 (forward-line 1)) | |
992 (if (re-search-forward Man-heading-regexp (point-max) t n) | |
993 (beginning-of-line) | |
994 (goto-char (point-max))))) | |
3235 | 995 |
996 (defun Man-previous-section (n) | |
997 "Move point to Nth previous section (default 1)." | |
998 (interactive "p") | |
7450 | 999 (let ((case-fold-search nil)) |
1000 (if (looking-at Man-heading-regexp) | |
1001 (forward-line -1)) | |
1002 (if (re-search-backward Man-heading-regexp (point-min) t n) | |
1003 (beginning-of-line) | |
1004 (goto-char (point-min))))) | |
3235 | 1005 |
1006 (defun Man-find-section (section) | |
1007 "Move point to SECTION if it exists, otherwise don't move point. | |
1008 Returns t if section is found, nil otherwise." | |
7450 | 1009 (let ((curpos (point)) |
1010 (case-fold-search nil)) | |
3235 | 1011 (goto-char (point-min)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1012 (if (re-search-forward (concat "^" section) (point-max) t) |
3235 | 1013 (progn (beginning-of-line) t) |
1014 (goto-char curpos) | |
1015 nil) | |
1016 )) | |
1017 | |
1018 (defun Man-goto-section () | |
1019 "Query for section to move point to." | |
1020 (interactive) | |
1021 (aput 'Man-sections-alist | |
1022 (let* ((default (aheadsym Man-sections-alist)) | |
1023 (completion-ignore-case t) | |
1024 chosen | |
1025 (prompt (concat "Go to section: (default " default ") "))) | |
1026 (setq chosen (completing-read prompt Man-sections-alist)) | |
1027 (if (or (not chosen) | |
1028 (string= chosen "")) | |
1029 default | |
1030 chosen))) | |
1031 (Man-find-section (aheadsym Man-sections-alist))) | |
1032 | |
1033 (defun Man-goto-see-also-section () | |
1034 "Move point the the \"SEE ALSO\" section. | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
1035 Actually the section moved to is described by `Man-see-also-regexp'." |
3235 | 1036 (interactive) |
1037 (if (not (Man-find-section Man-see-also-regexp)) | |
1038 (error (concat "No " Man-see-also-regexp | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1039 " section found in the current manpage")))) |
3235 | 1040 |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1041 (defun Man-follow-manual-reference (reference) |
3235 | 1042 "Get one of the manpages referred to in the \"SEE ALSO\" section. |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1043 Specify which reference to use; default is based on word at point." |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1044 (interactive |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1045 (if (not Man-refpages-alist) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1046 (error "There are no references in the current man page") |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1047 (list (let* ((default (or |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1048 (car (all-completions |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1049 (save-excursion |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1050 (skip-syntax-backward "w()") |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1051 (skip-chars-forward " \t") |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1052 (let ((word (current-word))) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1053 ;; strip a trailing '-': |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1054 (if (string-match "-$" word) |
7450 | 1055 (substring word 0 |
1056 (match-beginning 0)) | |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1057 word))) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1058 Man-refpages-alist)) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1059 (aheadsym Man-refpages-alist))) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1060 chosen |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1061 (prompt (concat "Refer to: (default " default ") "))) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1062 (setq chosen (completing-read prompt Man-refpages-alist nil t)) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1063 (if (or (not chosen) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1064 (string= chosen "")) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1065 default |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1066 chosen))))) |
3235 | 1067 (if (not Man-refpages-alist) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1068 (error "Can't find any references in the current manpage") |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1069 (aput 'Man-refpages-alist reference) |
3235 | 1070 (Man-getpage-in-background |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1071 (Man-translate-references (aheadsym Man-refpages-alist))))) |
3235 | 1072 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1073 (defun Man-kill () |
3235 | 1074 "Kill the buffer containing the manpage." |
1075 (interactive) | |
22368
c3a15ab5924f
(Man-kill, Man-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
22217
diff
changeset
|
1076 (quit-window t)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1077 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1078 (defun Man-quit () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1079 "Bury the buffer containing the manpage." |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1080 (interactive) |
22368
c3a15ab5924f
(Man-kill, Man-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
22217
diff
changeset
|
1081 (quit-window)) |
3235 | 1082 |
1083 (defun Man-goto-page (page) | |
1084 "Go to the manual page on page PAGE." | |
1085 (interactive | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1086 (if (not Man-page-list) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1087 (let ((args Man-arguments)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1088 (kill-buffer (current-buffer)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1089 (error "Can't find the %s manpage" args)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1090 (if (= (length Man-page-list) 1) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1091 (error "You're looking at the only manpage in the buffer") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1092 (list (read-minibuffer (format "Go to manpage [1-%d]: " |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1093 (length Man-page-list))))))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1094 (if (not Man-page-list) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1095 (let ((args Man-arguments)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1096 (kill-buffer (current-buffer)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1097 (error "Can't find the %s manpage" args))) |
3235 | 1098 (if (or (< page 1) |
1099 (> page (length Man-page-list))) | |
1100 (error "No manpage %d found" page)) | |
1101 (let* ((page-range (nth (1- page) Man-page-list)) | |
1102 (page-start (car page-range)) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1103 (page-end (car (cdr page-range)))) |
3235 | 1104 (setq Man-current-page page |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1105 Man-page-mode-string (Man-make-page-mode-string)) |
3235 | 1106 (widen) |
1107 (goto-char page-start) | |
1108 (narrow-to-region page-start page-end) | |
1109 (Man-build-section-alist) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1110 (Man-build-references-alist) |
3235 | 1111 (goto-char (point-min)))) |
1112 | |
1113 | |
1114 (defun Man-next-manpage () | |
1115 "Find the next manpage entry in the buffer." | |
1116 (interactive) | |
1117 (if (= (length Man-page-list) 1) | |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1118 (error "This is the only manpage in the buffer")) |
3235 | 1119 (if (< Man-current-page (length Man-page-list)) |
1120 (Man-goto-page (1+ Man-current-page)) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1121 (if Man-circular-pages-flag |
3235 | 1122 (Man-goto-page 1) |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1123 (error "You're looking at the last manpage in the buffer")))) |
3235 | 1124 |
1125 (defun Man-previous-manpage () | |
1126 "Find the previous manpage entry in the buffer." | |
1127 (interactive) | |
1128 (if (= (length Man-page-list) 1) | |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1129 (error "This is the only manpage in the buffer")) |
3235 | 1130 (if (> Man-current-page 1) |
1131 (Man-goto-page (1- Man-current-page)) | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1132 (if Man-circular-pages-flag |
3235 | 1133 (Man-goto-page (length Man-page-list)) |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1134 (error "You're looking at the first manpage in the buffer")))) |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1135 |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1136 ;; Init the man package variables, if not already done. |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1137 (Man-init-defvars) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1138 |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1139 (provide 'man) |
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1140 |
3235 | 1141 ;;; man.el ends here |