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