Mercurial > emacs
annotate lisp/man.el @ 57810:d90eb2c9844c
*** empty log message ***
author | John Paul Wallington <jpw@pobox.com> |
---|---|
date | Sun, 31 Oct 2004 01:09:18 +0000 |
parents | f633084f70ae |
children | 78ec31c498b7 0fe073a08cef |
rev | line source |
---|---|
51376
ec20af5e04b3
(Man-name-regexp): Also match Latin-1 soft hyphen.
Andreas Schwab <schwab@suse.de>
parents:
50602
diff
changeset
|
1 ;;; man.el --- browse UNIX manual pages -*- coding: iso-8859-1 -*- |
3235 | 2 |
54515 | 3 ;; Copyright (C) 1993, 1994, 1996, 1997, 2001, 2003, 2004 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) | |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
98 (require 'button) |
3235 | 99 |
100 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
101 ;; 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
|
102 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
103 (defgroup man nil |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
104 "Browse UNIX manual pages." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
105 :prefix "Man-" |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
106 :group 'help) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
107 |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
108 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
109 (defvar Man-notify) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
110 (defvar Man-current-page) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
111 (defvar Man-page-list) |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
112 (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
|
113 "*Manpage cleaning filter command phrases. |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
114 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
|
115 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
116 '((command-string phrase-string*)*) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
117 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
118 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
|
119 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
|
120 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
|
121 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
|
122 the manpage buffer." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
123 :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
|
124 (repeat :inline t |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
125 (string :tag "Phrase String")))) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
126 :group 'man) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
127 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
128 (defvar Man-original-frame) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
129 (defvar Man-arguments) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
130 (defvar Man-sections-alist) |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
131 (defvar Man-refpages-alist) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
132 (defvar Man-uses-untabify-flag t |
28102 | 133 "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
|
134 (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
|
135 (defvar Man-sed-script nil |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
136 "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
|
137 |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
138 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
3235 | 139 ;; user variables |
140 | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
141 (defcustom Man-fontify-manpage-flag t |
28102 | 142 "*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
|
143 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
144 :group 'man) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
145 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
146 (defcustom Man-overstrike-face 'bold |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
147 "*Face to use when fontifying overstrike." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
148 :type 'face |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
149 :group 'man) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
150 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
151 (defcustom Man-underline-face 'underline |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
152 "*Face to use when fontifying underlining." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
153 :type 'face |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
154 :group 'man) |
6676
7251020c1c79
(manual-program): New (actually reintroduced) variable.
Karl Heuer <kwzh@gnu.org>
parents:
6613
diff
changeset
|
155 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
156 ;; 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
|
157 (defcustom Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly) |
3235 | 158 "*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
|
159 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
|
160 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
|
161 where the man command was called from: |
3235 | 162 |
4915
c0523a78e6a5
(Man-frame-parameters): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4444
diff
changeset
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 polite -- don't display manpage, but prints message and beep when ready |
3235 | 169 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
|
170 meek -- make no indication that the manpage is ready |
3235 | 171 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
172 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
|
173 :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
|
174 (const aggressive) (const friendly) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
175 (const polite) (const quiet) (const meek)) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
176 :group 'man) |
3235 | 177 |
54515 | 178 (defcustom Man-width nil |
179 "*Number of columns for which manual pages should be formatted. | |
180 If nil, the width of the window selected at the moment of man | |
181 invocation is used. If non-nil, the width of the frame selected | |
182 at the moment of man invocation is used. The value also can be a | |
183 positive integer." | |
184 :type '(choice (const :tag "Window width" nil) | |
185 (const :tag "Frame width" t) | |
186 (integer :tag "Specific width" :value 65)) | |
187 :group 'man) | |
188 | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
189 (defcustom Man-frame-parameters nil |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
190 "*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
|
191 :type 'sexp |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
192 :group 'man) |
4915
c0523a78e6a5
(Man-frame-parameters): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4444
diff
changeset
|
193 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
194 (defcustom Man-downcase-section-letters-flag t |
28102 | 195 "*Non-nil means letters in sections are converted to lower case. |
3235 | 196 Some Un*x man commands can't handle uppercase letters in sections, for |
197 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
|
198 with the upper case letter. When this variable is t, the section |
3235 | 199 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
|
200 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
|
201 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
202 :group 'man) |
3235 | 203 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
204 (defcustom Man-circular-pages-flag t |
28102 | 205 "*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
|
206 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
207 :group 'man) |
3235 | 208 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
209 (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
|
210 (list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
211 '("3C++" . "3") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
212 ;; 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
|
213 ;; '("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
|
214 '("3X11" . "3") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
215 '("1-UCB" . "")) |
3235 | 216 "*Association list of bogus sections to real section numbers. |
217 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
|
218 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
|
219 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
|
220 the associated section number." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
221 :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
|
222 (string :tag "Real Section"))) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
223 :group 'man) |
3235 | 224 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
225 (defcustom Man-header-file-path |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
226 '("/usr/include" "/usr/local/include") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
227 "C Header file search path used in Man." |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
228 :type '(repeat string) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
229 :group 'man) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
230 |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
231 (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
|
232 "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
|
233 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
234 (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
|
235 "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
|
236 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
237 (defvar Man-untabify-command-args (list "-t" "-e") |
28102 | 238 "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
|
239 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
240 (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
|
241 "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
|
242 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
243 (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
|
244 "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
|
245 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
246 (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
|
247 "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
|
248 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
249 (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
|
250 "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
|
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-cooked-hook nil |
28102 | 253 "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
|
254 |
51803
ebe64300a9d5
(Man-name-regexp): Match + as part of name.
Richard M. Stallman <rms@gnu.org>
parents:
51376
diff
changeset
|
255 (defvar Man-name-regexp "[-a-zA-Z0-9_+][-a-zA-Z0-9_.+]*" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
256 "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
|
257 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
258 (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
|
259 "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
|
260 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
261 (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
|
262 (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
|
263 (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
|
264 (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
|
265 "(\\(" Man-section-regexp "\\))\\)$") |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
266 (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
|
267 "(\\(" 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
|
268 "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
|
269 |
50519
1f6682595898
(Man-heading-regexp): Accept hyphen.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
50476
diff
changeset
|
270 (defvar Man-heading-regexp "^\\([A-Z][A-Z -]+\\)$" |
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 manpage heading entry.") |
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-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
|
274 "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
|
275 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
|
276 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
277 (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
|
278 "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
|
279 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
|
280 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
281 (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
|
282 (concat "\\(" Man-name-regexp "\\)(\\(" Man-section-regexp "\\))") |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
283 "Regular expression describing a reference to another manpage.") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
284 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
285 (defvar Man-synopsis-regexp "SYNOPSIS" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
286 "Regular expression for SYNOPSIS heading (or your equivalent). |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
287 This regexp should not start with a `^' character.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
288 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
289 (defvar Man-files-regexp "FILES" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
290 "Regular expression for FILES heading (or your equivalent). |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
291 This regexp should not start with a `^' character.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
292 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
293 (defvar Man-include-regexp "#[ \t]*include[ \t]*" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
294 "Regular expression describing the #include (directive of cpp).") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
295 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
296 (defvar Man-file-name-regexp "[^<>\" \t\n]+" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
297 "Regular expression describing <> in #include line (directive of cpp).") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
298 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
299 (defvar Man-normal-file-prefix-regexp "[/~$]" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
300 "Regular expression describing a file path appeared in FILES section.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
301 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
302 (defvar Man-header-regexp |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
303 (concat "\\(" Man-include-regexp "\\)" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
304 "[<\"]" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
305 "\\(" Man-file-name-regexp "\\)" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
306 "[>\"]") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
307 "Regular expression describing references to header files.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
308 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
309 (defvar Man-normal-file-regexp |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
310 (concat Man-normal-file-prefix-regexp Man-file-name-regexp) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
311 "Regular expression describing references to normal files.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
312 |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
313 ;; 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
|
314 ;; refernces to manpages. |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
315 (defvar Man-hyphenated-reference-regexp |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
316 (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
|
317 "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
|
318 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
319 (defvar Man-switches "" |
38646
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
320 "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
|
321 |
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
322 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
|
323 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
|
324 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
325 (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
|
326 (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
|
327 "-s" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
328 "") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
329 "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
|
330 |
54515 | 331 (defvar Man-support-local-filenames 'auto-detect |
332 "Internal cache for the value of the function `Man-support-local-filenames'. | |
333 `auto-detect' means the value is not yet determined. | |
334 Otherwise, the value is whatever the function | |
335 `Man-support-local-filenames' should return.") | |
336 | |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
337 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
338 ;; end user variables |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
339 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
340 ;; 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
|
341 (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
|
342 (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
|
343 (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
|
344 (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
|
345 (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
|
346 (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
|
347 (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
|
348 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
349 (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
|
350 (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
|
351 (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
|
352 (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
|
353 (setq-default Man-page-mode-string "1 of 1") |
3235 | 354 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
355 (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
|
356 /\b/ { s/_\b//g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
357 s/\b_//g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
358 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
|
359 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
|
360 :ovstrk |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
361 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
|
362 t ovstrk |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
363 } |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
364 /\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
|
365 "Script for sysV-like sed to nuke backspaces and ANSI codes from manpages.") |
3235 | 366 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
367 (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
|
368 /\b/ { s/_\b//g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
369 s/\b_//g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
370 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
|
371 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
|
372 :ovstrk\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
373 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
|
374 t ovstrk\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
375 }\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
376 /\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
|
377 "Script for berkeley-like sed to nuke backspaces and ANSI codes from manpages.") |
3235 | 378 |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
379 (defvar man-mode-syntax-table |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
380 (let ((table (copy-syntax-table (standard-syntax-table)))) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
381 (modify-syntax-entry ?. "w" table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
382 (modify-syntax-entry ?_ "w" table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
383 table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
384 "Syntax table used in Man mode buffers.") |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
385 |
3235 | 386 (if Man-mode-map |
387 nil | |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
388 (setq Man-mode-map (copy-keymap button-buffer-map)) |
3235 | 389 (suppress-keymap Man-mode-map) |
390 (define-key Man-mode-map " " 'scroll-up) | |
391 (define-key Man-mode-map "\177" 'scroll-down) | |
392 (define-key Man-mode-map "n" 'Man-next-section) | |
393 (define-key Man-mode-map "p" 'Man-previous-section) | |
394 (define-key Man-mode-map "\en" 'Man-next-manpage) | |
395 (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
|
396 (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
|
397 (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
|
398 (define-key Man-mode-map "." 'beginning-of-buffer) |
3235 | 399 (define-key Man-mode-map "r" 'Man-follow-manual-reference) |
400 (define-key Man-mode-map "g" 'Man-goto-section) | |
401 (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
|
402 (define-key Man-mode-map "k" 'Man-kill) |
3235 | 403 (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
|
404 (define-key Man-mode-map "m" 'man) |
3235 | 405 (define-key Man-mode-map "?" 'describe-mode) |
406 ) | |
407 | |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
408 ;; buttons |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
409 (define-button-type 'Man-xref-man-page |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
410 'action (lambda (button) (man-follow (button-label button))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
411 'help-echo "RET, mouse-2: display this man page") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
412 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
413 (define-button-type 'Man-xref-header-file |
50418
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
414 'action (lambda (button) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
415 (let ((w (button-get button 'Man-target-string))) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
416 (unless (Man-view-header-file w) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
417 (error "Cannot find header file: %s" w)))) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
418 'help-echo "mouse-2: display this header file") |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
419 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
420 (define-button-type 'Man-xref-normal-file |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
421 'action (lambda (button) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
422 (let ((f (substitute-in-file-name |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
423 (button-get button 'Man-target-string)))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
424 (if (file-exists-p f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
425 (if (file-readable-p f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
426 (view-file f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
427 (error "Cannot read a file: %s" f)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
428 (error "Cannot find a file: %s" f)))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
429 'help-echo "mouse-2: mouse-2: display this file") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
430 |
3235 | 431 |
432 ;; ====================================================================== | |
433 ;; utilities | |
434 | |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
435 (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
|
436 "Used for initialising variables based on display's color support. |
28102 | 437 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
|
438 |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
439 ;; 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
|
440 (let ((default-directory "/")) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
441 (setq Man-sed-script |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
442 (cond |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
443 (Man-fontify-manpage-flag |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
444 nil) |
53477
79093b308520
* progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents:
52636
diff
changeset
|
445 ((eq 0 (call-process Man-sed-command nil nil nil Man-sysv-sed-script)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
446 Man-sysv-sed-script) |
53477
79093b308520
* progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents:
52636
diff
changeset
|
447 ((eq 0 (call-process Man-sed-command nil nil nil Man-berkeley-sed-script)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
448 Man-berkeley-sed-script) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
449 (t |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
450 nil)))) |
3235 | 451 |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
452 (setq Man-filter-list |
23267
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
453 ;; Avoid trailing nil which confuses customize. |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
454 (apply 'list |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
455 (cons |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
456 Man-sed-command |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
457 (list |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
458 (if Man-sed-script |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
459 (concat "-e '" Man-sed-script "'") |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
460 "") |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
461 "-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
|
462 "-e '/\e[789]/s///g'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
463 "-e '/Reformatting page. Wait/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
464 "-e '/Reformatting entry. Wait/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
465 "-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
|
466 "-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
|
467 "-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
|
468 "-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
|
469 "-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
|
470 "-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
|
471 "-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
|
472 "-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
|
473 "-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
|
474 "-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
|
475 )) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
476 (cons |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
477 Man-awk-command |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
478 (list |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
479 "'\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
480 "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
|
481 "/^$/ { if (anonblank==0) next; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
482 "{ anonblank=1; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
483 "/^$/ { blankline++; next; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
484 "{ 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
|
485 "'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
486 )) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
487 (if (not Man-uses-untabify-flag) |
23267
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
488 ;; 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
|
489 (list (cons |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
490 Man-untabify-command |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
491 Man-untabify-command-args)) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
492 ))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
493 ) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
494 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
495 (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
|
496 "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
|
497 (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
|
498 (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
|
499 "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
500 Man-current-page |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
501 (length Man-page-list))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
502 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
503 (defsubst Man-build-man-command () |
3235 | 504 "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
|
505 (let ((command (concat manual-program " " Man-switches |
54515 | 506 (cond |
507 ;; Already has %s | |
508 ((string-match "%s" manual-program) "") | |
509 ;; Stock MS-DOS shells cannot redirect stderr; | |
510 ;; `call-process' below sends it to /dev/null, | |
511 ;; so we don't need `2>' even with DOS shells | |
512 ;; which do support stderr redirection. | |
513 ((not (fboundp 'start-process)) " %s") | |
514 ((concat " %s 2>" null-device))))) | |
3235 | 515 (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
|
516 (while (and flist (car flist)) |
3235 | 517 (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
|
518 (pargs (cdr (car flist)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
519 (setq command |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
520 (concat command " | " pcom " " |
29585
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
521 (mapconcat (lambda (phrase) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
522 (if (not (stringp phrase)) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
523 (error "Malformed Man-filter-list")) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
524 phrase) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
525 pargs " "))) |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
526 (setq flist (cdr flist)))) |
3235 | 527 command)) |
528 | |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
529 |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
530 (defun Man-translate-cleanup (string) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
531 "Strip leading, trailing and middle spaces." |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
532 (when (stringp string) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
533 ;; Strip leading and trailing |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
534 (if (string-match "^[ \t\f\r\n]*\\(.+[^ \t\f\r\n]\\)" string) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
535 (setq string (match-string 1 string))) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
536 ;; middle spaces |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
537 (setq string (replace-regexp-in-string "[\t\r\n]" " " string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
538 (setq string (replace-regexp-in-string " +" " " string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
539 string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
540 |
3235 | 541 (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
|
542 "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
|
543 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
|
544 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
|
545 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
|
546 (let ((name "") |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
547 (section "") |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
548 (slist Man-section-translations-alist)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
549 (setq ref (Man-translate-cleanup ref)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
550 (cond |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
551 ;; "chmod(2V)" case ? |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
552 ((string-match (concat "^" Man-reference-regexp "$") ref) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
553 (setq name (match-string 1 ref) |
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
554 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
|
555 ;; "2v chmod" case ? |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
556 ((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
|
557 "\\) +\\(" Man-name-regexp "\\)$") ref) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
558 (setq name (match-string 2 ref) |
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
559 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
|
560 (if (string= name "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
561 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
|
562 (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
|
563 (setq section (downcase section))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
564 (while slist |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
565 (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
|
566 (s2 (cdr (car slist)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
567 (setq slist (cdr slist)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
568 (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
|
569 (setq s1 (downcase s1))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
570 (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
|
571 (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
|
572 (downcase s2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
573 s2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
574 slist nil)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
575 (concat Man-specified-section-option section " " name)))) |
3235 | 576 |
54515 | 577 (defun Man-support-local-filenames () |
578 "Check the availability of `-l' option of the man command. | |
579 This option allows `man' to interpret command line arguments | |
580 as local filenames. | |
581 Return the value of the variable `Man-support-local-filenames' | |
582 if it was set to nil or t before the call of this function. | |
583 If t, the man command supports `-l' option. If nil, it don't. | |
584 Otherwise, if the value of `Man-support-local-filenames' | |
585 is neither t nor nil, then determine a new value, set it | |
586 to the variable `Man-support-local-filenames' and return | |
587 a new value." | |
588 (if (or (not Man-support-local-filenames) | |
589 (eq Man-support-local-filenames t)) | |
590 Man-support-local-filenames | |
591 (setq Man-support-local-filenames | |
592 (with-temp-buffer | |
593 (and (equal (condition-case nil | |
594 (call-process manual-program nil t nil "--help") | |
595 (error nil)) | |
596 0) | |
597 (progn | |
598 (goto-char (point-min)) | |
599 (search-forward "--local-file" nil t)) | |
600 t))))) | |
601 | |
3235 | 602 |
603 ;; ====================================================================== | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
604 ;; default man entry: get word under point |
3235 | 605 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
606 (defsubst Man-default-man-entry () |
3235 | 607 "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
|
608 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
|
609 (let (word) |
3235 | 610 (save-excursion |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
611 ;; 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
|
612 ;; cursor not on a word, then nearest preceding word. |
48012
73c9cc6e8538
(Man-default-man-entry): Don't look for all word chars,
Richard M. Stallman <rms@gnu.org>
parents:
47891
diff
changeset
|
613 (skip-chars-backward "-a-zA-Z0-9._+:") |
73c9cc6e8538
(Man-default-man-entry): Don't look for all word chars,
Richard M. Stallman <rms@gnu.org>
parents:
47891
diff
changeset
|
614 (let ((start (point))) |
73c9cc6e8538
(Man-default-man-entry): Don't look for all word chars,
Richard M. Stallman <rms@gnu.org>
parents:
47891
diff
changeset
|
615 (skip-chars-forward "-a-zA-Z0-9._+:") |
52324
c97fe9557de4
(Man-default-man-entry): Strip text properties when
John Paul Wallington <jpw@pobox.com>
parents:
51892
diff
changeset
|
616 (setq word (buffer-substring-no-properties start (point)))) |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
617 (if (string-match "[._]+$" word) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
618 (setq word (substring word 0 (match-beginning 0)))) |
52636
87642088b41e
(Man-default-man-entry): Remove the leading `*' from the word at point.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
619 ;; If looking at something like *strcat(... , remove the '*' |
87642088b41e
(Man-default-man-entry): Remove the leading `*' from the word at point.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
620 (if (string-match "^*" word) |
87642088b41e
(Man-default-man-entry): Remove the leading `*' from the word at point.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
621 (setq word (substring word 1))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
622 ;; 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
|
623 ;; section number in the returned value. Remove text properties. |
52324
c97fe9557de4
(Man-default-man-entry): Strip text properties when
John Paul Wallington <jpw@pobox.com>
parents:
51892
diff
changeset
|
624 (concat word |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
625 (if (looking-at |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
626 (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)")) |
52324
c97fe9557de4
(Man-default-man-entry): Strip text properties when
John Paul Wallington <jpw@pobox.com>
parents:
51892
diff
changeset
|
627 (format "(%s)" (match-string-no-properties 1))))))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
628 |
3235 | 629 |
630 ;; ====================================================================== | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
631 ;; Top level command and background process sentinel |
3235 | 632 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
633 ;; For compatibility with older versions. |
4444 | 634 ;;;###autoload |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
635 (defalias 'manual-entry 'man) |
4444 | 636 |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
637 |
3235 | 638 ;;;###autoload |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
639 (defun man (man-args) |
3235 | 640 "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
|
641 This command is the top-level command in the man package. It runs a Un*x |
3235 | 642 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
|
643 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
|
644 `Man-notify-method' for what happens when the buffer is ready. |
29838 | 645 If a buffer already exists for this man page, it will display immediately. |
646 | |
647 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
|
648 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
|
649 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
|
650 `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
|
651 (interactive |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
652 (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
|
653 (input (read-string |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
654 (format "Manual entry%s: " |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
655 (if (string= default-entry "") |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
656 "" |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
657 (format " (default %s)" default-entry))) |
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
658 nil nil default-entry))) |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
659 (if (string= input "") |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
660 (error "No man args given") |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
661 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
|
662 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
663 ;; 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
|
664 ;; "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
|
665 (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
|
666 |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
667 (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
|
668 |
17129 | 669 ;;;###autoload |
670 (defun man-follow (man-args) | |
671 "Get a Un*x manual page of the item under point and put it in a buffer." | |
672 (interactive (list (Man-default-man-entry))) | |
673 (if (or (not man-args) | |
674 (string= man-args "")) | |
675 (error "No item under point") | |
676 (man man-args))) | |
3235 | 677 |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
678 (defun Man-getpage-in-background (topic) |
28102 | 679 "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
|
680 (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
|
681 (bufname (concat "*Man " man-args "*")) |
3235 | 682 (buffer (get-buffer bufname))) |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
683 (if buffer |
3235 | 684 (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
|
685 (require 'env) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
686 (message "Invoking %s %s in the background" manual-program man-args) |
3235 | 687 (setq buffer (generate-new-buffer bufname)) |
6363
e5d9ea7852bf
(Man-original-frame): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6362
diff
changeset
|
688 (save-excursion |
e5d9ea7852bf
(Man-original-frame): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
6362
diff
changeset
|
689 (set-buffer buffer) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
690 (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
|
691 (setq Man-arguments man-args)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
692 (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
|
693 ;; 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
|
694 ;; 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
|
695 (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
|
696 ;; We must decode the output by a coding system that the |
32495 | 697 ;; 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
|
698 (coding-system-for-read |
b68d86c19284
(Man-getpage-in-background): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
31005
diff
changeset
|
699 (if default-enable-multibyte-characters |
b68d86c19284
(Man-getpage-in-background): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
31005
diff
changeset
|
700 locale-coding-system 'raw-text-unix)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
701 ;; Avoid possible error by using a directory that always exists. |
50054
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
702 (default-directory |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
703 (if (and (file-directory-p default-directory) |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
704 (not (find-file-name-handler default-directory |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
705 'file-directory-p))) |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
706 default-directory |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
707 "/"))) |
3713
c77a3da2d08d
(Man-getpage-in-background): Use TERM=dumb to prevent
Richard M. Stallman <rms@gnu.org>
parents:
3659
diff
changeset
|
708 ;; 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
|
709 (setenv "TERM" "dumb") |
47891
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
710 ;; In Debian Woody, at least, we get overlong lines under X |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
711 ;; unless COLUMNS or MANWIDTH is set. This isn't a problem on |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
712 ;; a tty. man(1) says: |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
713 ;; MANWIDTH |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
714 ;; If $MANWIDTH is set, its value is used as the line |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
715 ;; length for which manual pages should be formatted. |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
716 ;; If it is not set, manual pages will be formatted |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
717 ;; with a line length appropriate to the current ter- |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
718 ;; minal (using an ioctl(2) if available, the value of |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
719 ;; $COLUMNS, or falling back to 80 characters if nei- |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
720 ;; ther is available). |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
721 (if window-system |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
722 (unless (or (getenv "MANWIDTH") (getenv "COLUMNS")) |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
723 ;; This isn't strictly correct, since we don't know how |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
724 ;; the page will actually be displayed, but it seems |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
725 ;; reasonable. |
54515 | 726 (setenv "COLUMNS" (number-to-string |
727 (cond | |
728 ((and (integerp Man-width) (> Man-width 0)) | |
729 Man-width) | |
730 (Man-width (frame-width)) | |
731 ((window-width))))))) | |
50476
14e9fad0af6b
(Man-getpage-in-background): Set GROFF_NO_SGR env var in
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50418
diff
changeset
|
732 (setenv "GROFF_NO_SGR" "1") |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
733 (if (fboundp 'start-process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
734 (set-process-sentinel |
55527
4729059e27b8
(Man-getpage-in-background): Use shell-file-name
Eli Zaretskii <eliz@gnu.org>
parents:
54515
diff
changeset
|
735 (start-process manual-program buffer |
56254
060e08bf63fe
(Man-getpage-in-background): Add windows-nt to the list
Eli Zaretskii <eliz@gnu.org>
parents:
56159
diff
changeset
|
736 (if (memq system-type '(cygwin windows-nt)) |
060e08bf63fe
(Man-getpage-in-background): Add windows-nt to the list
Eli Zaretskii <eliz@gnu.org>
parents:
56159
diff
changeset
|
737 shell-file-name |
060e08bf63fe
(Man-getpage-in-background): Add windows-nt to the list
Eli Zaretskii <eliz@gnu.org>
parents:
56159
diff
changeset
|
738 "sh") |
56159
8fd93d7de209
(Man-getpage-in-background): Revert previous change but
Nick Roberts <nickrob@snap.net.nz>
parents:
55527
diff
changeset
|
739 shell-command-switch |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
740 (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
|
741 'Man-bgproc-sentinel) |
50062
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
742 (let ((exit-status |
55527
4729059e27b8
(Man-getpage-in-background): Use shell-file-name
Eli Zaretskii <eliz@gnu.org>
parents:
54515
diff
changeset
|
743 (call-process shell-file-name nil (list buffer nil) nil |
4729059e27b8
(Man-getpage-in-background): Use shell-file-name
Eli Zaretskii <eliz@gnu.org>
parents:
54515
diff
changeset
|
744 shell-command-switch |
50062
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
745 (format (Man-build-man-command) man-args))) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
746 (msg "")) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
747 (or (and (numberp exit-status) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
748 (= exit-status 0)) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
749 (and (numberp exit-status) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
750 (setq msg |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
751 (format "exited abnormally with code %d" |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
752 exit-status))) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
753 (setq msg exit-status)) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
754 (Man-bgproc-sentinel bufname msg))))))) |
3235 | 755 |
756 (defun Man-notify-when-ready (man-buffer) | |
757 "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
|
758 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
|
759 (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
|
760 (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
|
761 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
|
762 (cond |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
763 ((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
|
764 ;; 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
|
765 ;; 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
|
766 ;; 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
|
767 ;; 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
|
768 (save-excursion |
21581
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
769 (let ((frame (make-frame Man-frame-parameters))) |
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
770 (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
|
771 (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
|
772 (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
|
773 (select-frame frame))))) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
774 ((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
|
775 (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
|
776 ((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
|
777 (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
|
778 (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
|
779 (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
|
780 (delete-other-windows)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
781 ((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
|
782 (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
|
783 (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
|
784 (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
|
785 ((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
|
786 (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
|
787 (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
|
788 (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
|
789 ((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
|
790 (beep) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
791 (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
|
792 ((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
|
793 (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
|
794 ((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
|
795 t) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
796 (message "")) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
797 ))) |
3235 | 798 |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
799 (defun Man-softhyphen-to-minus () |
47891
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
800 ;; \255 is SOFT HYPHEN in Latin-N. Versions of Debian man, at |
25202
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
801 ;; 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
|
802 (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
|
803 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
|
804 (goto-char (point-min)) |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
805 (let ((str "\255")) |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
806 (if enable-multibyte-characters |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
807 (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
|
808 (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
|
809 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
810 (defun Man-fontify-manpage () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
811 "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
|
812 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
|
813 (interactive) |
54515 | 814 (message "Please wait: formatting the %s man page..." Man-arguments) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
815 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
816 (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
|
817 (delete-backward-char 4) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
818 (put-text-property (point) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
819 (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
|
820 (delete-backward-char 4)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
821 (point)) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
822 'face Man-overstrike-face)) |
29524
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
823 (if (< (buffer-size) (position-bytes (point-max))) |
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
824 ;; Multibyte characters exist. |
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
825 (progn |
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
826 (goto-char (point-min)) |
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
827 (while (search-forward "__\b\b" nil t) |
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
828 (backward-delete-char 4) |
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
829 (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
|
830 (goto-char (point-min)) |
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
831 (while (search-forward "\b\b__" nil t) |
29525
1b0629c98957
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29524
diff
changeset
|
832 (backward-delete-char 4) |
29524
53382e1c6251
(Man-fontify-manpage): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29519
diff
changeset
|
833 (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
|
834 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
835 (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
|
836 (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
|
837 (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
|
838 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
839 (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
|
840 (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
|
841 (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
|
842 (goto-char (point-min)) |
29519
e1423c7d516e
(Man-fontify-manpage): Pay attention to overstrike
Kenichi Handa <handa@m17n.org>
parents:
28102
diff
changeset
|
843 (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
|
844 (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
|
845 (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
|
846 (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
|
847 (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
|
848 (replace-match "o") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
849 (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
|
850 (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
|
851 (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) |
9177 | 852 (replace-match "+") |
853 (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
|
854 (goto-char (point-min)) |
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
855 ;; Try to recognize common forms of cross references. |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
856 (Man-highlight-references) |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
857 (Man-softhyphen-to-minus) |
54005
230edeac0da5
(Man-fontify-manpage): Render section headings in
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53690
diff
changeset
|
858 (goto-char (point-min)) |
230edeac0da5
(Man-fontify-manpage): Render section headings in
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53690
diff
changeset
|
859 (while (re-search-forward Man-heading-regexp nil t) |
230edeac0da5
(Man-fontify-manpage): Render section headings in
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53690
diff
changeset
|
860 (put-text-property (match-beginning 0) |
230edeac0da5
(Man-fontify-manpage): Render section headings in
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53690
diff
changeset
|
861 (match-end 0) |
230edeac0da5
(Man-fontify-manpage): Render section headings in
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53690
diff
changeset
|
862 'face Man-overstrike-face)) |
53690
f428900fb582
(Man-fontify-manpage): Clean up message.
Richard M. Stallman <rms@gnu.org>
parents:
53477
diff
changeset
|
863 (message "%s man page formatted" Man-arguments)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
864 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
865 (defun Man-highlight-references () |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
866 "Highlight the references on mouse-over. |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
867 references include items in the SEE ALSO section, |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
868 header file(#include <foo.h>) and files in FILES" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
869 (let ((dummy 0)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
870 (Man-highlight-references0 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
871 Man-see-also-regexp Man-reference-regexp 1 dummy |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
872 'Man-xref-man-page) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
873 (Man-highlight-references0 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
874 Man-synopsis-regexp Man-header-regexp 0 2 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
875 'Man-xref-header-file) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
876 (Man-highlight-references0 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
877 Man-files-regexp Man-normal-file-regexp 0 0 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
878 'Man-xref-normal-file))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
879 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
880 (defun Man-highlight-references0 (start-section regexp button-pos target-pos type) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
881 ;; Based on `Man-build-references-alist' |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
882 (when (Man-find-section start-section) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
883 (forward-line 1) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
884 (let ((end (save-excursion |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
885 (Man-next-section 1) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
886 (point)))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
887 (back-to-indentation) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
888 (while (re-search-forward regexp end t) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
889 (make-text-button |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
890 (match-beginning button-pos) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
891 (match-end button-pos) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
892 'type type |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
893 'Man-target-string (match-string target-pos) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
894 ))))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
895 |
57699
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
896 (defun Man-cleanup-manpage (&optional interactive) |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
897 "Remove overstriking and underlining from the current buffer. |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
898 Normally skip any jobs that should have been done by the sed script, |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
899 but when called interactively, do those jobs even if the sed |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
900 script would have done them." |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
901 (interactive "p") |
9620
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
902 (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
|
903 Man-arguments) |
57699
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
904 (if (or interactive (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
|
905 (progn |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
906 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
907 (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
|
908 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
909 (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
|
910 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
911 (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
|
912 (replace-match "\\1")) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
913 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
914 (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
|
915 (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
|
916 (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
|
917 )) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
918 (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
|
919 (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
|
920 (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
|
921 (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
|
922 |
3235 | 923 (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
|
924 "Manpage background process sentinel. |
28102 | 925 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
|
926 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
|
927 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
|
928 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
|
929 manpage command." |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
930 (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
|
931 (process-buffer process))) |
3235 | 932 (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
|
933 (err-mess nil)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
934 |
3235 | 935 (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
|
936 (or (stringp process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
937 (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
|
938 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
939 (save-excursion |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
940 (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
|
941 (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
|
942 (goto-char (point-min)) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
943 (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
|
944 (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
|
945 (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
|
946 (progn |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
947 (end-of-line) (point))) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
948 delete-buff t)) |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
949 ((or (stringp process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
950 (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
|
951 (= (process-exit-status process) 0)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
952 (or (zerop (length msg)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
953 (progn |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
954 (setq err-mess |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
955 (concat (buffer-name Man-buffer) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
956 ": process " |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
957 (let ((eos (1- (length msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
958 (if (= (aref msg eos) ?\n) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
959 (substring msg 0 eos) msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
960 (goto-char (point-max)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
961 (insert (format "\nprocess %s" msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
962 )) |
16509
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
963 (if delete-buff |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
964 (kill-buffer Man-buffer) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
965 (if Man-fontify-manpage-flag |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
966 (Man-fontify-manpage) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
967 (Man-cleanup-manpage)) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
968 (run-hooks 'Man-cooked-hook) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
969 (Man-mode) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
970 (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
|
971 )) |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
972 ;; 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
|
973 ;; Man-notify-when-ready because it may switch buffers. |
3235 | 974 |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
975 (if (not delete-buff) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
976 (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
|
977 |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
978 (if err-mess |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
979 (error err-mess)) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
980 )))) |
3235 | 981 |
982 | |
983 ;; ====================================================================== | |
984 ;; set up manual mode in buffer and build alists | |
985 | |
986 (defun Man-mode () | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
987 "A mode for browsing Un*x manual pages. |
3235 | 988 |
28102 | 989 The following man commands are available in the buffer. Try |
3235 | 990 \"\\[describe-key] <key> RET\" for more information: |
991 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
992 \\[man] Prompt to retrieve a new manpage. |
3235 | 993 \\[Man-follow-manual-reference] Retrieve reference in SEE ALSO section. |
994 \\[Man-next-manpage] Jump to next manpage in circular list. | |
995 \\[Man-previous-manpage] Jump to previous manpage in circular list. | |
996 \\[Man-next-section] Jump to next manpage section. | |
997 \\[Man-previous-section] Jump to previous manpage section. | |
998 \\[Man-goto-section] Go to a manpage section. | |
999 \\[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
|
1000 \\[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
|
1001 \\[Man-kill] Deletes the manpage window, kill its buffer. |
3235 | 1002 \\[describe-mode] Prints this help text. |
1003 | |
28102 | 1004 The following variables may be of some use. Try |
3235 | 1005 \"\\[describe-variable] <variable-name> RET\" for more information: |
1006 | |
28102 | 1007 `Man-notify-method' What happens when manpage formatting is done. |
1008 `Man-downcase-section-letters-flag' Force section letters to lower case. | |
1009 `Man-circular-pages-flag' Treat multiple manpage list as circular. | |
1010 `Man-section-translations-alist' List of section numbers and their Un*x equiv. | |
1011 `Man-filter-list' Background manpage filter command. | |
1012 `Man-mode-map' Keymap bindings for Man mode buffers. | |
1013 `Man-mode-hook' Normal hook run on entry to Man mode. | |
1014 `Man-section-regexp' Regexp describing manpage section letters. | |
1015 `Man-heading-regexp' Regexp describing section headers. | |
1016 `Man-see-also-regexp' Regexp for SEE ALSO section (or your equiv). | |
1017 `Man-first-heading-regexp' Regexp for first heading on a manpage. | |
1018 `Man-reference-regexp' Regexp matching a references in SEE ALSO. | |
1019 `Man-switches' Background `man' command switches. | |
3235 | 1020 |
1021 The following key bindings are currently in effect in the buffer: | |
1022 \\{Man-mode-map}" | |
1023 (interactive) | |
1024 (setq major-mode 'Man-mode | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
1025 mode-name "Man" |
3235 | 1026 buffer-auto-save-file-name nil |
38970
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1027 mode-line-buffer-identification |
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1028 (list (default-value 'mode-line-buffer-identification) |
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1029 " {" 'Man-page-mode-string "}") |
3235 | 1030 truncate-lines t |
1031 buffer-read-only t) | |
1032 (buffer-disable-undo (current-buffer)) | |
1033 (auto-fill-mode -1) | |
1034 (use-local-map Man-mode-map) | |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
1035 (set-syntax-table man-mode-syntax-table) |
54515 | 1036 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) |
1037 (set (make-local-variable 'outline-regexp) Man-heading-regexp) | |
1038 (set (make-local-variable 'outline-level) (lambda () 1)) | |
3235 | 1039 (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
|
1040 (Man-strip-page-headers) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1041 (Man-unindent) |
3619
062dbb10173d
(Man-mode): Run Man-mode-hook.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
1042 (Man-goto-page 1) |
062dbb10173d
(Man-mode): Run Man-mode-hook.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
1043 (run-hooks 'Man-mode-hook)) |
3235 | 1044 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1045 (defsubst Man-build-section-alist () |
3235 | 1046 "Build the association list of manpage sections." |
1047 (setq Man-sections-alist nil) | |
1048 (goto-char (point-min)) | |
7450 | 1049 (let ((case-fold-search nil)) |
1050 (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
|
1051 (aput 'Man-sections-alist (match-string 1)) |
7450 | 1052 (forward-line 1)))) |
3235 | 1053 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1054 (defsubst Man-build-references-alist () |
3235 | 1055 "Build the association list of references (in the SEE ALSO section)." |
1056 (setq Man-refpages-alist nil) | |
1057 (save-excursion | |
1058 (if (Man-find-section Man-see-also-regexp) | |
1059 (let ((start (progn (forward-line 1) (point))) | |
1060 (end (progn | |
1061 (Man-next-section 1) | |
1062 (point))) | |
1063 hyphenated | |
1064 (runningpoint -1)) | |
7450 | 1065 (save-restriction |
1066 (narrow-to-region start end) | |
1067 (goto-char (point-min)) | |
1068 (back-to-indentation) | |
1069 (while (and (not (eobp)) (/= (point) runningpoint)) | |
1070 (setq runningpoint (point)) | |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1071 (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
|
1072 (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
|
1073 (len (1- (length word)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1074 (if hyphenated |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1075 (setq word (concat hyphenated word) |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1076 hyphenated nil |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1077 ;; Update len, in case a reference spans |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1078 ;; more than two lines (paranoia). |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1079 len (1- (length word)))) |
51376
ec20af5e04b3
(Man-name-regexp): Also match Latin-1 soft hyphen.
Andreas Schwab <schwab@suse.de>
parents:
50602
diff
changeset
|
1080 (if (memq (aref word len) '(?- ?)) |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1081 (setq hyphenated (substring word 0 len))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1082 (if (string-match Man-reference-regexp word) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1083 (aput 'Man-refpages-alist word)))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1084 (skip-chars-forward " \t\n,")))))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1085 (setq Man-refpages-alist (nreverse Man-refpages-alist))) |
3235 | 1086 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1087 (defun Man-build-page-list () |
3235 | 1088 "Build the list of separate manpages in the buffer." |
1089 (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
|
1090 (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
|
1091 (page-end (point-max)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1092 (header "")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1093 (goto-char page-start) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1094 ;; (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
|
1095 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1096 (setq header |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1097 (if (looking-at Man-page-header-regexp) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
1098 (match-string 1) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1099 nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1100 ;; 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
|
1101 (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
|
1102 (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
|
1103 ;; 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
|
1104 ;; 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
|
1105 ;; 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
|
1106 ;; 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
|
1107 ;; previous page header. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1108 (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
|
1109 (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
|
1110 (beginning-of-line)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1111 (setq page-end (point)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1112 (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
|
1113 (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
|
1114 (copy-marker page-end) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1115 header)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1116 (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
|
1117 ))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1118 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1119 (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
|
1120 "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
|
1121 (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
|
1122 (case-fold-search nil) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1123 (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
|
1124 (page ()) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1125 (header "")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1126 (while page-list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1127 (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
|
1128 (and (nth 2 page) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1129 (goto-char (car page)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1130 (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
|
1131 (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
|
1132 ;; 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
|
1133 ;; 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
|
1134 ;; 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
|
1135 ;; 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
|
1136 ;; 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
|
1137 ;; 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
|
1138 ;; line. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1139 ;; (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
|
1140 (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
|
1141 (replace-match ""))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1142 (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
|
1143 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1144 (defun Man-unindent () |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1145 "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
|
1146 (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
|
1147 (case-fold-search nil) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1148 (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
|
1149 (while page-list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1150 (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
|
1151 (indent "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1152 (nindent 0)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1153 (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
|
1154 (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
|
1155 (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
|
1156 (if (catch 'unindent |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1157 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1158 (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
|
1159 (throw 'unindent nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1160 (beginning-of-line) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1161 (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
|
1162 (progn |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1163 (skip-chars-forward " ") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1164 (point)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1165 (setq nindent (length indent)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1166 (if (zerop nindent) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1167 (throw 'unindent nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1168 (setq indent (concat indent "\\|$")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1169 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1170 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1171 (if (looking-at indent) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1172 (forward-line 1) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1173 (throw 'unindent nil))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1174 (goto-char (point-min))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1175 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1176 (or (eolp) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1177 (delete-char nindent)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1178 (forward-line 1))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1179 (setq page-list (cdr page-list)) |
7450 | 1180 )))) |
3235 | 1181 |
1182 | |
1183 ;; ====================================================================== | |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1184 ;; Man mode commands |
3235 | 1185 |
1186 (defun Man-next-section (n) | |
1187 "Move point to Nth next section (default 1)." | |
1188 (interactive "p") | |
7450 | 1189 (let ((case-fold-search nil)) |
1190 (if (looking-at Man-heading-regexp) | |
1191 (forward-line 1)) | |
1192 (if (re-search-forward Man-heading-regexp (point-max) t n) | |
1193 (beginning-of-line) | |
1194 (goto-char (point-max))))) | |
3235 | 1195 |
1196 (defun Man-previous-section (n) | |
1197 "Move point to Nth previous section (default 1)." | |
1198 (interactive "p") | |
7450 | 1199 (let ((case-fold-search nil)) |
1200 (if (looking-at Man-heading-regexp) | |
1201 (forward-line -1)) | |
1202 (if (re-search-backward Man-heading-regexp (point-min) t n) | |
1203 (beginning-of-line) | |
1204 (goto-char (point-min))))) | |
3235 | 1205 |
1206 (defun Man-find-section (section) | |
1207 "Move point to SECTION if it exists, otherwise don't move point. | |
1208 Returns t if section is found, nil otherwise." | |
7450 | 1209 (let ((curpos (point)) |
1210 (case-fold-search nil)) | |
3235 | 1211 (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
|
1212 (if (re-search-forward (concat "^" section) (point-max) t) |
3235 | 1213 (progn (beginning-of-line) t) |
1214 (goto-char curpos) | |
1215 nil) | |
1216 )) | |
1217 | |
1218 (defun Man-goto-section () | |
1219 "Query for section to move point to." | |
1220 (interactive) | |
1221 (aput 'Man-sections-alist | |
1222 (let* ((default (aheadsym Man-sections-alist)) | |
1223 (completion-ignore-case t) | |
1224 chosen | |
1225 (prompt (concat "Go to section: (default " default ") "))) | |
1226 (setq chosen (completing-read prompt Man-sections-alist)) | |
1227 (if (or (not chosen) | |
1228 (string= chosen "")) | |
1229 default | |
1230 chosen))) | |
1231 (Man-find-section (aheadsym Man-sections-alist))) | |
1232 | |
1233 (defun Man-goto-see-also-section () | |
42706 | 1234 "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
|
1235 Actually the section moved to is described by `Man-see-also-regexp'." |
3235 | 1236 (interactive) |
1237 (if (not (Man-find-section Man-see-also-regexp)) | |
1238 (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
|
1239 " section found in the current manpage")))) |
3235 | 1240 |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1241 (defun Man-possibly-hyphenated-word () |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1242 "Return a possibly hyphenated word at point. |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1243 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
|
1244 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
|
1245 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
|
1246 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
|
1247 \"tcgetp-\" instead of \"grp\"." |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1248 (save-excursion |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1249 (skip-syntax-backward "w()") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1250 (skip-chars-forward " \t") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1251 (let ((beg (point)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1252 (word (current-word))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1253 (when (eq beg (save-excursion |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1254 (back-to-indentation) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1255 (point))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1256 (end-of-line 0) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1257 (if (eq (char-before) ?-) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1258 (setq word (current-word)))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1259 word))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1260 |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1261 (defun Man-follow-manual-reference (reference) |
3235 | 1262 "Get one of the manpages referred to in the \"SEE ALSO\" section. |
28102 | 1263 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
|
1264 (interactive |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1265 (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
|
1266 (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
|
1267 (list (let* ((default (or |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1268 (car (all-completions |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1269 (let ((word (Man-possibly-hyphenated-word))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1270 ;; strip a trailing '-': |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1271 (if (string-match "-$" word) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1272 (substring word 0 |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1273 (match-beginning 0)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1274 word)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1275 Man-refpages-alist)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1276 (aheadsym Man-refpages-alist))) |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1277 chosen |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1278 (prompt (concat "Refer to: (default " default ") "))) |
50602
c7575377858f
(Man-follow-manual-reference): Don't require match
Richard M. Stallman <rms@gnu.org>
parents:
50519
diff
changeset
|
1279 (setq chosen (completing-read prompt Man-refpages-alist)) |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1280 (if (or (not chosen) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1281 (string= chosen "")) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1282 default |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1283 chosen))))) |
3235 | 1284 (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
|
1285 (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
|
1286 (aput 'Man-refpages-alist reference) |
3235 | 1287 (Man-getpage-in-background |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1288 (Man-translate-references (aheadsym Man-refpages-alist))))) |
3235 | 1289 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1290 (defun Man-kill () |
3235 | 1291 "Kill the buffer containing the manpage." |
1292 (interactive) | |
22368
c3a15ab5924f
(Man-kill, Man-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
22217
diff
changeset
|
1293 (quit-window t)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1294 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1295 (defun Man-quit () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1296 "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
|
1297 (interactive) |
22368
c3a15ab5924f
(Man-kill, Man-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
22217
diff
changeset
|
1298 (quit-window)) |
3235 | 1299 |
1300 (defun Man-goto-page (page) | |
1301 "Go to the manual page on page PAGE." | |
1302 (interactive | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1303 (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
|
1304 (let ((args Man-arguments)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1305 (kill-buffer (current-buffer)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1306 (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
|
1307 (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
|
1308 (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
|
1309 (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
|
1310 (length Man-page-list))))))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1311 (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
|
1312 (let ((args Man-arguments)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1313 (kill-buffer (current-buffer)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1314 (error "Can't find the %s manpage" args))) |
3235 | 1315 (if (or (< page 1) |
1316 (> page (length Man-page-list))) | |
1317 (error "No manpage %d found" page)) | |
1318 (let* ((page-range (nth (1- page) Man-page-list)) | |
1319 (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
|
1320 (page-end (car (cdr page-range)))) |
3235 | 1321 (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
|
1322 Man-page-mode-string (Man-make-page-mode-string)) |
3235 | 1323 (widen) |
1324 (goto-char page-start) | |
1325 (narrow-to-region page-start page-end) | |
1326 (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
|
1327 (Man-build-references-alist) |
3235 | 1328 (goto-char (point-min)))) |
1329 | |
1330 | |
1331 (defun Man-next-manpage () | |
1332 "Find the next manpage entry in the buffer." | |
1333 (interactive) | |
1334 (if (= (length Man-page-list) 1) | |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1335 (error "This is the only manpage in the buffer")) |
3235 | 1336 (if (< Man-current-page (length Man-page-list)) |
1337 (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
|
1338 (if Man-circular-pages-flag |
3235 | 1339 (Man-goto-page 1) |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1340 (error "You're looking at the last manpage in the buffer")))) |
3235 | 1341 |
1342 (defun Man-previous-manpage () | |
1343 "Find the previous manpage entry in the buffer." | |
1344 (interactive) | |
1345 (if (= (length Man-page-list) 1) | |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1346 (error "This is the only manpage in the buffer")) |
3235 | 1347 (if (> Man-current-page 1) |
1348 (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
|
1349 (if Man-circular-pages-flag |
3235 | 1350 (Man-goto-page (length Man-page-list)) |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1351 (error "You're looking at the first manpage in the buffer")))) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1352 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1353 ;; Header file support |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1354 (defun Man-view-header-file (file) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1355 "View a header file specified by FILE from `Man-header-file-path'." |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1356 (let ((path Man-header-file-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1357 complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1358 (while path |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1359 (setq complete-path (concat (car path) "/" file) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1360 path (cdr path)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1361 (if (file-readable-p complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1362 (progn (view-file complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1363 (setq path nil)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1364 (setq complete-path nil))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1365 complete-path)) |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1366 |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1367 ;; 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
|
1368 (Man-init-defvars) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1369 |
28102 | 1370 (add-to-list 'debug-ignored-errors "^No manpage [0-9]* found$") |
1371 (add-to-list 'debug-ignored-errors "^Can't find the .* manpage$") | |
1372 | |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1373 (provide 'man) |
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1374 |
52401 | 1375 ;;; arch-tag: 587cda76-8e23-4594-b1f3-89b6b09a0d47 |
3235 | 1376 ;;; man.el ends here |