Mercurial > emacs
annotate lisp/man.el @ 108002:c609e6e60b3d
* vc-dispatcher (vc-finish-logentry): Don't mess with the windows/frames.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 20 Apr 2010 12:52:43 -0400 |
parents | d9895f87d758 |
children | bace4ba4c137 |
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 |
104823
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
102437
diff
changeset
|
3 ;; Copyright (C) 1993, 1994, 1996, 1997, 2001, 2002, 2003, 2004, 2005, |
106815 | 4 ;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
3235 | 5 |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
36575
diff
changeset
|
6 ;; Author: Barry A. Warsaw <bwarsaw@cen.com> |
28102 | 7 ;; 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
|
8 ;; Keywords: help |
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
36575
diff
changeset
|
9 ;; Adapted-By: ESR, pot |
3235 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
3235 | 14 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
16 ;; (at your option) any later version. |
3235 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
3235 | 25 |
26 ;;; Commentary: | |
27 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
28 ;; This code provides a function, `man', with which you can browse |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
29 ;; UNIX manual pages. Formatting is done in background so that you |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
30 ;; can continue to use your Emacs while processing is going on. |
3235 | 31 ;; |
32 ;; The mode also supports hypertext-like following of manual page SEE | |
33 ;; ALSO references, and other features. See below or do `?' in a | |
34 ;; manual page buffer for details. | |
35 | |
28102 | 36 ;; ========== Credits and History ========== |
3235 | 37 ;; In mid 1991, several people posted some interesting improvements to |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
38 ;; man.el from the standard Emacs 18.57 distribution. I liked many of |
14040 | 39 ;; these, but wanted everything in one single package, so I decided |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
40 ;; to incorporate them into a single manual browsing mode. While |
3235 | 41 ;; much of the code here has been rewritten, and some features added, |
42 ;; these folks deserve lots of credit for providing the initial | |
43 ;; excellent packages on which this one is based. | |
44 | |
45 ;; Nick Duffek <duffek@chaos.cs.brandeis.edu>, posted a very nice | |
46 ;; improvement which retrieved and cleaned the manpages in a | |
47 ;; background process, and which correctly deciphered such options as | |
48 ;; man -k. | |
49 | |
50 ;; Eric Rose <erose@jessica.stanford.edu>, submitted manual.el which | |
51 ;; provided a very nice manual browsing mode. | |
52 | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3307
diff
changeset
|
53 ;; This package was available as `superman.el' from the LCD package |
3235 | 54 ;; for some time before it was accepted into Emacs 19. The entry |
55 ;; point and some other names have been changed to make it a drop-in | |
56 ;; replacement for the old man.el package. | |
57 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
58 ;; Francesco Potorti` <pot@cnuce.cnr.it> cleaned it up thoroughly, |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
59 ;; making it faster, more robust and more tolerant of different |
14040 | 60 ;; systems' man idiosyncrasies. |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
61 |
3235 | 62 ;; ========== Features ========== |
63 ;; + Runs "man" in the background and pipes the results through a | |
64 ;; series of sed and awk scripts so that all retrieving and cleaning | |
78510
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
65 ;; is done in the background. The cleaning commands are configurable. |
3235 | 66 ;; + Syntax is the same as Un*x man |
67 ;; + Functionality is the same as Un*x man, including "man -k" and | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
68 ;; "man <section>", etc. |
3235 | 69 ;; + Provides a manual browsing mode with keybindings for traversing |
70 ;; the sections of a manpage, following references in the SEE ALSO | |
71 ;; section, and more. | |
72 ;; + Multiple manpages created with the same man command are put into | |
73 ;; a narrowed buffer circular list. | |
74 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
75 ;; ============= TODO =========== |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
76 ;; - Add a command for printing. |
96376
c3309dba6542
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
77 ;; - The awk script deletes multiple blank lines. This behavior does |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
78 ;; not allow to understand if there was indeed a blank line at the |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
79 ;; end or beginning of a page (after the header, or before the |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
80 ;; footer). A different algorithm should be used. It is easy to |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
81 ;; compute how many blank lines there are before and after the page |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
82 ;; headers, and after the page footer. But it is possible to compute |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
83 ;; 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
|
84 ;; only. Is it worth doing? |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
85 ;; - Allow a user option to mean that all the manpages should go in |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
86 ;; the same buffer, where they can be browsed with M-n and M-p. |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
87 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
88 |
3235 | 89 ;;; Code: |
90 | |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
91 (eval-when-compile (require 'cl)) |
3235 | 92 (require 'assoc) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
93 (require 'button) |
3235 | 94 |
95 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
96 ;; 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
|
97 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
98 (defgroup man nil |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
99 "Browse UNIX manual pages." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
100 :prefix "Man-" |
107167
f6b8c73548b3
Minor tweaks to custom groups.
Chong Yidong <cyd@stupidchicken.com>
parents:
107144
diff
changeset
|
101 :group 'external |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
102 :group 'help) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
103 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
104 (defvar Man-notify) |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
105 (defcustom Man-filter-list nil |
100171 | 106 "Manpage cleaning filter command phrases. |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
107 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
|
108 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
109 '((command-string phrase-string*)*) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
110 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
111 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
|
112 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
|
113 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
|
114 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
|
115 the manpage buffer." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
116 :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
|
117 (repeat :inline t |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
118 (string :tag "Phrase String")))) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
119 :group 'man) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
120 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
121 (defvar Man-uses-untabify-flag t |
28102 | 122 "Non-nil means use `untabify' instead of `Man-untabify-command'.") |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
123 (defvar Man-sed-script nil |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
124 "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
|
125 |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
126 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
3235 | 127 ;; user variables |
128 | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
129 (defcustom Man-fontify-manpage-flag t |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
130 "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
|
131 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
132 :group 'man) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
133 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
134 (defcustom Man-overstrike-face 'bold |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
135 "Face to use when fontifying overstrike." |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
136 :type 'face |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
137 :group 'man) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
138 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
139 (defcustom Man-underline-face 'underline |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
140 "Face to use when fontifying underlining." |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
141 :type 'face |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
142 :group 'man) |
6676
7251020c1c79
(manual-program): New (actually reintroduced) variable.
Karl Heuer <kwzh@gnu.org>
parents:
6613
diff
changeset
|
143 |
58742
03ba600130f8
(Man-reverse-face): Change default to `highlight'.
Richard M. Stallman <rms@gnu.org>
parents:
58690
diff
changeset
|
144 (defcustom Man-reverse-face 'highlight |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
145 "Face to use when fontifying reverse video." |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
146 :type 'face |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
147 :group 'man) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
148 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
149 ;; 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
|
150 (defcustom Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
151 "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
|
152 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
|
153 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
|
154 where the man command was called from: |
3235 | 155 |
4915
c0523a78e6a5
(Man-frame-parameters): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4444
diff
changeset
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 polite -- don't display manpage, but prints message and beep when ready |
3235 | 162 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
|
163 meek -- make no indication that the manpage is ready |
3235 | 164 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
165 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
|
166 :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
|
167 (const aggressive) (const friendly) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
168 (const polite) (const quiet) (const meek)) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
169 :group 'man) |
3235 | 170 |
54515 | 171 (defcustom Man-width nil |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
172 "Number of columns for which manual pages should be formatted. |
54515 | 173 If nil, the width of the window selected at the moment of man |
174 invocation is used. If non-nil, the width of the frame selected | |
175 at the moment of man invocation is used. The value also can be a | |
176 positive integer." | |
177 :type '(choice (const :tag "Window width" nil) | |
178 (const :tag "Frame width" t) | |
179 (integer :tag "Specific width" :value 65)) | |
180 :group 'man) | |
181 | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
182 (defcustom Man-frame-parameters nil |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
183 "Frame parameter list for creating a new frame for a manual page." |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
184 :type 'sexp |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
185 :group 'man) |
4915
c0523a78e6a5
(Man-frame-parameters): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4444
diff
changeset
|
186 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
187 (defcustom Man-downcase-section-letters-flag t |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
188 "Non-nil means letters in sections are converted to lower case. |
3235 | 189 Some Un*x man commands can't handle uppercase letters in sections, for |
190 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
|
191 with the upper case letter. When this variable is t, the section |
3235 | 192 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
|
193 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
|
194 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
195 :group 'man) |
3235 | 196 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
197 (defcustom Man-circular-pages-flag t |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
198 "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
|
199 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
200 :group 'man) |
3235 | 201 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
202 (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
|
203 (list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
204 '("3C++" . "3") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
205 ;; 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
|
206 ;; '("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
|
207 '("3X11" . "3") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
208 '("1-UCB" . "")) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
209 "Association list of bogus sections to real section numbers. |
3235 | 210 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
|
211 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
|
212 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
|
213 the associated section number." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
214 :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
|
215 (string :tag "Real Section"))) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
216 :group 'man) |
3235 | 217 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
218 (defcustom Man-header-file-path |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
219 '("/usr/include" "/usr/local/include") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
220 "C Header file search path used in Man." |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
221 :type '(repeat string) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
222 :group 'man) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
223 |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
224 (defcustom Man-name-local-regexp (concat "^" (regexp-opt '("NOM" "NAME")) "$") |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
225 "Regexp that matches the text that precedes the command's name. |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
226 Used in `bookmark-set' to get the default bookmark name." |
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
227 :type 'string :group 'bookmark) |
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
228 |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
229 (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
|
230 "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
|
231 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
232 (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
|
233 "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
|
234 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
235 (defvar Man-untabify-command-args (list "-t" "-e") |
28102 | 236 "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
|
237 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
238 (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
|
239 "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
|
240 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
241 (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
|
242 "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
|
243 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
244 (defvar Man-mode-hook nil |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
245 "Hook run when Man mode is enabled.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
246 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
247 (defvar Man-cooked-hook nil |
28102 | 248 "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
|
249 |
62878
6ad2cd812985
(Man-name-regexp): Add `:' to accept qualified names.
Juri Linkov <juri@jurta.org>
parents:
62736
diff
changeset
|
250 (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
|
251 "Regular expression describing the name of a manpage (without section).") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
252 |
67300
d939be43ae67
(Man-section-regexp): Add 0-9 to support "3X11" sections.
Juri Linkov <juri@jurta.org>
parents:
67006
diff
changeset
|
253 (defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
254 "Regular expression describing a manpage section within parentheses.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
255 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
256 (defvar Man-page-header-regexp |
23644
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
257 (if (and (string-match "-solaris2\\." system-configuration) |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
258 (not (string-match "-solaris2\\.[123435]$" system-configuration))) |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
259 (concat "^[-A-Za-z0-9_].*[ \t]\\(" Man-name-regexp |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
260 "(\\(" Man-section-regexp "\\))\\)$") |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
261 (concat "^[ \t]*\\(" Man-name-regexp |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
262 "(\\(" Man-section-regexp "\\))\\).*\\1")) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
263 "Regular expression describing the heading of a page.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
264 |
79430
456d7f1aaa98
(Man-heading-regexp): Add 0-9.
Juri Linkov <juri@jurta.org>
parents:
78771
diff
changeset
|
265 (defvar Man-heading-regexp "^\\([A-Z][A-Z0-9 /-]+\\)$" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
266 "Regular expression describing a manpage heading entry.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
267 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
268 (defvar Man-see-also-regexp "SEE ALSO" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
269 "Regular expression for SEE ALSO heading (or your equivalent). |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
270 This regexp should not start with a `^' character.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
271 |
79430
456d7f1aaa98
(Man-heading-regexp): Add 0-9.
Juri Linkov <juri@jurta.org>
parents:
78771
diff
changeset
|
272 ;; This used to have leading space [ \t]*, but was removed because it |
456d7f1aaa98
(Man-heading-regexp): Add 0-9.
Juri Linkov <juri@jurta.org>
parents:
78771
diff
changeset
|
273 ;; causes false page splits on an occasional NAME with leading space |
456d7f1aaa98
(Man-heading-regexp): Add 0-9.
Juri Linkov <juri@jurta.org>
parents:
78771
diff
changeset
|
274 ;; inside a manpage. And `Man-heading-regexp' doesn't have [ \t]* anyway. |
456d7f1aaa98
(Man-heading-regexp): Add 0-9.
Juri Linkov <juri@jurta.org>
parents:
78771
diff
changeset
|
275 (defvar Man-first-heading-regexp "^NAME$\\|^[ \t]*No manual entry fo.*$" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
276 "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
|
277 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
|
278 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
279 (defvar Man-reference-regexp |
66729 | 280 (concat "\\(" Man-name-regexp "\\)[ \t]*(\\(" Man-section-regexp "\\))") |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
281 "Regular expression describing a reference to another manpage.") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
282 |
66729 | 283 (defvar Man-apropos-regexp |
284 (concat "\\\[\\(" Man-name-regexp "\\)\\\][ \t]*(\\(" Man-section-regexp "\\))") | |
285 "Regular expression describing a reference to manpages in \"man -k output\".") | |
286 | |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
287 (defvar Man-synopsis-regexp "SYNOPSIS" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
288 "Regular expression for SYNOPSIS heading (or your equivalent). |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
289 This regexp should not start with a `^' character.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
290 |
107337
df618c2d11bb
(Man-files-regexp): Tighten up the regexp (bug#5686).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107167
diff
changeset
|
291 (defvar Man-files-regexp "FILES\\>" |
df618c2d11bb
(Man-files-regexp): Tighten up the regexp (bug#5686).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107167
diff
changeset
|
292 ;; Add \> so as not to match mount(8)'s FILESYSTEM INDEPENDENT MOUNT OPTIONS. |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
293 "Regular expression for FILES heading (or your equivalent). |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
294 This regexp should not start with a `^' character.") |
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-include-regexp "#[ \t]*include[ \t]*" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
297 "Regular expression describing the #include (directive of cpp).") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
298 |
68151
8d679b71e742
(Man-file-name-regexp): Adjust for a list of files.
Nick Roberts <nickrob@snap.net.nz>
parents:
67300
diff
changeset
|
299 (defvar Man-file-name-regexp "[^<>\", \t\n]+" |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
300 "Regular expression describing <> in #include line (directive of cpp).") |
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-normal-file-prefix-regexp "[/~$]" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
303 "Regular expression describing a file path appeared in FILES section.") |
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 (defvar Man-header-regexp |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
306 (concat "\\(" Man-include-regexp "\\)" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
307 "[<\"]" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
308 "\\(" Man-file-name-regexp "\\)" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
309 "[>\"]") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
310 "Regular expression describing references to header files.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
311 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
312 (defvar Man-normal-file-regexp |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
313 (concat Man-normal-file-prefix-regexp Man-file-name-regexp) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
314 "Regular expression describing references to normal files.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
315 |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
316 ;; 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
|
317 ;; refernces to manpages. |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
318 (defvar Man-hyphenated-reference-regexp |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
319 (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
|
320 "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
|
321 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
322 (defvar Man-switches "" |
38646
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
323 "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
|
324 |
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
325 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
|
326 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
|
327 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
328 (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
|
329 (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
|
330 "-s" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
331 "") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
332 "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
|
333 |
54515 | 334 (defvar Man-support-local-filenames 'auto-detect |
335 "Internal cache for the value of the function `Man-support-local-filenames'. | |
336 `auto-detect' means the value is not yet determined. | |
337 Otherwise, the value is whatever the function | |
338 `Man-support-local-filenames' should return.") | |
339 | |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
340 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
341 ;; end user variables |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
342 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
343 ;; other variables and keymap initializations |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
344 (defvar Man-original-frame) |
9726
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-original-frame) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
346 (defvar Man-arguments) |
9726
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) |
64620
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
348 (put 'Man-arguments 'permanent-local t) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
349 |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
350 (defvar Man-sections-alist nil) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
351 (make-variable-buffer-local 'Man-sections-alist) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
352 (defvar Man-refpages-alist nil) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
353 (make-variable-buffer-local 'Man-refpages-alist) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
354 (defvar Man-page-list nil) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
355 (make-variable-buffer-local 'Man-page-list) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
356 (defvar Man-current-page 0) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
357 (make-variable-buffer-local 'Man-current-page) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
358 (defvar Man-page-mode-string "1 of 1") |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
359 (make-variable-buffer-local 'Man-page-mode-string) |
3235 | 360 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
361 (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
|
362 /\b/ { s/_\b//g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
363 s/\b_//g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
364 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
|
365 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
|
366 :ovstrk |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
367 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
|
368 t ovstrk |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
369 } |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
370 /\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
|
371 "Script for sysV-like sed to nuke backspaces and ANSI codes from manpages.") |
3235 | 372 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
373 (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
|
374 /\b/ { s/_\b//g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
375 s/\b_//g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
376 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
|
377 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
|
378 :ovstrk\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
379 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
|
380 t ovstrk\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
381 }\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
382 /\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
|
383 "Script for berkeley-like sed to nuke backspaces and ANSI codes from manpages.") |
3235 | 384 |
72619
5dd4533a9a7e
(Man-topic-history): New variable.
Juri Linkov <juri@jurta.org>
parents:
69793
diff
changeset
|
385 (defvar Man-topic-history nil "Topic read history.") |
5dd4533a9a7e
(Man-topic-history): New variable.
Juri Linkov <juri@jurta.org>
parents:
69793
diff
changeset
|
386 |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
387 (defvar man-mode-syntax-table |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
388 (let ((table (copy-syntax-table (standard-syntax-table)))) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
389 (modify-syntax-entry ?. "w" table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
390 (modify-syntax-entry ?_ "w" table) |
61889
031ee12ed124
(man-mode-syntax-table): Set up `:' to have word-constituent syntax.
Eli Zaretskii <eliz@gnu.org>
parents:
60747
diff
changeset
|
391 (modify-syntax-entry ?: "w" table) ; for PDL::Primitive in Perl man pages |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
392 table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
393 "Syntax table used in Man mode buffers.") |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
394 |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
395 (defvar Man-mode-map |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
396 (let ((map (make-sparse-keymap))) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
397 (suppress-keymap map) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
398 (set-keymap-parent map button-buffer-map) |
63336
423fcdb144f5
(Man-mode-map): Initialize it properly.
Lute Kamstra <lute@gnu.org>
parents:
62878
diff
changeset
|
399 |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
400 (define-key map " " 'scroll-up) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
401 (define-key map "\177" 'scroll-down) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
402 (define-key map "n" 'Man-next-section) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
403 (define-key map "p" 'Man-previous-section) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
404 (define-key map "\en" 'Man-next-manpage) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
405 (define-key map "\ep" 'Man-previous-manpage) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
406 (define-key map ">" 'end-of-buffer) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
407 (define-key map "<" 'beginning-of-buffer) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
408 (define-key map "." 'beginning-of-buffer) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
409 (define-key map "r" 'Man-follow-manual-reference) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
410 (define-key map "g" 'Man-goto-section) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
411 (define-key map "s" 'Man-goto-see-also-section) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
412 (define-key map "k" 'Man-kill) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
413 (define-key map "q" 'Man-quit) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
414 (define-key map "m" 'man) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
415 ;; Not all the man references get buttons currently. The text in the |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
416 ;; manual page can contain references to other man pages |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
417 (define-key map "\r" 'man-follow) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
418 (define-key map "?" 'describe-mode) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
419 map) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
420 "Keymap for Man mode.") |
3235 | 421 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
422 ;; buttons |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
423 (define-button-type 'Man-abstract-xref-man-page |
59398
c47c12607f08
(Man-xref-man-page, Man-xref-header-file)
Kim F. Storm <storm@cua.dk>
parents:
59362
diff
changeset
|
424 'follow-link t |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
425 'help-echo "mouse-2, RET: display this man page" |
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
426 'func nil |
74532
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
427 'action #'Man-xref-button-action) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
428 |
100171 | 429 (defun Man-xref-button-action (button) |
74532
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
430 (let ((target (button-get button 'Man-target-string))) |
100171 | 431 (funcall |
74532
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
432 (button-get button 'func) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
433 (cond ((null target) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
434 (button-label button)) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
435 ((functionp target) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
436 (funcall target (button-start button))) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
437 (t target))))) |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
438 |
100171 | 439 (define-button-type 'Man-xref-man-page |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
440 :supertype 'Man-abstract-xref-man-page |
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
441 'func 'man-follow) |
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
442 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
443 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
444 (define-button-type 'Man-xref-header-file |
50418
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
445 'action (lambda (button) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
446 (let ((w (button-get button 'Man-target-string))) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
447 (unless (Man-view-header-file w) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
448 (error "Cannot find header file: %s" w)))) |
59398
c47c12607f08
(Man-xref-man-page, Man-xref-header-file)
Kim F. Storm <storm@cua.dk>
parents:
59362
diff
changeset
|
449 'follow-link t |
50418
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
450 'help-echo "mouse-2: display this header file") |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
451 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
452 (define-button-type 'Man-xref-normal-file |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
453 'action (lambda (button) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
454 (let ((f (substitute-in-file-name |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
455 (button-get button 'Man-target-string)))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
456 (if (file-exists-p f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
457 (if (file-readable-p f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
458 (view-file f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
459 (error "Cannot read a file: %s" f)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
460 (error "Cannot find a file: %s" f)))) |
59398
c47c12607f08
(Man-xref-man-page, Man-xref-header-file)
Kim F. Storm <storm@cua.dk>
parents:
59362
diff
changeset
|
461 'follow-link t |
57817 | 462 'help-echo "mouse-2: display this file") |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
463 |
3235 | 464 |
465 ;; ====================================================================== | |
466 ;; utilities | |
467 | |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
468 (defun Man-init-defvars () |
65197
df6f7e582a6e
(Man-init-defvars, Man-translate-references, Man-support-local-filenames,
Juanma Barranquero <lekktu@gmail.com>
parents:
64762
diff
changeset
|
469 "Used for initializing variables based on display's color support. |
28102 | 470 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
|
471 |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
472 ;; 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
|
473 (let ((default-directory "/")) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
474 (setq Man-sed-script |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
475 (cond |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
476 (Man-fontify-manpage-flag |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
477 nil) |
53477
79093b308520
* progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents:
52636
diff
changeset
|
478 ((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
|
479 Man-sysv-sed-script) |
53477
79093b308520
* progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents:
52636
diff
changeset
|
480 ((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
|
481 Man-berkeley-sed-script) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
482 (t |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
483 nil)))) |
3235 | 484 |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
485 (setq Man-filter-list |
23267
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
486 ;; Avoid trailing nil which confuses customize. |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
487 (apply 'list |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
488 (cons |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
489 Man-sed-command |
102437
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
490 (if (eq system-type 'windows-nt) |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
491 ;; Windows needs ".." quoting, not '..'. |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
492 (list |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
493 "-e \"/Reformatting page. Wait/d\"" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
494 "-e \"/Reformatting entry. Wait/d\"" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
495 "-e \"/^[ \t][ \t]*-[ \t][0-9]*[ \t]-[ \t]*Formatted:.*[0-9]$/d\"" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
496 "-e \"/^[ \t]*Page[ \t][0-9]*.*(printed[ \t][0-9\\/]*)$/d\"" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
497 "-e \"/^Printed[ \t][0-9].*[0-9]$/d\"" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
498 "-e \"/^[ \t]*X[ \t]Version[ \t]1[01].*Release[ \t][0-9]/d\"" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
499 "-e \"/^[A-Za-z].*Last[ \t]change:/d\"" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
500 "-e \"/[ \t]*Copyright [0-9]* UNIX System Laboratories, Inc.$/d\"" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
501 "-e \"/^[ \t]*Rev\\..*Page [0-9][0-9]*$/d\"") |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
502 (list |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
503 (if Man-sed-script |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
504 (concat "-e '" Man-sed-script "'") |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
505 "") |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
506 "-e '/^[\001-\032][\001-\032]*$/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
507 "-e '/\e[789]/s///g'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
508 "-e '/Reformatting page. Wait/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
509 "-e '/Reformatting entry. Wait/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
510 "-e '/^[ \t]*Hewlett-Packard[ \t]Company[ \t]*-[ \t][0-9]*[ \t]-/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
511 "-e '/^[ \t]*Hewlett-Packard[ \t]*-[ \t][0-9]*[ \t]-.*$/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
512 "-e '/^[ \t][ \t]*-[ \t][0-9]*[ \t]-[ \t]*Formatted:.*[0-9]$/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
513 "-e '/^[ \t]*Page[ \t][0-9]*.*(printed[ \t][0-9\\/]*)$/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
514 "-e '/^Printed[ \t][0-9].*[0-9]$/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
515 "-e '/^[ \t]*X[ \t]Version[ \t]1[01].*Release[ \t][0-9]/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
516 "-e '/^[A-Za-z].*Last[ \t]change:/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
517 "-e '/^Sun[ \t]Release[ \t][0-9].*[0-9]$/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
518 "-e '/[ \t]*Copyright [0-9]* UNIX System Laboratories, Inc.$/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
519 "-e '/^[ \t]*Rev\\..*Page [0-9][0-9]*$/d'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
520 ))) |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
521 ;; Windows doesn't support multi-line commands, so don't |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
522 ;; invoke Awk there. |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
523 (unless (eq system-type 'windows-nt) |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
524 (cons |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
525 Man-awk-command |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
526 (list |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
527 "'\n" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
528 "BEGIN { blankline=0; anonblank=0; }\n" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
529 "/^$/ { if (anonblank==0) next; }\n" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
530 "{ anonblank=1; }\n" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
531 "/^$/ { blankline++; next; }\n" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
532 "{ if (blankline>0) { print \"\"; blankline=0; } print $0; }\n" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
533 "'" |
3c25891e2a47
(Man-init-defvars) [windows-nt]: Use a special command list. Don't invoke Awk.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
534 ))) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
535 (if (not Man-uses-untabify-flag) |
23267
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
536 ;; 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
|
537 (list (cons |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
538 Man-untabify-command |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
539 Man-untabify-command-args)) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
540 ))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
541 ) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
542 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
543 (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
|
544 "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
|
545 (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
|
546 (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
|
547 "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
548 Man-current-page |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
549 (length Man-page-list))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
550 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
551 (defsubst Man-build-man-command () |
3235 | 552 "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
|
553 (let ((command (concat manual-program " " Man-switches |
54515 | 554 (cond |
555 ;; Already has %s | |
556 ((string-match "%s" manual-program) "") | |
557 ;; Stock MS-DOS shells cannot redirect stderr; | |
558 ;; `call-process' below sends it to /dev/null, | |
559 ;; so we don't need `2>' even with DOS shells | |
560 ;; which do support stderr redirection. | |
561 ((not (fboundp 'start-process)) " %s") | |
562 ((concat " %s 2>" null-device))))) | |
3235 | 563 (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
|
564 (while (and flist (car flist)) |
3235 | 565 (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
|
566 (pargs (cdr (car flist)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
567 (setq command |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
568 (concat command " | " pcom " " |
29585
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
569 (mapconcat (lambda (phrase) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
570 (if (not (stringp phrase)) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
571 (error "Malformed Man-filter-list")) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
572 phrase) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
573 pargs " "))) |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
574 (setq flist (cdr flist)))) |
3235 | 575 command)) |
576 | |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
577 |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
578 (defun Man-translate-cleanup (string) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
579 "Strip leading, trailing and middle spaces." |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
580 (when (stringp string) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
581 ;; Strip leading and trailing |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
582 (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
|
583 (setq string (match-string 1 string))) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
584 ;; middle spaces |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
585 (setq string (replace-regexp-in-string "[\t\r\n]" " " string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
586 (setq string (replace-regexp-in-string " +" " " string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
587 string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
588 |
3235 | 589 (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
|
590 "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
|
591 Leave it as is if already in that style. Possibly downcase and |
65197
df6f7e582a6e
(Man-init-defvars, Man-translate-references, Man-support-local-filenames,
Juanma Barranquero <lekktu@gmail.com>
parents:
64762
diff
changeset
|
592 translate the section (see the `Man-downcase-section-letters-flag' |
df6f7e582a6e
(Man-init-defvars, Man-translate-references, Man-support-local-filenames,
Juanma Barranquero <lekktu@gmail.com>
parents:
64762
diff
changeset
|
593 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
|
594 (let ((name "") |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
595 (section "") |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
596 (slist Man-section-translations-alist)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
597 (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
|
598 (cond |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
599 ;; "chmod(2V)" case ? |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
600 ((string-match (concat "^" Man-reference-regexp "$") ref) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
601 (setq name (match-string 1 ref) |
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
602 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
|
603 ;; "2v chmod" case ? |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
604 ((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
|
605 "\\) +\\(" Man-name-regexp "\\)$") ref) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
606 (setq name (match-string 2 ref) |
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
607 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
|
608 (if (string= name "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
609 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
|
610 (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
|
611 (setq section (downcase section))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
612 (while slist |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
613 (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
|
614 (s2 (cdr (car slist)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
615 (setq slist (cdr slist)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
616 (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
|
617 (setq s1 (downcase s1))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
618 (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
|
619 (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
|
620 (downcase s2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
621 s2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
622 slist nil)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
623 (concat Man-specified-section-option section " " name)))) |
3235 | 624 |
54515 | 625 (defun Man-support-local-filenames () |
626 "Check the availability of `-l' option of the man command. | |
627 This option allows `man' to interpret command line arguments | |
628 as local filenames. | |
629 Return the value of the variable `Man-support-local-filenames' | |
630 if it was set to nil or t before the call of this function. | |
65197
df6f7e582a6e
(Man-init-defvars, Man-translate-references, Man-support-local-filenames,
Juanma Barranquero <lekktu@gmail.com>
parents:
64762
diff
changeset
|
631 If t, the man command supports `-l' option. If nil, it doesn't. |
54515 | 632 Otherwise, if the value of `Man-support-local-filenames' |
633 is neither t nor nil, then determine a new value, set it | |
634 to the variable `Man-support-local-filenames' and return | |
635 a new value." | |
636 (if (or (not Man-support-local-filenames) | |
637 (eq Man-support-local-filenames t)) | |
638 Man-support-local-filenames | |
639 (setq Man-support-local-filenames | |
640 (with-temp-buffer | |
641 (and (equal (condition-case nil | |
76691
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
642 (let ((default-directory |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
643 ;; Assure that `default-directory' exists |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
644 ;; and is readable. |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
645 (if (and (file-directory-p default-directory) |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
646 (file-readable-p default-directory)) |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
647 default-directory |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
648 (expand-file-name "~/")))) |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
649 (call-process manual-program nil t nil "--help")) |
54515 | 650 (error nil)) |
651 0) | |
652 (progn | |
653 (goto-char (point-min)) | |
654 (search-forward "--local-file" nil t)) | |
655 t))))) | |
656 | |
3235 | 657 |
658 ;; ====================================================================== | |
87504
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
659 ;; default man entry: get word near point |
3235 | 660 |
87504
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
661 (defun Man-default-man-entry (&optional pos) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
662 "Guess default manual entry based on the text near position POS. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
663 POS defaults to `point'." |
106282
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
664 (let (word start column distance) |
3235 | 665 (save-excursion |
87504
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
666 (when pos (goto-char pos)) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
667 (setq pos (point)) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
668 ;; The default title is the nearest entry-like object before or |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
669 ;; after POS. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
670 (if (and (skip-chars-backward " \ta-zA-Z0-9+") |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
671 (not (zerop (skip-chars-backward "("))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
672 ;; Try to handle the special case where POS is on a |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
673 ;; section number. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
674 (looking-at |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
675 (concat "([ \t]*\\(" Man-section-regexp "\\)[ \t]*)")) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
676 ;; We skipped a valid section number backwards, look at |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
677 ;; preceding text. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
678 (or (and (skip-chars-backward ",; \t") |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
679 (not (zerop (skip-chars-backward "-a-zA-Z0-9._+:")))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
680 ;; Not a valid entry, move POS after closing paren. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
681 (not (setq pos (match-end 0))))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
682 ;; We have a candidate, make `start' record its starting |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
683 ;; position. |
87335
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
684 (setq start (point)) |
87504
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
685 ;; Otherwise look at char before POS. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
686 (goto-char pos) |
87335
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
687 (if (not (zerop (skip-chars-backward "-a-zA-Z0-9._+:"))) |
87504
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
688 ;; Our candidate is just before or around POS. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
689 (setq start (point)) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
690 ;; Otherwise record the current column and look backwards. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
691 (setq column (current-column)) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
692 (skip-chars-backward ",; \t") |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
693 ;; Record the distance travelled. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
694 (setq distance (- column (current-column))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
695 (when (looking-back |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
696 (concat "([ \t]*\\(?:" Man-section-regexp "\\)[ \t]*)")) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
697 ;; Skip section number backwards. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
698 (goto-char (match-beginning 0)) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
699 (skip-chars-backward " \t")) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
700 (if (not (zerop (skip-chars-backward "-a-zA-Z0-9._+:"))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
701 (progn |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
702 ;; We have a candidate before POS ... |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
703 (setq start (point)) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
704 (goto-char pos) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
705 (if (and (skip-chars-forward ",; \t") |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
706 (< (- (current-column) column) distance) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
707 (looking-at "[-a-zA-Z0-9._+:]")) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
708 ;; ... but the one after POS is better. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
709 (setq start (point)) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
710 ;; ... and anything after POS is worse. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
711 (goto-char start))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
712 ;; No candidate before POS. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
713 (goto-char pos) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
714 (skip-chars-forward ",; \t") |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
715 (setq start (point))))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
716 ;; We have found a suitable starting point, try to skip at least |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
717 ;; one character. |
87335
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
718 (skip-chars-forward "-a-zA-Z0-9._+:") |
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
719 (setq word (buffer-substring-no-properties start (point))) |
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
720 ;; If there is a continuation at the end of line, check the |
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
721 ;; following line too, eg: |
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
722 ;; see this- |
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
723 ;; command-here(1) |
87504
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
724 ;; Note: This code gets executed iff our entry is after POS. |
87335
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
725 (when (looking-at "[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)([0-9])") |
87504
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
726 (setq word (concat word (match-string-no-properties 1))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
727 ;; Make sure the section number gets included by the code below. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
728 (goto-char (match-end 1))) |
87335
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
729 (when (string-match "[._]+$" word) |
8ca08c950560
(Man-default-man-entry): When looking for default man
Martin Rudalics <rudalics@gmx.at>
parents:
87139
diff
changeset
|
730 (setq word (substring word 0 (match-beginning 0)))) |
87504
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
731 ;; The following was commented out since the preceding code |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
732 ;; should not produce a leading "*" in the first place. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
733 ;;; ;; If looking at something like *strcat(... , remove the '*' |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
734 ;;; (when (string-match "^*" word) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
735 ;;; (setq word (substring word 1))) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
736 (concat |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
737 word |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
738 (and (not (string-equal word "")) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
739 ;; If looking at something like ioctl(2) or brc(1M), |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
740 ;; include the section number in the returned value. |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
741 (looking-at |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
742 (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)")) |
14d4ce301149
(Man-default-man-entry): Make this a defun. Improve
Martin Rudalics <rudalics@gmx.at>
parents:
87372
diff
changeset
|
743 (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
|
744 |
3235 | 745 |
746 ;; ====================================================================== | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
747 ;; Top level command and background process sentinel |
3235 | 748 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
749 ;; For compatibility with older versions. |
4444 | 750 ;;;###autoload |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
751 (defalias 'manual-entry 'man) |
4444 | 752 |
106231
7b0de5c2aa2a
(Man-completion-cache): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106221
diff
changeset
|
753 (defvar Man-completion-cache nil |
7b0de5c2aa2a
(Man-completion-cache): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106221
diff
changeset
|
754 ;; On my machine, "man -k" is so fast that a cache makes no sense, |
7b0de5c2aa2a
(Man-completion-cache): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106221
diff
changeset
|
755 ;; but apparently that's not the case in all cases, so let's add a cache. |
7b0de5c2aa2a
(Man-completion-cache): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106221
diff
changeset
|
756 "Cache of completion table of the form (PREFIX . TABLE).") |
7b0de5c2aa2a
(Man-completion-cache): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106221
diff
changeset
|
757 |
106221
6c0524d168f6
(Man-completion-table): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104823
diff
changeset
|
758 (defun Man-completion-table (string pred action) |
6c0524d168f6
(Man-completion-table): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104823
diff
changeset
|
759 (cond |
106282
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
760 ((eq action 'lambda) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
761 (not (string-match "([^)]*\\'" string))) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
762 (t |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
763 (let ((table (cdr Man-completion-cache)) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
764 (section nil) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
765 (prefix string)) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
766 (when (string-match "\\`\\([[:digit:]].*?\\) " string) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
767 (setq section (match-string 1 string)) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
768 (setq prefix (substring string (match-end 0)))) |
106231
7b0de5c2aa2a
(Man-completion-cache): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106221
diff
changeset
|
769 (unless (and Man-completion-cache |
106282
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
770 (string-prefix-p (car Man-completion-cache) prefix)) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
771 (with-temp-buffer |
106648
bef8989591e3
Tweak a comment: it's man-db on gnu/linux which agrees with posix that
Kevin Ryde <user42@zip.com.au>
parents:
106646
diff
changeset
|
772 (setq default-directory "/") ;; in case inherited doesn't exist |
bef8989591e3
Tweak a comment: it's man-db on gnu/linux which agrees with posix that
Kevin Ryde <user42@zip.com.au>
parents:
106646
diff
changeset
|
773 ;; Actually for my `man' the arg is a regexp. |
bef8989591e3
Tweak a comment: it's man-db on gnu/linux which agrees with posix that
Kevin Ryde <user42@zip.com.au>
parents:
106646
diff
changeset
|
774 ;; POSIX says it must be ERE and "man-db" seems to agree, |
106282
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
775 ;; whereas under MacOSX it seems to be BRE-style and doesn't |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
776 ;; accept backslashes at all. Let's not bother to |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
777 ;; quote anything. |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
778 (let ((process-environment (copy-sequence process-environment))) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
779 (setenv "COLUMNS" "999") ;; don't truncate long names |
107131
741ff2bdfe79
(Man-completion-table): Don't signal an error if we can't run
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
780 ;; manual-program might not even exist. And since it's |
741ff2bdfe79
(Man-completion-table): Don't signal an error if we can't run
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
781 ;; run differently in Man-getpage-in-background, an error |
741ff2bdfe79
(Man-completion-table): Don't signal an error if we can't run
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
782 ;; here may not necessarily mean that we'll also get an |
741ff2bdfe79
(Man-completion-table): Don't signal an error if we can't run
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
783 ;; error later. |
741ff2bdfe79
(Man-completion-table): Don't signal an error if we can't run
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
784 (ignore-errors |
741ff2bdfe79
(Man-completion-table): Don't signal an error if we can't run
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
785 (call-process manual-program nil '(t nil) nil |
741ff2bdfe79
(Man-completion-table): Don't signal an error if we can't run
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
786 "-k" (concat "^" prefix)))) |
106282
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
787 (goto-char (point-min)) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
788 (while (re-search-forward "^\\([^ \t\n]+\\)\\(?: ?\\((.+?)\\)\\(?:[ \t]+- \\(.*\\)\\)?\\)?" nil t) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
789 (push (propertize (concat (match-string 1) (match-string 2)) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
790 'help-echo (match-string 3)) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
791 table))) |
106231
7b0de5c2aa2a
(Man-completion-cache): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106221
diff
changeset
|
792 ;; Cache the table for later reuse. |
106282
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
793 (setq Man-completion-cache (cons prefix table))) |
106221
6c0524d168f6
(Man-completion-table): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104823
diff
changeset
|
794 ;; The table may contain false positives since the match is made |
6c0524d168f6
(Man-completion-table): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104823
diff
changeset
|
795 ;; by "man -k" not just on the manpage's name. |
106282
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
796 (if section |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
797 (let ((re (concat "(" (regexp-quote section) ")\\'"))) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
798 (dolist (comp (prog1 table (setq table nil))) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
799 (if (string-match re comp) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
800 (push (substring comp 0 (match-beginning 0)) table))) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
801 (completion-table-with-context (concat section " ") table |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
802 prefix pred action)) |
106301
8ba9aa88e9c7
(Man-completion-table): Make it easier to enter "<sec> <name>".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106282
diff
changeset
|
803 ;; If the current text looks like a possible section name, |
8ba9aa88e9c7
(Man-completion-table): Make it easier to enter "<sec> <name>".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106282
diff
changeset
|
804 ;; then add a completion entry that just adds a space so SPC |
8ba9aa88e9c7
(Man-completion-table): Make it easier to enter "<sec> <name>".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106282
diff
changeset
|
805 ;; can be used to insert a space. |
8ba9aa88e9c7
(Man-completion-table): Make it easier to enter "<sec> <name>".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106282
diff
changeset
|
806 (if (string-match "\\`[[:digit:]]" string) |
8ba9aa88e9c7
(Man-completion-table): Make it easier to enter "<sec> <name>".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106282
diff
changeset
|
807 (push (concat string " ") table)) |
106282
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
808 (let ((res (complete-with-action action table string pred))) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
809 ;; In case we're completing to a single name that exists in |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
810 ;; several sections, the longest prefix will look like "foo(". |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
811 (if (and (stringp res) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
812 (string-match "([^(]*\\'" res) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
813 ;; In case the paren was already in `prefix', don't |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
814 ;; remove it. |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
815 (> (match-beginning 0) (length prefix))) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
816 (substring res 0 (match-beginning 0)) |
563a767d38bf
(Man-completion-table): Trim a terminating "(".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106248
diff
changeset
|
817 res))))))) |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
818 |
3235 | 819 ;;;###autoload |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
820 (defun man (man-args) |
3235 | 821 "Get a Un*x manual page and put it in a buffer. |
106646
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
822 This command is the top-level command in the man package. It |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
823 runs a Un*x command to retrieve and clean a manpage in the |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
824 background and places the results in a `Man-mode' browsing |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
825 buffer. See variable `Man-notify-method' for what happens when |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
826 the buffer is ready. If a buffer already exists for this man |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
827 page, it will display immediately. |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
828 |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
829 For a manpage from a particular section, use either of the |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
830 following. \"cat(1)\" is how cross-references appear and is |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
831 passed to man as \"1 cat\". |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
832 |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
833 cat(1) |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
834 1 cat |
29838 | 835 |
106646
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
836 To see manpages from all sections related to a subject, use an |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
837 \"all pages\" option (which might be \"-a\" if it's not the |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
838 default), then step through with `Man-next-manpage' (\\<Man-mode-map>\\[Man-next-manpage]) etc. |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
839 Add to `Man-switches' to make this option permanent. |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
840 |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
841 -a chmod |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
842 |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
843 An explicit filename can be given too. Use -l if it might |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
844 otherwise look like a page name. |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
845 |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
846 /my/file/name.1.gz |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
847 -l somefile.1 |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
848 |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
849 An \"apropos\" query with -k gives a buffer of matching page |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
850 names or descriptions. The pattern argument is usually an |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
851 \"egrep\" style regexp. |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
852 |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
853 -k pattern" |
dfa5f38a6a2a
* man.el (man): Revise docstring a bit to show -a and -l as
Kevin Ryde <user42@zip.com.au>
parents:
106301
diff
changeset
|
854 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
855 (interactive |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
856 (list (let* ((default-entry (Man-default-man-entry)) |
106248
e35ae171fed1
(man): completion-ignore-case t for friendliness and since man
Kevin Ryde <user42@zip.com.au>
parents:
106246
diff
changeset
|
857 ;; ignore case because that's friendly for bizarre |
e35ae171fed1
(man): completion-ignore-case t for friendliness and since man
Kevin Ryde <user42@zip.com.au>
parents:
106246
diff
changeset
|
858 ;; caps things like the X11 function names and because |
e35ae171fed1
(man): completion-ignore-case t for friendliness and since man
Kevin Ryde <user42@zip.com.au>
parents:
106246
diff
changeset
|
859 ;; "man" itself is case-sensitive on the command line |
e35ae171fed1
(man): completion-ignore-case t for friendliness and since man
Kevin Ryde <user42@zip.com.au>
parents:
106246
diff
changeset
|
860 ;; so you're accustomed not to bother about the case |
e35ae171fed1
(man): completion-ignore-case t for friendliness and since man
Kevin Ryde <user42@zip.com.au>
parents:
106246
diff
changeset
|
861 ;; ("man -k" is case-insensitive similarly, so the |
e35ae171fed1
(man): completion-ignore-case t for friendliness and since man
Kevin Ryde <user42@zip.com.au>
parents:
106246
diff
changeset
|
862 ;; table has everything available to complete) |
e35ae171fed1
(man): completion-ignore-case t for friendliness and since man
Kevin Ryde <user42@zip.com.au>
parents:
106246
diff
changeset
|
863 (completion-ignore-case t) |
106221
6c0524d168f6
(Man-completion-table): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104823
diff
changeset
|
864 (input (completing-read |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
865 (format "Manual entry%s" |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
866 (if (string= default-entry "") |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
867 ": " |
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
868 (format " (default %s): " default-entry))) |
106221
6c0524d168f6
(Man-completion-table): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104823
diff
changeset
|
869 'Man-completion-table |
6c0524d168f6
(Man-completion-table): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104823
diff
changeset
|
870 nil nil nil 'Man-topic-history default-entry))) |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
871 (if (string= input "") |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
872 (error "No man args given") |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
873 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
|
874 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
875 ;; 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
|
876 ;; "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
|
877 (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
|
878 |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
879 (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
|
880 |
17129 | 881 ;;;###autoload |
882 (defun man-follow (man-args) | |
883 "Get a Un*x manual page of the item under point and put it in a buffer." | |
884 (interactive (list (Man-default-man-entry))) | |
885 (if (or (not man-args) | |
886 (string= man-args "")) | |
887 (error "No item under point") | |
888 (man man-args))) | |
3235 | 889 |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
890 (defun Man-getpage-in-background (topic) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
891 "Use TOPIC to build and fire off the manpage and cleaning command. |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
892 Return the buffer in which the manpage will appear." |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
893 (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
|
894 (bufname (concat "*Man " man-args "*")) |
3235 | 895 (buffer (get-buffer bufname))) |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
896 (if buffer |
3235 | 897 (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
|
898 (require 'env) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
899 (message "Invoking %s %s in the background" manual-program man-args) |
3235 | 900 (setq buffer (generate-new-buffer bufname)) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
901 (with-current-buffer buffer |
59784
71d8a58f6f27
(Man-getpage-in-background): Disable undo in Man buffer.
Richard M. Stallman <rms@gnu.org>
parents:
59398
diff
changeset
|
902 (setq buffer-undo-list t) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
903 (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
|
904 (setq Man-arguments man-args)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
905 (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
|
906 ;; 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
|
907 ;; 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
|
908 (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
|
909 ;; We must decode the output by a coding system that the |
32495 | 910 ;; 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
|
911 (coding-system-for-read |
104823
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
102437
diff
changeset
|
912 (if (default-value 'enable-multibyte-characters) |
32396
b68d86c19284
(Man-getpage-in-background): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
31005
diff
changeset
|
913 locale-coding-system 'raw-text-unix)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
914 ;; 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
|
915 (default-directory |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
916 (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
|
917 (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
|
918 'file-directory-p))) |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
919 default-directory |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
920 "/"))) |
3713
c77a3da2d08d
(Man-getpage-in-background): Use TERM=dumb to prevent
Richard M. Stallman <rms@gnu.org>
parents:
3659
diff
changeset
|
921 ;; 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
|
922 (setenv "TERM" "dumb") |
47891
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
923 ;; 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
|
924 ;; 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
|
925 ;; a tty. man(1) says: |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
926 ;; MANWIDTH |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
927 ;; 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
|
928 ;; 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
|
929 ;; 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
|
930 ;; 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
|
931 ;; 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
|
932 ;; $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
|
933 ;; ther is available). |
86355
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
934 (unless (or (getenv "MANWIDTH") (getenv "COLUMNS")) |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
935 ;; This isn't strictly correct, since we don't know how |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
936 ;; the page will actually be displayed, but it seems |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
937 ;; reasonable. |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
938 (setenv "COLUMNS" (number-to-string |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
939 (cond |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
940 ((and (integerp Man-width) (> Man-width 0)) |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
941 Man-width) |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
942 (Man-width (frame-width)) |
a5e1b70f3ddf
(Man-getpage-in-background): Don't disregard user option
Juri Linkov <juri@jurta.org>
parents:
86130
diff
changeset
|
943 ((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
|
944 (setenv "GROFF_NO_SGR" "1") |
98772
7b3f18677181
(Man-getpage-in-background): Force recent `man's to output
Glenn Morris <rgm@gnu.org>
parents:
96376
diff
changeset
|
945 ;; Since man-db 2.4.3-1, man writes plain text with no escape |
7b3f18677181
(Man-getpage-in-background): Force recent `man's to output
Glenn Morris <rgm@gnu.org>
parents:
96376
diff
changeset
|
946 ;; sequences when stdout is not a tty. In 2.5.0, the following |
7b3f18677181
(Man-getpage-in-background): Force recent `man's to output
Glenn Morris <rgm@gnu.org>
parents:
96376
diff
changeset
|
947 ;; env-var was added to allow control of this (see Debian Bug#340673). |
7b3f18677181
(Man-getpage-in-background): Force recent `man's to output
Glenn Morris <rgm@gnu.org>
parents:
96376
diff
changeset
|
948 (setenv "MAN_KEEP_FORMATTING" "1") |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
949 (if (fboundp 'start-process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
950 (set-process-sentinel |
55527
4729059e27b8
(Man-getpage-in-background): Use shell-file-name
Eli Zaretskii <eliz@gnu.org>
parents:
54515
diff
changeset
|
951 (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
|
952 (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
|
953 shell-file-name |
060e08bf63fe
(Man-getpage-in-background): Add windows-nt to the list
Eli Zaretskii <eliz@gnu.org>
parents:
56159
diff
changeset
|
954 "sh") |
56159
8fd93d7de209
(Man-getpage-in-background): Revert previous change but
Nick Roberts <nickrob@snap.net.nz>
parents:
55527
diff
changeset
|
955 shell-command-switch |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
956 (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
|
957 '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
|
958 (let ((exit-status |
55527
4729059e27b8
(Man-getpage-in-background): Use shell-file-name
Eli Zaretskii <eliz@gnu.org>
parents:
54515
diff
changeset
|
959 (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
|
960 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
|
961 (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
|
962 (msg "")) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
963 (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
|
964 (= 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
|
965 (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
|
966 (setq msg |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
967 (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
|
968 exit-status))) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
969 (setq msg exit-status)) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
970 (Man-bgproc-sentinel bufname msg))))) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
971 buffer)) |
3235 | 972 |
973 (defun Man-notify-when-ready (man-buffer) | |
974 "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
|
975 See the variable `Man-notify-method' for the different notification behaviors." |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
976 (let ((saved-frame (with-current-buffer man-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
|
977 Man-original-frame))) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
978 (case Man-notify-method |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
979 (newframe |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
980 ;; 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
|
981 ;; 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
|
982 ;; 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
|
983 ;; 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
|
984 (save-excursion |
21581
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
985 (let ((frame (make-frame Man-frame-parameters))) |
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
986 (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
|
987 (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
|
988 (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
|
989 (select-frame frame))))) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
990 (pushy |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
991 (switch-to-buffer man-buffer)) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
992 (bully |
29973
be9760ddad44
(Man-notify-when-ready): Don't use window-system. If
Eli Zaretskii <eliz@gnu.org>
parents:
29838
diff
changeset
|
993 (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
|
994 (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
|
995 (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
|
996 (delete-other-windows)) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
997 (aggressive |
29973
be9760ddad44
(Man-notify-when-ready): Don't use window-system. If
Eli Zaretskii <eliz@gnu.org>
parents:
29838
diff
changeset
|
998 (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
|
999 (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
|
1000 (pop-to-buffer man-buffer)) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1001 (friendly |
29973
be9760ddad44
(Man-notify-when-ready): Don't use window-system. If
Eli Zaretskii <eliz@gnu.org>
parents:
29838
diff
changeset
|
1002 (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
|
1003 (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
|
1004 (display-buffer man-buffer 'not-this-window)) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1005 (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
|
1006 (beep) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1007 (message "Manual buffer %s is ready" (buffer-name man-buffer))) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1008 (quiet |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1009 (message "Manual buffer %s is ready" (buffer-name man-buffer))) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1010 (t ;; 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
|
1011 (message "")) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
1012 ))) |
3235 | 1013 |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
1014 (defun Man-softhyphen-to-minus () |
47891
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
1015 ;; \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
|
1016 ;; 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
|
1017 (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
|
1018 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
|
1019 (goto-char (point-min)) |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
1020 (let ((str "\255")) |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
1021 (if enable-multibyte-characters |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
1022 (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
|
1023 (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
|
1024 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1025 (defun Man-fontify-manpage () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1026 "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
|
1027 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
|
1028 (interactive) |
54515 | 1029 (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
|
1030 (goto-char (point-min)) |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1031 ;; Fontify ANSI escapes. |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1032 (let ((faces nil) |
59362
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1033 (buffer-undo-list t) |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1034 (start (point))) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1035 ;; http://www.isthe.com/chongo/tech/comp/ansi_escapes.html |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1036 ;; suggests many codes, but we only handle: |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1037 ;; ESC [ 00 m reset to normal display |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1038 ;; ESC [ 01 m bold |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1039 ;; ESC [ 04 m underline |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1040 ;; ESC [ 07 m reverse-video |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1041 ;; ESC [ 22 m no-bold |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1042 ;; ESC [ 24 m no-underline |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1043 ;; ESC [ 27 m no-reverse-video |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1044 (while (re-search-forward "\e\\[0?\\([1470]\\|2\\([247]\\)\\)m" nil t) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1045 (if faces (put-text-property start (match-beginning 0) 'face |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1046 (if (cdr faces) faces (car faces)))) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1047 (setq faces |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1048 (cond |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1049 ((match-beginning 2) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1050 (delq (case (char-after (match-beginning 2)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1051 (?2 Man-overstrike-face) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1052 (?4 Man-underline-face) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1053 (?7 Man-reverse-face)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1054 faces)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1055 ((eq (char-after (match-beginning 1)) ?0) nil) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1056 (t |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1057 (cons (case (char-after (match-beginning 1)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1058 (?1 Man-overstrike-face) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1059 (?4 Man-underline-face) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1060 (?7 Man-reverse-face)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1061 faces)))) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1062 (delete-region (match-beginning 0) (match-end 0)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1063 (setq start (point)))) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1064 ;; Other highlighting. |
59362
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1065 (let ((buffer-undo-list t)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1066 (if (< (buffer-size) (position-bytes (point-max))) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1067 ;; Multibyte characters exist. |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1068 (progn |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1069 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1070 (while (search-forward "__\b\b" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1071 (backward-delete-char 4) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1072 (put-text-property (point) (1+ (point)) 'face Man-underline-face)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1073 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1074 (while (search-forward "\b\b__" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1075 (backward-delete-char 4) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1076 (put-text-property (1- (point)) (point) 'face Man-underline-face)))) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1077 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1078 (while (search-forward "_\b" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1079 (backward-delete-char 2) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1080 (put-text-property (point) (1+ (point)) 'face Man-underline-face)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1081 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1082 (while (search-forward "\b_" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1083 (backward-delete-char 2) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1084 (put-text-property (1- (point)) (point) 'face Man-underline-face)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1085 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1086 (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1087 (replace-match "\\1") |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1088 (put-text-property (1- (point)) (point) 'face Man-overstrike-face)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1089 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1090 (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1091 (replace-match "o") |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1092 (put-text-property (1- (point)) (point) 'face 'bold)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1093 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1094 (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1095 (replace-match "+") |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1096 (put-text-property (1- (point)) (point) 'face 'bold)) |
107144
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1097 ;; When the header is longer than the manpage name, groff tries to |
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1098 ;; condense it to a shorter line interspered with ^H. Remove ^H with |
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1099 ;; their preceding chars (but don't put Man-overstrike-face). (Bug#5566) |
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1100 (goto-char (point-min)) |
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1101 (while (re-search-forward ".\b" nil t) (backward-delete-char 2)) |
59362
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1102 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1103 ;; Try to recognize common forms of cross references. |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1104 (Man-highlight-references) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1105 (Man-softhyphen-to-minus) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1106 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1107 (while (re-search-forward Man-heading-regexp nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1108 (put-text-property (match-beginning 0) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1109 (match-end 0) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
1110 'face Man-overstrike-face))) |
53690
f428900fb582
(Man-fontify-manpage): Clean up message.
Richard M. Stallman <rms@gnu.org>
parents:
53477
diff
changeset
|
1111 (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
|
1112 |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
1113 (defun Man-highlight-references (&optional xref-man-type) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1114 "Highlight the references on mouse-over. |
65197
df6f7e582a6e
(Man-init-defvars, Man-translate-references, Man-support-local-filenames,
Juanma Barranquero <lekktu@gmail.com>
parents:
64762
diff
changeset
|
1115 References include items in the SEE ALSO section, |
67006
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1116 header file (#include <foo.h>), and files in FILES. |
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1117 If optional argument XREF-MAN-TYPE is non-nil, it used as the |
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1118 button type for items in SEE ALSO section. If it is nil, the |
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1119 default type, `Man-xref-man-page' is used for the buttons." |
66792
9a04e09eb6c9
(Man-highlight-references): Set an empty
Masatake YAMATO <jet@gyve.org>
parents:
66729
diff
changeset
|
1120 ;; `Man-highlight-references' is used from woman.el, too. |
9a04e09eb6c9
(Man-highlight-references): Set an empty
Masatake YAMATO <jet@gyve.org>
parents:
66729
diff
changeset
|
1121 ;; woman.el doesn't set `Man-arguments'. |
9a04e09eb6c9
(Man-highlight-references): Set an empty
Masatake YAMATO <jet@gyve.org>
parents:
66729
diff
changeset
|
1122 (unless Man-arguments |
9a04e09eb6c9
(Man-highlight-references): Set an empty
Masatake YAMATO <jet@gyve.org>
parents:
66729
diff
changeset
|
1123 (setq Man-arguments "")) |
66729 | 1124 (if (string-match "-k " Man-arguments) |
1125 (progn | |
69793
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
1126 (Man-highlight-references0 nil Man-reference-regexp 1 |
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
1127 'Man-default-man-entry |
67006
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1128 (or xref-man-type 'Man-xref-man-page)) |
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1129 (Man-highlight-references0 nil Man-apropos-regexp 1 |
69793
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
1130 'Man-default-man-entry |
67006
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1131 (or xref-man-type 'Man-xref-man-page))) |
100171 | 1132 (Man-highlight-references0 Man-see-also-regexp Man-reference-regexp 1 |
69793
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
1133 'Man-default-man-entry |
67006
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1134 (or xref-man-type 'Man-xref-man-page)) |
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1135 (Man-highlight-references0 Man-synopsis-regexp Man-header-regexp 0 2 |
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1136 'Man-xref-header-file) |
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1137 (Man-highlight-references0 Man-files-regexp Man-normal-file-regexp 0 0 |
a6acb03fe18c
(Man-highlight-references): Doc fix. Reformat code in a more Lisp-ish way.
Eli Zaretskii <eliz@gnu.org>
parents:
66792
diff
changeset
|
1138 'Man-xref-normal-file))) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1139 |
66729 | 1140 (defun Man-highlight-references0 (start-section regexp button-pos target type) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1141 ;; Based on `Man-build-references-alist' |
66729 | 1142 (when (or (null start-section) |
1143 (Man-find-section start-section)) | |
1144 (let ((end (if start-section | |
1145 (progn | |
1146 (forward-line 1) | |
1147 (back-to-indentation) | |
1148 (save-excursion | |
1149 (Man-next-section 1) | |
1150 (point))) | |
1151 (goto-char (point-min)) | |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1152 nil))) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1153 (while (re-search-forward regexp end t) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1154 (make-text-button |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1155 (match-beginning button-pos) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1156 (match-end button-pos) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1157 'type type |
66729 | 1158 'Man-target-string (cond |
100171 | 1159 ((numberp target) |
66729 | 1160 (match-string target)) |
1161 ((functionp target) | |
69793
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
1162 target) |
66729 | 1163 (t nil))))))) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1164 |
57699
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
1165 (defun Man-cleanup-manpage (&optional interactive) |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
1166 "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
|
1167 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
|
1168 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
|
1169 script would have done them." |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
1170 (interactive "p") |
9620
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1171 (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
|
1172 Man-arguments) |
57699
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
1173 (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
|
1174 (progn |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1175 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1176 (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
|
1177 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1178 (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
|
1179 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1180 (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
|
1181 (replace-match "\\1")) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1182 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1183 (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
|
1184 (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
|
1185 (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
|
1186 )) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1187 (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
|
1188 (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) (replace-match "+")) |
107144
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1189 ;; When the header is longer than the manpage name, groff tries to |
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1190 ;; condense it to a shorter line interspered with ^H. Remove ^H with |
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1191 ;; their preceding chars (but don't put Man-overstrike-face). (Bug#5566) |
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1192 (goto-char (point-min)) |
0811f079d15e
* man.el (Man-fontify-manpage, Man-cleanup-manpage):
Juri Linkov <juri@jurta.org>
parents:
107131
diff
changeset
|
1193 (while (re-search-forward ".\b" nil t) (backward-delete-char 2)) |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
1194 (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
|
1195 (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
|
1196 |
3235 | 1197 (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
|
1198 "Manpage background process sentinel. |
28102 | 1199 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
|
1200 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
|
1201 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
|
1202 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
|
1203 manpage command." |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1204 (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
|
1205 (process-buffer process))) |
3235 | 1206 (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
|
1207 (err-mess nil)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1208 |
3235 | 1209 (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
|
1210 (or (stringp process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1211 (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
|
1212 |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1213 (with-current-buffer Man-buffer |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1214 (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
|
1215 (goto-char (point-min)) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1216 (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
|
1217 (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
|
1218 (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
|
1219 (progn |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1220 (end-of-line) (point))) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1221 delete-buff t)) |
106649
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1222 |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1223 ;; "-k foo", successful exit, but no output (from man-db) |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1224 ;; ENHANCE-ME: share the check for -k with |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1225 ;; `Man-highlight-references'. The \\s- bits here are |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1226 ;; meant to allow for multiple options with -k among them. |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1227 ((and (string-match "\\(\\`\\|\\s-\\)-k\\s-" Man-arguments) |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1228 (eq (process-status process) 'exit) |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1229 (= (process-exit-status process) 0) |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1230 (= (point-min) (point-max))) |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1231 (setq err-mess (format "%s: no matches" Man-arguments) |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1232 delete-buff t)) |
11605ddedbe6
(Man-bgproc-sentinel): When "-k foo" produces no output show error
Kevin Ryde <user42@zip.com.au>
parents:
106648
diff
changeset
|
1233 |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1234 ((or (stringp process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1235 (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
|
1236 (= (process-exit-status process) 0)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1237 (or (zerop (length msg)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1238 (progn |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1239 (setq err-mess |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1240 (concat (buffer-name Man-buffer) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1241 ": process " |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1242 (let ((eos (1- (length msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1243 (if (= (aref msg eos) ?\n) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1244 (substring msg 0 eos) msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1245 (goto-char (point-max)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1246 (insert (format "\nprocess %s" msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1247 )) |
16509
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1248 (if delete-buff |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1249 (kill-buffer Man-buffer) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1250 (if Man-fontify-manpage-flag |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1251 (Man-fontify-manpage) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1252 (Man-cleanup-manpage)) |
64620
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1253 |
16509
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1254 (run-hooks 'Man-cooked-hook) |
64620
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1255 (Man-mode) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1256 |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1257 (if (not Man-page-list) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1258 (let ((args Man-arguments)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1259 (kill-buffer (current-buffer)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1260 (error "Can't find the %s manpage" args))) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1261 |
16509
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1262 (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
|
1263 )) |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1264 ;; 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
|
1265 ;; Man-notify-when-ready because it may switch buffers. |
3235 | 1266 |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1267 (if (not delete-buff) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1268 (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
|
1269 |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1270 (if err-mess |
87139
f358a2fd5895
Fix buggy calls to `error'.
Deepak Goel <deego@gnufans.org>
parents:
86355
diff
changeset
|
1271 (error "%s" err-mess)) |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1272 )))) |
3235 | 1273 |
1274 | |
1275 ;; ====================================================================== | |
1276 ;; set up manual mode in buffer and build alists | |
1277 | |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1278 (defvar bookmark-make-record-function) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1279 |
63336
423fcdb144f5
(Man-mode-map): Initialize it properly.
Lute Kamstra <lute@gnu.org>
parents:
62878
diff
changeset
|
1280 (put 'Man-mode 'mode-class 'special) |
423fcdb144f5
(Man-mode-map): Initialize it properly.
Lute Kamstra <lute@gnu.org>
parents:
62878
diff
changeset
|
1281 |
3235 | 1282 (defun Man-mode () |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
1283 "A mode for browsing Un*x manual pages. |
3235 | 1284 |
28102 | 1285 The following man commands are available in the buffer. Try |
3235 | 1286 \"\\[describe-key] <key> RET\" for more information: |
1287 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1288 \\[man] Prompt to retrieve a new manpage. |
3235 | 1289 \\[Man-follow-manual-reference] Retrieve reference in SEE ALSO section. |
1290 \\[Man-next-manpage] Jump to next manpage in circular list. | |
1291 \\[Man-previous-manpage] Jump to previous manpage in circular list. | |
1292 \\[Man-next-section] Jump to next manpage section. | |
1293 \\[Man-previous-section] Jump to previous manpage section. | |
1294 \\[Man-goto-section] Go to a manpage section. | |
1295 \\[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
|
1296 \\[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
|
1297 \\[Man-kill] Deletes the manpage window, kill its buffer. |
3235 | 1298 \\[describe-mode] Prints this help text. |
1299 | |
28102 | 1300 The following variables may be of some use. Try |
3235 | 1301 \"\\[describe-variable] <variable-name> RET\" for more information: |
1302 | |
28102 | 1303 `Man-notify-method' What happens when manpage formatting is done. |
1304 `Man-downcase-section-letters-flag' Force section letters to lower case. | |
1305 `Man-circular-pages-flag' Treat multiple manpage list as circular. | |
1306 `Man-section-translations-alist' List of section numbers and their Un*x equiv. | |
1307 `Man-filter-list' Background manpage filter command. | |
1308 `Man-mode-map' Keymap bindings for Man mode buffers. | |
1309 `Man-mode-hook' Normal hook run on entry to Man mode. | |
1310 `Man-section-regexp' Regexp describing manpage section letters. | |
1311 `Man-heading-regexp' Regexp describing section headers. | |
1312 `Man-see-also-regexp' Regexp for SEE ALSO section (or your equiv). | |
1313 `Man-first-heading-regexp' Regexp for first heading on a manpage. | |
1314 `Man-reference-regexp' Regexp matching a references in SEE ALSO. | |
1315 `Man-switches' Background `man' command switches. | |
3235 | 1316 |
1317 The following key bindings are currently in effect in the buffer: | |
1318 \\{Man-mode-map}" | |
1319 (interactive) | |
62736
76864fc0acf0
(Man-mode): Use kill-all-local-variables and run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
61889
diff
changeset
|
1320 (kill-all-local-variables) |
3235 | 1321 (setq major-mode 'Man-mode |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
1322 mode-name "Man" |
3235 | 1323 buffer-auto-save-file-name nil |
38970
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1324 mode-line-buffer-identification |
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1325 (list (default-value 'mode-line-buffer-identification) |
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1326 " {" 'Man-page-mode-string "}") |
3235 | 1327 truncate-lines t |
1328 buffer-read-only t) | |
62736
76864fc0acf0
(Man-mode): Use kill-all-local-variables and run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
61889
diff
changeset
|
1329 (buffer-disable-undo) |
3235 | 1330 (auto-fill-mode -1) |
1331 (use-local-map Man-mode-map) | |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
1332 (set-syntax-table man-mode-syntax-table) |
54515 | 1333 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) |
1334 (set (make-local-variable 'outline-regexp) Man-heading-regexp) | |
1335 (set (make-local-variable 'outline-level) (lambda () 1)) | |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1336 (set (make-local-variable 'bookmark-make-record-function) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1337 'Man-bookmark-make-record) |
3235 | 1338 (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
|
1339 (Man-strip-page-headers) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1340 (Man-unindent) |
64620
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1341 (Man-goto-page 1 t) |
62736
76864fc0acf0
(Man-mode): Use kill-all-local-variables and run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
61889
diff
changeset
|
1342 (run-mode-hooks 'Man-mode-hook)) |
3235 | 1343 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1344 (defsubst Man-build-section-alist () |
3235 | 1345 "Build the association list of manpage sections." |
1346 (setq Man-sections-alist nil) | |
1347 (goto-char (point-min)) | |
7450 | 1348 (let ((case-fold-search nil)) |
1349 (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
|
1350 (aput 'Man-sections-alist (match-string 1)) |
7450 | 1351 (forward-line 1)))) |
3235 | 1352 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1353 (defsubst Man-build-references-alist () |
3235 | 1354 "Build the association list of references (in the SEE ALSO section)." |
1355 (setq Man-refpages-alist nil) | |
1356 (save-excursion | |
1357 (if (Man-find-section Man-see-also-regexp) | |
1358 (let ((start (progn (forward-line 1) (point))) | |
1359 (end (progn | |
1360 (Man-next-section 1) | |
1361 (point))) | |
1362 hyphenated | |
1363 (runningpoint -1)) | |
7450 | 1364 (save-restriction |
1365 (narrow-to-region start end) | |
1366 (goto-char (point-min)) | |
1367 (back-to-indentation) | |
1368 (while (and (not (eobp)) (/= (point) runningpoint)) | |
1369 (setq runningpoint (point)) | |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1370 (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
|
1371 (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
|
1372 (len (1- (length word)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1373 (if hyphenated |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1374 (setq word (concat hyphenated word) |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1375 hyphenated nil |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1376 ;; Update len, in case a reference spans |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1377 ;; more than two lines (paranoia). |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1378 len (1- (length word)))) |
51376
ec20af5e04b3
(Man-name-regexp): Also match Latin-1 soft hyphen.
Andreas Schwab <schwab@suse.de>
parents:
50602
diff
changeset
|
1379 (if (memq (aref word len) '(?- ?)) |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1380 (setq hyphenated (substring word 0 len))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1381 (if (string-match Man-reference-regexp word) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1382 (aput 'Man-refpages-alist word)))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1383 (skip-chars-forward " \t\n,")))))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1384 (setq Man-refpages-alist (nreverse Man-refpages-alist))) |
3235 | 1385 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1386 (defun Man-build-page-list () |
3235 | 1387 "Build the list of separate manpages in the buffer." |
1388 (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
|
1389 (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
|
1390 (page-end (point-max)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1391 (header "")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1392 (goto-char page-start) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1393 ;; (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
|
1394 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1395 (setq header |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1396 (if (looking-at Man-page-header-regexp) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
1397 (match-string 1) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1398 nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1399 ;; 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
|
1400 (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
|
1401 (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
|
1402 ;; 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
|
1403 ;; 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
|
1404 ;; 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
|
1405 ;; 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
|
1406 ;; previous page header. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1407 (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
|
1408 (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
|
1409 (beginning-of-line)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1410 (setq page-end (point)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1411 (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
|
1412 (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
|
1413 (copy-marker page-end) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1414 header)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1415 (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
|
1416 ))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1417 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1418 (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
|
1419 "Strip all the page headers but the first from the manpage." |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1420 (let ((inhibit-read-only t) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1421 (case-fold-search nil) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1422 (header "")) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1423 (dolist (page Man-page-list) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1424 (and (nth 2 page) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1425 (goto-char (car page)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1426 (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
|
1427 (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
|
1428 ;; 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
|
1429 ;; 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
|
1430 ;; 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
|
1431 ;; 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
|
1432 ;; 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
|
1433 ;; 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
|
1434 ;; line. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1435 ;; (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
|
1436 (while (search-forward header (nth 1 page) t) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1437 (replace-match "")))))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1438 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1439 (defun Man-unindent () |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1440 "Delete the leading spaces that indent the manpage." |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1441 (let ((inhibit-read-only t) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1442 (case-fold-search nil)) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1443 (dolist (page Man-page-list) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1444 (let ((indent "") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1445 (nindent 0)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1446 (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
|
1447 (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
|
1448 (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
|
1449 (if (catch 'unindent |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1450 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1451 (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
|
1452 (throw 'unindent nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1453 (beginning-of-line) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1454 (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
|
1455 (progn |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1456 (skip-chars-forward " ") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1457 (point)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1458 (setq nindent (length indent)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1459 (if (zerop nindent) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1460 (throw 'unindent nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1461 (setq indent (concat indent "\\|$")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1462 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1463 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1464 (if (looking-at indent) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1465 (forward-line 1) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1466 (throw 'unindent nil))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1467 (goto-char (point-min))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1468 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1469 (or (eolp) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1470 (delete-char nindent)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1471 (forward-line 1))) |
7450 | 1472 )))) |
3235 | 1473 |
1474 | |
1475 ;; ====================================================================== | |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1476 ;; Man mode commands |
3235 | 1477 |
1478 (defun Man-next-section (n) | |
1479 "Move point to Nth next section (default 1)." | |
1480 (interactive "p") | |
78510
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
1481 (let ((case-fold-search nil) |
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
1482 (start (point))) |
7450 | 1483 (if (looking-at Man-heading-regexp) |
1484 (forward-line 1)) | |
1485 (if (re-search-forward Man-heading-regexp (point-max) t n) | |
1486 (beginning-of-line) | |
77897
f05ec6aa2fbe
(Man-next-section): Don't consider the last line of the page as being
Chong Yidong <cyd@stupidchicken.com>
parents:
76691
diff
changeset
|
1487 (goto-char (point-max)) |
f05ec6aa2fbe
(Man-next-section): Don't consider the last line of the page as being
Chong Yidong <cyd@stupidchicken.com>
parents:
76691
diff
changeset
|
1488 ;; The last line doesn't belong to any section. |
78510
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
1489 (forward-line -1)) |
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
1490 ;; But don't move back from the starting point (can happen if `start' |
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
1491 ;; is somewhere on the last line). |
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
1492 (if (< (point) start) (goto-char start)))) |
3235 | 1493 |
1494 (defun Man-previous-section (n) | |
1495 "Move point to Nth previous section (default 1)." | |
1496 (interactive "p") | |
7450 | 1497 (let ((case-fold-search nil)) |
1498 (if (looking-at Man-heading-regexp) | |
1499 (forward-line -1)) | |
1500 (if (re-search-backward Man-heading-regexp (point-min) t n) | |
1501 (beginning-of-line) | |
1502 (goto-char (point-min))))) | |
3235 | 1503 |
1504 (defun Man-find-section (section) | |
1505 "Move point to SECTION if it exists, otherwise don't move point. | |
1506 Returns t if section is found, nil otherwise." | |
7450 | 1507 (let ((curpos (point)) |
1508 (case-fold-search nil)) | |
3235 | 1509 (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
|
1510 (if (re-search-forward (concat "^" section) (point-max) t) |
3235 | 1511 (progn (beginning-of-line) t) |
1512 (goto-char curpos) | |
1513 nil) | |
1514 )) | |
1515 | |
1516 (defun Man-goto-section () | |
1517 "Query for section to move point to." | |
1518 (interactive) | |
1519 (aput 'Man-sections-alist | |
1520 (let* ((default (aheadsym Man-sections-alist)) | |
1521 (completion-ignore-case t) | |
1522 chosen | |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
1523 (prompt (concat "Go to section (default " default "): "))) |
3235 | 1524 (setq chosen (completing-read prompt Man-sections-alist)) |
1525 (if (or (not chosen) | |
1526 (string= chosen "")) | |
1527 default | |
1528 chosen))) | |
106782
7cf596e46b08
* man.el (Man-goto-section): Signal error if section not found (Bug#5317).
Chong Yidong <cyd@stupidchicken.com>
parents:
106649
diff
changeset
|
1529 (unless (Man-find-section (aheadsym Man-sections-alist)) |
7cf596e46b08
* man.el (Man-goto-section): Signal error if section not found (Bug#5317).
Chong Yidong <cyd@stupidchicken.com>
parents:
106649
diff
changeset
|
1530 (error "Section not found"))) |
7cf596e46b08
* man.el (Man-goto-section): Signal error if section not found (Bug#5317).
Chong Yidong <cyd@stupidchicken.com>
parents:
106649
diff
changeset
|
1531 |
3235 | 1532 |
1533 (defun Man-goto-see-also-section () | |
42706 | 1534 "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
|
1535 Actually the section moved to is described by `Man-see-also-regexp'." |
3235 | 1536 (interactive) |
1537 (if (not (Man-find-section Man-see-also-regexp)) | |
87139
f358a2fd5895
Fix buggy calls to `error'.
Deepak Goel <deego@gnufans.org>
parents:
86355
diff
changeset
|
1538 (error "%s" (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
|
1539 " section found in the current manpage")))) |
3235 | 1540 |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1541 (defun Man-possibly-hyphenated-word () |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1542 "Return a possibly hyphenated word at point. |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1543 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
|
1544 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
|
1545 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
|
1546 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
|
1547 \"tcgetp-\" instead of \"grp\"." |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1548 (save-excursion |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1549 (skip-syntax-backward "w()") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1550 (skip-chars-forward " \t") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1551 (let ((beg (point)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1552 (word (current-word))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1553 (when (eq beg (save-excursion |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1554 (back-to-indentation) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1555 (point))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1556 (end-of-line 0) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1557 (if (eq (char-before) ?-) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1558 (setq word (current-word)))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1559 word))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1560 |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1561 (defun Man-follow-manual-reference (reference) |
3235 | 1562 "Get one of the manpages referred to in the \"SEE ALSO\" section. |
28102 | 1563 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
|
1564 (interactive |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1565 (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
|
1566 (error "There are no references in the current man page") |
87372
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1567 (list |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1568 (let* ((default (or |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1569 (car (all-completions |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1570 (let ((word |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1571 (or (Man-possibly-hyphenated-word) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1572 ""))) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1573 ;; strip a trailing '-': |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1574 (if (string-match "-$" word) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1575 (substring word 0 |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1576 (match-beginning 0)) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1577 word)) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1578 Man-refpages-alist)) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1579 (aheadsym Man-refpages-alist))) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1580 (defaults |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1581 (mapcar 'substring-no-properties |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1582 (delete-dups |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1583 (delq nil (cons default |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1584 (mapcar 'car Man-refpages-alist)))))) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1585 chosen |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1586 (prompt (concat "Refer to (default " default "): "))) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1587 (setq chosen (completing-read prompt Man-refpages-alist |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1588 nil nil nil nil defaults)) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1589 (if (or (not chosen) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1590 (string= chosen "")) |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1591 default |
fb00bf8f41d7
(Man-follow-manual-reference): Fill the minibuffer's
Juri Linkov <juri@jurta.org>
parents:
87335
diff
changeset
|
1592 chosen))))) |
3235 | 1593 (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
|
1594 (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
|
1595 (aput 'Man-refpages-alist reference) |
3235 | 1596 (Man-getpage-in-background |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1597 (Man-translate-references (aheadsym Man-refpages-alist))))) |
3235 | 1598 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1599 (defun Man-kill () |
3235 | 1600 "Kill the buffer containing the manpage." |
1601 (interactive) | |
22368
c3a15ab5924f
(Man-kill, Man-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
22217
diff
changeset
|
1602 (quit-window t)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1603 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1604 (defun Man-quit () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1605 "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
|
1606 (interactive) |
22368
c3a15ab5924f
(Man-kill, Man-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
22217
diff
changeset
|
1607 (quit-window)) |
3235 | 1608 |
64622
b508a64c1b7e
(Man-goto-page): Make second argument NOERROR optional.
Juanma Barranquero <lekktu@gmail.com>
parents:
64620
diff
changeset
|
1609 (defun Man-goto-page (page &optional noerror) |
3235 | 1610 "Go to the manual page on page PAGE." |
1611 (interactive | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1612 (if (not Man-page-list) |
64620
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1613 (error "Not a man page buffer") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1614 (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
|
1615 (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
|
1616 (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
|
1617 (length Man-page-list))))))) |
64620
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1618 (if (and (not Man-page-list) (not noerror)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1619 (error "Not a man page buffer")) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1620 (when Man-page-list |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1621 (if (or (< page 1) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1622 (> page (length Man-page-list))) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1623 (error "No manpage %d found" page)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1624 (let* ((page-range (nth (1- page) Man-page-list)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1625 (page-start (car page-range)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1626 (page-end (car (cdr page-range)))) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1627 (setq Man-current-page page |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1628 Man-page-mode-string (Man-make-page-mode-string)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1629 (widen) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1630 (goto-char page-start) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1631 (narrow-to-region page-start page-end) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1632 (Man-build-section-alist) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1633 (Man-build-references-alist) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1634 (goto-char (point-min))))) |
3235 | 1635 |
1636 | |
1637 (defun Man-next-manpage () | |
1638 "Find the next manpage entry in the buffer." | |
1639 (interactive) | |
1640 (if (= (length Man-page-list) 1) | |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1641 (error "This is the only manpage in the buffer")) |
3235 | 1642 (if (< Man-current-page (length Man-page-list)) |
1643 (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
|
1644 (if Man-circular-pages-flag |
3235 | 1645 (Man-goto-page 1) |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1646 (error "You're looking at the last manpage in the buffer")))) |
3235 | 1647 |
1648 (defun Man-previous-manpage () | |
1649 "Find the previous manpage entry in the buffer." | |
1650 (interactive) | |
1651 (if (= (length Man-page-list) 1) | |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1652 (error "This is the only manpage in the buffer")) |
3235 | 1653 (if (> Man-current-page 1) |
1654 (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
|
1655 (if Man-circular-pages-flag |
3235 | 1656 (Man-goto-page (length Man-page-list)) |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1657 (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
|
1658 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1659 ;; Header file support |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1660 (defun Man-view-header-file (file) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1661 "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
|
1662 (let ((path Man-header-file-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1663 complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1664 (while path |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1665 (setq complete-path (expand-file-name file (car path)) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1666 path (cdr path)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1667 (if (file-readable-p complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1668 (progn (view-file complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1669 (setq path nil)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1670 (setq complete-path nil))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1671 complete-path)) |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1672 |
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1673 ;;; Bookmark Man Support |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1674 (declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1675 (declare-function bookmark-prop-get "bookmark" (bookmark prop)) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1676 (declare-function bookmark-default-handler "bookmark" (bmk)) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1677 (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1678 |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1679 (defun Man-default-bookmark-title () |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1680 "Default bookmark name for Man or WoMan pages. |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1681 Uses `Man-name-local-regexp'." |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1682 (save-excursion |
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1683 (goto-char (point-min)) |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1684 (when (re-search-forward Man-name-local-regexp nil t) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1685 (skip-chars-forward "\n\t ") |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1686 (buffer-substring-no-properties (point) (line-end-position))))) |
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1687 |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1688 (defun Man-bookmark-make-record () |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1689 "Make a bookmark entry for a Man buffer." |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1690 `(,(Man-default-bookmark-title) |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1691 ,@(bookmark-make-record-default 'point-only) |
107855
d9895f87d758
Add a new field `location' to bookmarks for non-file bookmarks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107838
diff
changeset
|
1692 (location . ,(concat "man " Man-arguments)) |
d9895f87d758
Add a new field `location' to bookmarks for non-file bookmarks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107838
diff
changeset
|
1693 (man-args . ,Man-arguments) |
d9895f87d758
Add a new field `location' to bookmarks for non-file bookmarks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107838
diff
changeset
|
1694 (handler . Man-bookmark-jump))) |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1695 |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1696 ;;;###autoload |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1697 (defun Man-bookmark-jump (bookmark) |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1698 "Default bookmark handler for Man buffers." |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1699 (let* ((man-args (bookmark-prop-get bookmark 'man-args)) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1700 ;; Let bookmark.el do the window handling. |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1701 ;; This let-binding needs to be active during the call to both |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1702 ;; Man-getpage-in-background and accept-process-output. |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1703 (Man-notify-method 'meek) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1704 (buf (Man-getpage-in-background man-args)) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1705 (proc (get-buffer-process buf))) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1706 (while (and proc (eq (process-status proc) 'run)) |
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107837
diff
changeset
|
1707 (accept-process-output proc)) |
107837
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1708 (bookmark-default-handler |
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1709 `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark))))) |
4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107337
diff
changeset
|
1710 |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1711 |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1712 ;; 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
|
1713 (Man-init-defvars) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1714 |
28102 | 1715 (add-to-list 'debug-ignored-errors "^No manpage [0-9]* found$") |
1716 (add-to-list 'debug-ignored-errors "^Can't find the .* manpage$") | |
1717 | |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1718 (provide 'man) |
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1719 |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1720 ;; arch-tag: 587cda76-8e23-4594-b1f3-89b6b09a0d47 |
3235 | 1721 ;;; man.el ends here |