Mercurial > emacs
annotate lisp/man.el @ 82506:eeb13f703926
*** empty log message ***
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Tue, 21 Aug 2007 19:19:46 +0000 |
parents | 0a3b41825002 |
children | 28d0c39b6c3b 33c6fafd3276 424b655804ca |
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 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64622
diff
changeset
|
3 ;; Copyright (C) 1993, 1994, 1996, 1997, 2001, 2002, 2003, |
75347 | 4 ;; 2004, 2005, 2006, 2007 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 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77897
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
3235 | 16 ;; any later version. |
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 | |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
3235 | 27 |
28 ;;; Commentary: | |
29 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
30 ;; 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
|
31 ;; 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
|
32 ;; can continue to use your Emacs while processing is going on. |
3235 | 33 ;; |
34 ;; The mode also supports hypertext-like following of manual page SEE | |
35 ;; ALSO references, and other features. See below or do `?' in a | |
36 ;; manual page buffer for details. | |
37 | |
28102 | 38 ;; ========== Credits and History ========== |
3235 | 39 ;; 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
|
40 ;; man.el from the standard Emacs 18.57 distribution. I liked many of |
14040 | 41 ;; 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
|
42 ;; to incorporate them into a single manual browsing mode. While |
3235 | 43 ;; much of the code here has been rewritten, and some features added, |
44 ;; these folks deserve lots of credit for providing the initial | |
45 ;; excellent packages on which this one is based. | |
46 | |
47 ;; Nick Duffek <duffek@chaos.cs.brandeis.edu>, posted a very nice | |
48 ;; improvement which retrieved and cleaned the manpages in a | |
49 ;; background process, and which correctly deciphered such options as | |
50 ;; man -k. | |
51 | |
52 ;; Eric Rose <erose@jessica.stanford.edu>, submitted manual.el which | |
53 ;; provided a very nice manual browsing mode. | |
54 | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3307
diff
changeset
|
55 ;; This package was available as `superman.el' from the LCD package |
3235 | 56 ;; for some time before it was accepted into Emacs 19. The entry |
57 ;; point and some other names have been changed to make it a drop-in | |
58 ;; replacement for the old man.el package. | |
59 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
60 ;; 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
|
61 ;; making it faster, more robust and more tolerant of different |
14040 | 62 ;; systems' man idiosyncrasies. |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
63 |
3235 | 64 ;; ========== Features ========== |
65 ;; + Runs "man" in the background and pipes the results through a | |
66 ;; 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
|
67 ;; is done in the background. The cleaning commands are configurable. |
3235 | 68 ;; + Syntax is the same as Un*x man |
69 ;; + 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
|
70 ;; "man <section>", etc. |
3235 | 71 ;; + Provides a manual browsing mode with keybindings for traversing |
72 ;; the sections of a manpage, following references in the SEE ALSO | |
73 ;; section, and more. | |
74 ;; + Multiple manpages created with the same man command are put into | |
75 ;; a narrowed buffer circular list. | |
76 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
77 ;; ============= TODO =========== |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
78 ;; - Add a command for printing. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
79 ;; - The awk script deletes multiple blank lines. This behaviour does |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
80 ;; 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
|
81 ;; 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
|
82 ;; 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
|
83 ;; 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
|
84 ;; 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
|
85 ;; 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
|
86 ;; only. Is it worth doing? |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
87 ;; - 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
|
88 ;; 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
|
89 ;; - Allow completion on the manpage name when calling man. This |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
90 ;; requires a reliable list of places where manpages can be found. The |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
91 ;; drawback would be that if the list is not complete, the user might |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
92 ;; be led to believe that the manpages in the missing directories do |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
93 ;; not exist. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
94 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
95 |
3235 | 96 ;;; Code: |
97 | |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
98 (eval-when-compile (require 'cl)) |
3235 | 99 (require 'assoc) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
100 (require 'button) |
3235 | 101 |
102 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
103 ;; 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
|
104 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
105 (defgroup man nil |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
106 "Browse UNIX manual pages." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
107 :prefix "Man-" |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
108 :group 'help) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
109 |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
110 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
111 (defvar Man-notify) |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
112 (defcustom Man-filter-list nil |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
113 "*Manpage cleaning filter command phrases. |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
114 This variable contains a list of the following form: |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
115 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
116 '((command-string phrase-string*)*) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
117 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
118 Each phrase-string is concatenated onto the command-string to form a |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
119 command filter. The (standard) output (and standard error) of the Un*x |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
120 man command is piped through each command filter in the order the |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
121 commands appear in the association list. The final output is placed in |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
122 the manpage buffer." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
123 :type '(repeat (list (string :tag "Command String") |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
124 (repeat :inline t |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
125 (string :tag "Phrase String")))) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
126 :group 'man) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
127 |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
128 (defvar Man-uses-untabify-flag t |
28102 | 129 "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
|
130 (defvar Man-sed-script nil |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
131 "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
|
132 |
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
133 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
3235 | 134 ;; user variables |
135 | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
136 (defcustom Man-fontify-manpage-flag t |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
137 "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
|
138 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
139 :group 'man) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
140 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
141 (defcustom Man-overstrike-face 'bold |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
142 "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
|
143 :type 'face |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
144 :group 'man) |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
145 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
146 (defcustom Man-underline-face 'underline |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
147 "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
|
148 :type 'face |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
149 :group 'man) |
6676
7251020c1c79
(manual-program): New (actually reintroduced) variable.
Karl Heuer <kwzh@gnu.org>
parents:
6613
diff
changeset
|
150 |
58742
03ba600130f8
(Man-reverse-face): Change default to `highlight'.
Richard M. Stallman <rms@gnu.org>
parents:
58690
diff
changeset
|
151 (defcustom Man-reverse-face 'highlight |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
152 "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
|
153 :type 'face |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
154 :group 'man) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
155 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
156 ;; Use the value of the obsolete user option Man-notify, if set. |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
157 (defcustom Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
158 "Selects the behavior when manpage is ready. |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
159 This variable may have one of the following values, where (sf) means |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
160 that the frames are switched, so the manpage is displayed in the frame |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
161 where the man command was called from: |
3235 | 162 |
4915
c0523a78e6a5
(Man-frame-parameters): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4444
diff
changeset
|
163 newframe -- put the manpage in its own frame (see `Man-frame-parameters') |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
164 pushy -- make the manpage the current buffer in the current window |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
165 bully -- make the manpage the current buffer and only window (sf) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
166 aggressive -- make the manpage the current buffer in the other window (sf) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
167 friendly -- display manpage in the other window but don't make current (sf) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
168 polite -- don't display manpage, but prints message and beep when ready |
3235 | 169 quiet -- like `polite', but don't beep |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
170 meek -- make no indication that the manpage is ready |
3235 | 171 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
172 Any other value of `Man-notify-method' is equivalent to `meek'." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
173 :type '(radio (const newframe) (const pushy) (const bully) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
174 (const aggressive) (const friendly) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
175 (const polite) (const quiet) (const meek)) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
176 :group 'man) |
3235 | 177 |
54515 | 178 (defcustom Man-width nil |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
179 "Number of columns for which manual pages should be formatted. |
54515 | 180 If nil, the width of the window selected at the moment of man |
181 invocation is used. If non-nil, the width of the frame selected | |
182 at the moment of man invocation is used. The value also can be a | |
183 positive integer." | |
184 :type '(choice (const :tag "Window width" nil) | |
185 (const :tag "Frame width" t) | |
186 (integer :tag "Specific width" :value 65)) | |
187 :group 'man) | |
188 | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
189 (defcustom Man-frame-parameters nil |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
190 "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
|
191 :type 'sexp |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
192 :group 'man) |
4915
c0523a78e6a5
(Man-frame-parameters): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4444
diff
changeset
|
193 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
194 (defcustom Man-downcase-section-letters-flag t |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
195 "Non-nil means letters in sections are converted to lower case. |
3235 | 196 Some Un*x man commands can't handle uppercase letters in sections, for |
197 example \"man 2V chmod\", but they are often displayed in the manpage | |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
198 with the upper case letter. When this variable is t, the section |
3235 | 199 letter (e.g., \"2V\") is converted to lowercase (e.g., \"2v\") before |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
200 being sent to the man background process." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
201 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
202 :group 'man) |
3235 | 203 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
204 (defcustom Man-circular-pages-flag t |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
205 "Non-nil means the manpage list is treated as circular for traversal." |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
206 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
207 :group 'man) |
3235 | 208 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
209 (defcustom Man-section-translations-alist |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
210 (list |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
211 '("3C++" . "3") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
212 ;; Some systems have a real 3x man section, so let's comment this. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
213 ;; '("3X" . "3") ; Xlib man pages |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
214 '("3X11" . "3") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
215 '("1-UCB" . "")) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
216 "Association list of bogus sections to real section numbers. |
3235 | 217 Some manpages (e.g. the Sun C++ 2.1 manpages) have section numbers in |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
218 their references which Un*x `man' does not recognize. This |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3307
diff
changeset
|
219 association list is used to translate those sections, when found, to |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
220 the associated section number." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
221 :type '(repeat (cons (string :tag "Bogus Section") |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
222 (string :tag "Real Section"))) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17132
diff
changeset
|
223 :group 'man) |
3235 | 224 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
225 (defcustom Man-header-file-path |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
226 '("/usr/include" "/usr/local/include") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
227 "C Header file search path used in Man." |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
228 :type '(repeat string) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
229 :group 'man) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
230 |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
231 (defvar manual-program "man" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
232 "The name of the program that produces man pages.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
233 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
234 (defvar Man-untabify-command "pr" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
235 "Command used for untabifying.") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
236 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
237 (defvar Man-untabify-command-args (list "-t" "-e") |
28102 | 238 "List of arguments to be passed to `Man-untabify-command' (which see).") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
239 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
240 (defvar Man-sed-command "sed" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
241 "Command used for processing sed scripts.") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
242 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
243 (defvar Man-awk-command "awk" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
244 "Command used for processing awk scripts.") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
245 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
246 (defvar Man-mode-hook nil |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
247 "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
|
248 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
249 (defvar Man-cooked-hook nil |
28102 | 250 "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
|
251 |
62878
6ad2cd812985
(Man-name-regexp): Add `:' to accept qualified names.
Juri Linkov <juri@jurta.org>
parents:
62736
diff
changeset
|
252 (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
|
253 "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
|
254 |
67300
d939be43ae67
(Man-section-regexp): Add 0-9 to support "3X11" sections.
Juri Linkov <juri@jurta.org>
parents:
67006
diff
changeset
|
255 (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
|
256 "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
|
257 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
258 (defvar Man-page-header-regexp |
23644
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
259 (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
|
260 (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
|
261 (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
|
262 "(\\(" Man-section-regexp "\\))\\)$") |
3d09886cb53e
(Man-page-header-regexp): Alternate value for Solaris 2.6.
Karl Heuer <kwzh@gnu.org>
parents:
23267
diff
changeset
|
263 (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
|
264 "(\\(" 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
|
265 "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
|
266 |
68222
c18c4be711f4
(Man-heading-regexp): Add `/'.
Juri Linkov <juri@jurta.org>
parents:
68151
diff
changeset
|
267 (defvar Man-heading-regexp "^\\([A-Z][A-Z /-]+\\)$" |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
268 "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
|
269 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
270 (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
|
271 "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
|
272 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
|
273 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
274 (defvar Man-first-heading-regexp "^[ \t]*NAME$\\|^[ \t]*No manual entry fo.*$" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
275 "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
|
276 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
|
277 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
278 (defvar Man-reference-regexp |
66729 | 279 (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
|
280 "Regular expression describing a reference to another manpage.") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
281 |
66729 | 282 (defvar Man-apropos-regexp |
283 (concat "\\\[\\(" Man-name-regexp "\\)\\\][ \t]*(\\(" Man-section-regexp "\\))") | |
284 "Regular expression describing a reference to manpages in \"man -k output\".") | |
285 | |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
286 (defvar Man-synopsis-regexp "SYNOPSIS" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
287 "Regular expression for SYNOPSIS heading (or your equivalent). |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
288 This regexp should not start with a `^' character.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
289 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
290 (defvar Man-files-regexp "FILES" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
291 "Regular expression for FILES heading (or your equivalent). |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
292 This regexp should not start with a `^' character.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
293 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
294 (defvar Man-include-regexp "#[ \t]*include[ \t]*" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
295 "Regular expression describing the #include (directive of cpp).") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
296 |
68151
8d679b71e742
(Man-file-name-regexp): Adjust for a list of files.
Nick Roberts <nickrob@snap.net.nz>
parents:
67300
diff
changeset
|
297 (defvar Man-file-name-regexp "[^<>\", \t\n]+" |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
298 "Regular expression describing <> in #include line (directive of cpp).") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
299 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
300 (defvar Man-normal-file-prefix-regexp "[/~$]" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
301 "Regular expression describing a file path appeared in FILES section.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
302 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
303 (defvar Man-header-regexp |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
304 (concat "\\(" Man-include-regexp "\\)" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
305 "[<\"]" |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
306 "\\(" Man-file-name-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 "Regular expression describing references to header files.") |
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 (defvar Man-normal-file-regexp |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
311 (concat Man-normal-file-prefix-regexp Man-file-name-regexp) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
312 "Regular expression describing references to normal files.") |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
313 |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
314 ;; 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
|
315 ;; refernces to manpages. |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
316 (defvar Man-hyphenated-reference-regexp |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
317 (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
|
318 "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
|
319 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
320 (defvar Man-switches "" |
38646
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
321 "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
|
322 |
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
323 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
|
324 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
|
325 |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
326 (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
|
327 (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
|
328 "-s" |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
329 "") |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
330 "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
|
331 |
54515 | 332 (defvar Man-support-local-filenames 'auto-detect |
333 "Internal cache for the value of the function `Man-support-local-filenames'. | |
334 `auto-detect' means the value is not yet determined. | |
335 Otherwise, the value is whatever the function | |
336 `Man-support-local-filenames' should return.") | |
337 | |
9726
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
338 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
51a9e9bc5fda
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
Francesco Potortì <pot@gnu.org>
parents:
9679
diff
changeset
|
339 ;; end user variables |
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 ;; other variables and keymap initializations |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
342 (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
|
343 (make-variable-buffer-local 'Man-original-frame) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
344 (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
|
345 (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
|
346 (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
|
347 |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
348 (defvar Man-sections-alist nil) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
349 (make-variable-buffer-local 'Man-sections-alist) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
350 (defvar Man-refpages-alist nil) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
351 (make-variable-buffer-local 'Man-refpages-alist) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
352 (defvar Man-page-list nil) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
353 (make-variable-buffer-local 'Man-page-list) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
354 (defvar Man-current-page 0) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
355 (make-variable-buffer-local 'Man-current-page) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
356 (defvar Man-page-mode-string "1 of 1") |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
357 (make-variable-buffer-local 'Man-page-mode-string) |
3235 | 358 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
359 (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
|
360 /\b/ { s/_\b//g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
361 s/\b_//g |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
362 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
|
363 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
|
364 :ovstrk |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
365 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
|
366 t ovstrk |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
367 } |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
368 /\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
|
369 "Script for sysV-like sed to nuke backspaces and ANSI codes from manpages.") |
3235 | 370 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
371 (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
|
372 /\b/ { s/_\b//g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
373 s/\b_//g\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
374 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
|
375 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
|
376 :ovstrk\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
377 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
|
378 t ovstrk\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
379 }\\ |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
380 /\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
|
381 "Script for berkeley-like sed to nuke backspaces and ANSI codes from manpages.") |
3235 | 382 |
72619
5dd4533a9a7e
(Man-topic-history): New variable.
Juri Linkov <juri@jurta.org>
parents:
69793
diff
changeset
|
383 (defvar Man-topic-history nil "Topic read history.") |
5dd4533a9a7e
(Man-topic-history): New variable.
Juri Linkov <juri@jurta.org>
parents:
69793
diff
changeset
|
384 |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
385 (defvar man-mode-syntax-table |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
386 (let ((table (copy-syntax-table (standard-syntax-table)))) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
387 (modify-syntax-entry ?. "w" table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
388 (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
|
389 (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
|
390 table) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
391 "Syntax table used in Man mode buffers.") |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
392 |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
393 (defvar Man-mode-map |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
394 (let ((map (make-sparse-keymap))) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
395 (suppress-keymap map) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
396 (set-keymap-parent map button-buffer-map) |
63336
423fcdb144f5
(Man-mode-map): Initialize it properly.
Lute Kamstra <lute@gnu.org>
parents:
62878
diff
changeset
|
397 |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
398 (define-key map " " 'scroll-up) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
399 (define-key map "\177" 'scroll-down) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
400 (define-key map "n" 'Man-next-section) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
401 (define-key map "p" 'Man-previous-section) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
402 (define-key map "\en" 'Man-next-manpage) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
403 (define-key map "\ep" 'Man-previous-manpage) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
404 (define-key map ">" 'end-of-buffer) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
405 (define-key map "<" 'beginning-of-buffer) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
406 (define-key map "." 'beginning-of-buffer) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
407 (define-key map "r" 'Man-follow-manual-reference) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
408 (define-key map "g" 'Man-goto-section) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
409 (define-key map "s" 'Man-goto-see-also-section) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
410 (define-key map "k" 'Man-kill) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
411 (define-key map "q" 'Man-quit) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
412 (define-key map "m" 'man) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
413 ;; 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
|
414 ;; manual page can contain references to other man pages |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
415 (define-key map "\r" 'man-follow) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
416 (define-key map "?" 'describe-mode) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
417 map) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
418 "Keymap for Man mode.") |
3235 | 419 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
420 ;; buttons |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
421 (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
|
422 'follow-link t |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
423 '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
|
424 'func nil |
74532
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
425 '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
|
426 |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
427 (defun Man-xref-button-action (button) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
428 (let ((target (button-get button 'Man-target-string))) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
429 (funcall |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
430 (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
|
431 (cond ((null target) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
432 (button-label button)) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
433 ((functionp target) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
434 (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
|
435 (t target))))) |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
436 |
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
437 (define-button-type 'Man-xref-man-page |
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
438 :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
|
439 'func 'man-follow) |
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
440 |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
441 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
442 (define-button-type 'Man-xref-header-file |
50418
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
443 'action (lambda (button) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
444 (let ((w (button-get button 'Man-target-string))) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
445 (unless (Man-view-header-file w) |
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
446 (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
|
447 'follow-link t |
50418
b2939c93b5f7
Fix previous change.
Juanma Barranquero <lekktu@gmail.com>
parents:
50403
diff
changeset
|
448 'help-echo "mouse-2: display this header file") |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
449 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
450 (define-button-type 'Man-xref-normal-file |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
451 'action (lambda (button) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
452 (let ((f (substitute-in-file-name |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
453 (button-get button 'Man-target-string)))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
454 (if (file-exists-p f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
455 (if (file-readable-p f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
456 (view-file f) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
457 (error "Cannot read a file: %s" f)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
458 (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
|
459 'follow-link t |
57817 | 460 'help-echo "mouse-2: display this file") |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
461 |
3235 | 462 |
463 ;; ====================================================================== | |
464 ;; utilities | |
465 | |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
466 (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
|
467 "Used for initializing variables based on display's color support. |
28102 | 468 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
|
469 |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
470 ;; 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
|
471 (let ((default-directory "/")) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
472 (setq Man-sed-script |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
473 (cond |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
474 (Man-fontify-manpage-flag |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
475 nil) |
53477
79093b308520
* progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents:
52636
diff
changeset
|
476 ((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
|
477 Man-sysv-sed-script) |
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-berkeley-sed-script)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
479 Man-berkeley-sed-script) |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
480 (t |
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
481 nil)))) |
3235 | 482 |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
483 (setq Man-filter-list |
23267
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
484 ;; Avoid trailing nil which confuses customize. |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
485 (apply 'list |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
486 (cons |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
487 Man-sed-command |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
488 (list |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
489 (if Man-sed-script |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
490 (concat "-e '" Man-sed-script "'") |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
491 "") |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
492 "-e '/^[\001-\032][\001-\032]*$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
493 "-e '/\e[789]/s///g'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
494 "-e '/Reformatting page. Wait/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
495 "-e '/Reformatting entry. Wait/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
496 "-e '/^[ \t]*Hewlett-Packard[ \t]Company[ \t]*-[ \t][0-9]*[ \t]-/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
497 "-e '/^[ \t]*Hewlett-Packard[ \t]*-[ \t][0-9]*[ \t]-.*$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
498 "-e '/^[ \t][ \t]*-[ \t][0-9]*[ \t]-[ \t]*Formatted:.*[0-9]$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
499 "-e '/^[ \t]*Page[ \t][0-9]*.*(printed[ \t][0-9\\/]*)$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
500 "-e '/^Printed[ \t][0-9].*[0-9]$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
501 "-e '/^[ \t]*X[ \t]Version[ \t]1[01].*Release[ \t][0-9]/d'" |
16974
f4eb94106c89
(Man-init-defvars): Fix case in a char set range.
Richard M. Stallman <rms@gnu.org>
parents:
16973
diff
changeset
|
502 "-e '/^[A-Za-z].*Last[ \t]change:/d'" |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
503 "-e '/^Sun[ \t]Release[ \t][0-9].*[0-9]$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
504 "-e '/[ \t]*Copyright [0-9]* UNIX System Laboratories, Inc.$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
505 "-e '/^[ \t]*Rev\\..*Page [0-9][0-9]*$/d'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
506 )) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
507 (cons |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
508 Man-awk-command |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
509 (list |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
510 "'\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
511 "BEGIN { blankline=0; anonblank=0; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
512 "/^$/ { if (anonblank==0) next; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
513 "{ anonblank=1; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
514 "/^$/ { blankline++; next; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
515 "{ if (blankline>0) { print \"\"; blankline=0; } print $0; }\n" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
516 "'" |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
517 )) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
518 (if (not Man-uses-untabify-flag) |
23267
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
519 ;; 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
|
520 (list (cons |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
521 Man-untabify-command |
a804a047b23d
(Man-init-defvars): Avoid trailing nil on
Andreas Schwab <schwab@suse.de>
parents:
22368
diff
changeset
|
522 Man-untabify-command-args)) |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
523 ))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
524 ) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
525 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
526 (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
|
527 "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
|
528 (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
|
529 (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
|
530 "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
531 Man-current-page |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
532 (length Man-page-list))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
533 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
534 (defsubst Man-build-man-command () |
3235 | 535 "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
|
536 (let ((command (concat manual-program " " Man-switches |
54515 | 537 (cond |
538 ;; Already has %s | |
539 ((string-match "%s" manual-program) "") | |
540 ;; Stock MS-DOS shells cannot redirect stderr; | |
541 ;; `call-process' below sends it to /dev/null, | |
542 ;; so we don't need `2>' even with DOS shells | |
543 ;; which do support stderr redirection. | |
544 ((not (fboundp 'start-process)) " %s") | |
545 ((concat " %s 2>" null-device))))) | |
3235 | 546 (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
|
547 (while (and flist (car flist)) |
3235 | 548 (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
|
549 (pargs (cdr (car flist)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
550 (setq command |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
551 (concat command " | " pcom " " |
29585
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
552 (mapconcat (lambda (phrase) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
553 (if (not (stringp phrase)) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
554 (error "Malformed Man-filter-list")) |
d3e3a9663705
(Man-build-man-command): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29525
diff
changeset
|
555 phrase) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
556 pargs " "))) |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
557 (setq flist (cdr flist)))) |
3235 | 558 command)) |
559 | |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
560 |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
561 (defun Man-translate-cleanup (string) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
562 "Strip leading, trailing and middle spaces." |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
563 (when (stringp string) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
564 ;; Strip leading and trailing |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
565 (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
|
566 (setq string (match-string 1 string))) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
567 ;; middle spaces |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
568 (setq string (replace-regexp-in-string "[\t\r\n]" " " string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
569 (setq string (replace-regexp-in-string " +" " " string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
570 string)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
571 |
3235 | 572 (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
|
573 "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
|
574 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
|
575 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
|
576 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
|
577 (let ((name "") |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
578 (section "") |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
579 (slist Man-section-translations-alist)) |
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
580 (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
|
581 (cond |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
582 ;; "chmod(2V)" case ? |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
583 ((string-match (concat "^" Man-reference-regexp "$") ref) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
584 (setq name (match-string 1 ref) |
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
585 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
|
586 ;; "2v chmod" case ? |
12809
c388f6f7f210
* man.el (Man-translate-references): Anchor the regexps.
Francesco Potortì <pot@gnu.org>
parents:
12457
diff
changeset
|
587 ((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
|
588 "\\) +\\(" Man-name-regexp "\\)$") ref) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
589 (setq name (match-string 2 ref) |
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
590 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
|
591 (if (string= name "") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
592 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
|
593 (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
|
594 (setq section (downcase section))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
595 (while slist |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
596 (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
|
597 (s2 (cdr (car slist)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
598 (setq slist (cdr slist)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
599 (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
|
600 (setq s1 (downcase s1))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
601 (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
|
602 (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
|
603 (downcase s2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
604 s2) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
605 slist nil)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
606 (concat Man-specified-section-option section " " name)))) |
3235 | 607 |
54515 | 608 (defun Man-support-local-filenames () |
609 "Check the availability of `-l' option of the man command. | |
610 This option allows `man' to interpret command line arguments | |
611 as local filenames. | |
612 Return the value of the variable `Man-support-local-filenames' | |
613 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
|
614 If t, the man command supports `-l' option. If nil, it doesn't. |
54515 | 615 Otherwise, if the value of `Man-support-local-filenames' |
616 is neither t nor nil, then determine a new value, set it | |
617 to the variable `Man-support-local-filenames' and return | |
618 a new value." | |
619 (if (or (not Man-support-local-filenames) | |
620 (eq Man-support-local-filenames t)) | |
621 Man-support-local-filenames | |
622 (setq Man-support-local-filenames | |
623 (with-temp-buffer | |
624 (and (equal (condition-case nil | |
76691
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
625 (let ((default-directory |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
626 ;; Assure that `default-directory' exists |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
627 ;; and is readable. |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
628 (if (and (file-directory-p default-directory) |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
629 (file-readable-p default-directory)) |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
630 default-directory |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
631 (expand-file-name "~/")))) |
9522301cee68
(Man-support-local-filenames): Assure that
Martin Rudalics <rudalics@gmx.at>
parents:
75347
diff
changeset
|
632 (call-process manual-program nil t nil "--help")) |
54515 | 633 (error nil)) |
634 0) | |
635 (progn | |
636 (goto-char (point-min)) | |
637 (search-forward "--local-file" nil t)) | |
638 t))))) | |
639 | |
3235 | 640 |
641 ;; ====================================================================== | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
642 ;; default man entry: get word under point |
3235 | 643 |
74532
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
644 (defsubst Man-default-man-entry (&optional pos) |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
645 "Make a guess at a default manual entry based on the text at POS. |
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
646 If POS is nil, the current point is used." |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
647 (let (word) |
3235 | 648 (save-excursion |
74532
2acf2de66673
(Man-xref-button-action): New function. If the `Man-target-string'
Chong Yidong <cyd@stupidchicken.com>
parents:
72619
diff
changeset
|
649 (if pos (goto-char pos)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
650 ;; Default man entry title is any word the cursor is on, or if |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
651 ;; cursor not on a word, then nearest preceding word. |
48012
73c9cc6e8538
(Man-default-man-entry): Don't look for all word chars,
Richard M. Stallman <rms@gnu.org>
parents:
47891
diff
changeset
|
652 (skip-chars-backward "-a-zA-Z0-9._+:") |
73c9cc6e8538
(Man-default-man-entry): Don't look for all word chars,
Richard M. Stallman <rms@gnu.org>
parents:
47891
diff
changeset
|
653 (let ((start (point))) |
73c9cc6e8538
(Man-default-man-entry): Don't look for all word chars,
Richard M. Stallman <rms@gnu.org>
parents:
47891
diff
changeset
|
654 (skip-chars-forward "-a-zA-Z0-9._+:") |
52324
c97fe9557de4
(Man-default-man-entry): Strip text properties when
John Paul Wallington <jpw@pobox.com>
parents:
51892
diff
changeset
|
655 (setq word (buffer-substring-no-properties start (point)))) |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
656 (if (string-match "[._]+$" word) |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
657 (setq word (substring word 0 (match-beginning 0)))) |
52636
87642088b41e
(Man-default-man-entry): Remove the leading `*' from the word at point.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
658 ;; If looking at something like *strcat(... , remove the '*' |
87642088b41e
(Man-default-man-entry): Remove the leading `*' from the word at point.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
659 (if (string-match "^*" word) |
87642088b41e
(Man-default-man-entry): Remove the leading `*' from the word at point.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
660 (setq word (substring word 1))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
661 ;; If looking at something like ioctl(2) or brc(1M), include the |
10642
0e6b71f2ebad
* man.el (Man-default-man-entry): Remove text properties from result.
Francesco Potortì <pot@gnu.org>
parents:
10040
diff
changeset
|
662 ;; section number in the returned value. Remove text properties. |
52324
c97fe9557de4
(Man-default-man-entry): Strip text properties when
John Paul Wallington <jpw@pobox.com>
parents:
51892
diff
changeset
|
663 (concat word |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
664 (if (looking-at |
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
665 (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)")) |
52324
c97fe9557de4
(Man-default-man-entry): Strip text properties when
John Paul Wallington <jpw@pobox.com>
parents:
51892
diff
changeset
|
666 (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
|
667 |
3235 | 668 |
669 ;; ====================================================================== | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
670 ;; Top level command and background process sentinel |
3235 | 671 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
672 ;; For compatibility with older versions. |
4444 | 673 ;;;###autoload |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
674 (defalias 'manual-entry 'man) |
4444 | 675 |
51892
3146f91c8c99
(Man-translate-cleanup): New.
Juanma Barranquero <lekktu@gmail.com>
parents:
51803
diff
changeset
|
676 |
3235 | 677 ;;;###autoload |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
678 (defun man (man-args) |
3235 | 679 "Get a Un*x manual page and put it in a buffer. |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
680 This command is the top-level command in the man package. It runs a Un*x |
3235 | 681 command to retrieve and clean a manpage in the background and places the |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
682 results in a Man mode (manpage browsing) buffer. See variable |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
683 `Man-notify-method' for what happens when the buffer is ready. |
29838 | 684 If a buffer already exists for this man page, it will display immediately. |
685 | |
686 To specify a man page from a certain section, type SUBJECT(SECTION) or | |
38646
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
687 SECTION SUBJECT when prompted for a manual entry. To see manpages from |
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
688 all sections related to a subject, put something appropriate into the |
5236fd76fef0
(man): Mention Man-switches in the doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
38412
diff
changeset
|
689 `Man-switches' variable, which see." |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
690 (interactive |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
691 (list (let* ((default-entry (Man-default-man-entry)) |
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
692 (input (read-string |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
693 (format "Manual entry%s" |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
694 (if (string= default-entry "") |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
695 ": " |
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
696 (format " (default %s): " default-entry))) |
72619
5dd4533a9a7e
(Man-topic-history): New variable.
Juri Linkov <juri@jurta.org>
parents:
69793
diff
changeset
|
697 nil 'Man-topic-history default-entry))) |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
698 (if (string= input "") |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
699 (error "No man args given") |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
700 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
|
701 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
702 ;; 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
|
703 ;; "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
|
704 (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
|
705 |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
706 (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
|
707 |
17129 | 708 ;;;###autoload |
709 (defun man-follow (man-args) | |
710 "Get a Un*x manual page of the item under point and put it in a buffer." | |
711 (interactive (list (Man-default-man-entry))) | |
712 (if (or (not man-args) | |
713 (string= man-args "")) | |
714 (error "No item under point") | |
715 (man man-args))) | |
3235 | 716 |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
717 (defun Man-getpage-in-background (topic) |
28102 | 718 "Use TOPIC to build and fire off the manpage and cleaning command." |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
719 (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
|
720 (bufname (concat "*Man " man-args "*")) |
3235 | 721 (buffer (get-buffer bufname))) |
9828
e78a12b9ef41
* man.el (Man-reuse-okay-flag): Deleted.
Francesco Potortì <pot@gnu.org>
parents:
9726
diff
changeset
|
722 (if buffer |
3235 | 723 (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
|
724 (require 'env) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
725 (message "Invoking %s %s in the background" manual-program man-args) |
3235 | 726 (setq buffer (generate-new-buffer bufname)) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
727 (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
|
728 (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
|
729 (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
|
730 (setq Man-arguments man-args)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
731 (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
|
732 ;; 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
|
733 ;; 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
|
734 (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
|
735 ;; We must decode the output by a coding system that the |
32495 | 736 ;; 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
|
737 (coding-system-for-read |
b68d86c19284
(Man-getpage-in-background): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
31005
diff
changeset
|
738 (if default-enable-multibyte-characters |
b68d86c19284
(Man-getpage-in-background): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
31005
diff
changeset
|
739 locale-coding-system 'raw-text-unix)) |
20266
450fdcb00733
(Man-init-defvars, Man-build-man-command):
Karl Heuer <kwzh@gnu.org>
parents:
20154
diff
changeset
|
740 ;; 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
|
741 (default-directory |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
742 (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
|
743 (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
|
744 'file-directory-p))) |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
745 default-directory |
a323f25ec045
(Man-getpage-in-background): Only change
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49597
diff
changeset
|
746 "/"))) |
3713
c77a3da2d08d
(Man-getpage-in-background): Use TERM=dumb to prevent
Richard M. Stallman <rms@gnu.org>
parents:
3659
diff
changeset
|
747 ;; 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
|
748 (setenv "TERM" "dumb") |
47891
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
749 ;; 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
|
750 ;; 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
|
751 ;; a tty. man(1) says: |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
752 ;; MANWIDTH |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
753 ;; 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
|
754 ;; 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
|
755 ;; 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
|
756 ;; 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
|
757 ;; 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
|
758 ;; $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
|
759 ;; ther is available). |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
760 (if window-system |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
761 (unless (or (getenv "MANWIDTH") (getenv "COLUMNS")) |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
762 ;; This isn't strictly correct, since we don't know how |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
763 ;; the page will actually be displayed, but it seems |
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
764 ;; reasonable. |
54515 | 765 (setenv "COLUMNS" (number-to-string |
766 (cond | |
767 ((and (integerp Man-width) (> Man-width 0)) | |
768 Man-width) | |
769 (Man-width (frame-width)) | |
770 ((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
|
771 (setenv "GROFF_NO_SGR" "1") |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
772 (if (fboundp 'start-process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
773 (set-process-sentinel |
55527
4729059e27b8
(Man-getpage-in-background): Use shell-file-name
Eli Zaretskii <eliz@gnu.org>
parents:
54515
diff
changeset
|
774 (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
|
775 (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
|
776 shell-file-name |
060e08bf63fe
(Man-getpage-in-background): Add windows-nt to the list
Eli Zaretskii <eliz@gnu.org>
parents:
56159
diff
changeset
|
777 "sh") |
56159
8fd93d7de209
(Man-getpage-in-background): Revert previous change but
Nick Roberts <nickrob@snap.net.nz>
parents:
55527
diff
changeset
|
778 shell-command-switch |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
779 (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
|
780 '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
|
781 (let ((exit-status |
55527
4729059e27b8
(Man-getpage-in-background): Use shell-file-name
Eli Zaretskii <eliz@gnu.org>
parents:
54515
diff
changeset
|
782 (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
|
783 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
|
784 (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
|
785 (msg "")) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
786 (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
|
787 (= 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
|
788 (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
|
789 (setq msg |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
790 (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
|
791 exit-status))) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
792 (setq msg exit-status)) |
b43d8c1413de
* man.el (Man-getpage-in-background): Always use `setenv' for
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50054
diff
changeset
|
793 (Man-bgproc-sentinel bufname msg))))))) |
3235 | 794 |
795 (defun Man-notify-when-ready (man-buffer) | |
796 "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
|
797 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
|
798 (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
|
799 Man-original-frame))) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
800 (cond |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
801 ((eq Man-notify-method 'newframe) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
802 ;; 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
|
803 ;; 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
|
804 ;; 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
|
805 ;; 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
|
806 (save-excursion |
21581
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
807 (let ((frame (make-frame Man-frame-parameters))) |
3aad7ffd0cd3
(Man-notify-when-ready) <newframe>:
Richard M. Stallman <rms@gnu.org>
parents:
21433
diff
changeset
|
808 (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
|
809 (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
|
810 (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
|
811 (select-frame frame))))) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
812 ((eq Man-notify-method 'pushy) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
813 (switch-to-buffer man-buffer)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
814 ((eq Man-notify-method 'bully) |
29973
be9760ddad44
(Man-notify-when-ready): Don't use window-system. If
Eli Zaretskii <eliz@gnu.org>
parents:
29838
diff
changeset
|
815 (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
|
816 (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
|
817 (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
|
818 (delete-other-windows)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
819 ((eq Man-notify-method 'aggressive) |
29973
be9760ddad44
(Man-notify-when-ready): Don't use window-system. If
Eli Zaretskii <eliz@gnu.org>
parents:
29838
diff
changeset
|
820 (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
|
821 (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
|
822 (pop-to-buffer man-buffer)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
823 ((eq Man-notify-method 'friendly) |
29973
be9760ddad44
(Man-notify-when-ready): Don't use window-system. If
Eli Zaretskii <eliz@gnu.org>
parents:
29838
diff
changeset
|
824 (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
|
825 (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
|
826 (display-buffer man-buffer 'not-this-window)) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
827 ((eq Man-notify-method 'polite) |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
828 (beep) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
829 (message "Manual buffer %s is ready" (buffer-name man-buffer))) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
830 ((eq Man-notify-method 'quiet) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
831 (message "Manual buffer %s is ready" (buffer-name man-buffer))) |
9003
bfe446409b77
User option Man-notify-flag renamed to Man-notify-method.
Francesco Potortì <pot@gnu.org>
parents:
8970
diff
changeset
|
832 ((or (eq Man-notify-method 'meek) |
8697
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
833 t) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
834 (message "")) |
c75e435af62f
(Man-notify-when-ready): Get Man-original-frame from the proper buffer.
Richard M. Stallman <rms@gnu.org>
parents:
8190
diff
changeset
|
835 ))) |
3235 | 836 |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
837 (defun Man-softhyphen-to-minus () |
47891
e7440f7b0700
(Man-getpage-in-background): Set width in environment.
Dave Love <fx@gnu.org>
parents:
42706
diff
changeset
|
838 ;; \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
|
839 ;; 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
|
840 (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
|
841 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
|
842 (goto-char (point-min)) |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
843 (let ((str "\255")) |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
844 (if enable-multibyte-characters |
abd64c56891f
(Man-softhyphen-to-minus): Revert previous change. Avoid unibyte to
Dave Love <fx@gnu.org>
parents:
25201
diff
changeset
|
845 (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
|
846 (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
|
847 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
848 (defun Man-fontify-manpage () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
849 "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
|
850 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
|
851 (interactive) |
54515 | 852 (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
|
853 (goto-char (point-min)) |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
854 ;; Fontify ANSI escapes. |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
855 (let ((faces nil) |
59362
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
856 (buffer-undo-list t) |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
857 (start (point))) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
858 ;; 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
|
859 ;; 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
|
860 ;; 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
|
861 ;; ESC [ 01 m bold |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
862 ;; ESC [ 04 m underline |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
863 ;; ESC [ 07 m reverse-video |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
864 ;; ESC [ 22 m no-bold |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
865 ;; ESC [ 24 m no-underline |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
866 ;; 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
|
867 (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
|
868 (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
|
869 (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
|
870 (setq faces |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
871 (cond |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
872 ((match-beginning 2) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
873 (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
|
874 (?2 Man-overstrike-face) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
875 (?4 Man-underline-face) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
876 (?7 Man-reverse-face)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
877 faces)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
878 ((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
|
879 (t |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
880 (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
|
881 (?1 Man-overstrike-face) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
882 (?4 Man-underline-face) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
883 (?7 Man-reverse-face)) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
884 faces)))) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
885 (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
|
886 (setq start (point)))) |
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
887 ;; Other highlighting. |
59362
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
888 (let ((buffer-undo-list t)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
889 (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
|
890 ;; Multibyte characters exist. |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
891 (progn |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
892 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
893 (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
|
894 (backward-delete-char 4) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
895 (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
|
896 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
897 (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
|
898 (backward-delete-char 4) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
899 (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
|
900 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
901 (while (search-forward "_\b" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
902 (backward-delete-char 2) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
903 (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
|
904 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
905 (while (search-forward "\b_" nil t) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
906 (backward-delete-char 2) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
907 (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
|
908 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
909 (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
|
910 (replace-match "\\1") |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
911 (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
|
912 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
913 (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
|
914 (replace-match "o") |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
915 (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
|
916 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
917 (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
|
918 (replace-match "+") |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
919 (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
|
920 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
921 ;; 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
|
922 (Man-highlight-references) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
923 (Man-softhyphen-to-minus) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
924 (goto-char (point-min)) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
925 (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
|
926 (put-text-property (match-beginning 0) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
927 (match-end 0) |
07f5b835edb6
(Man-fontify-manpage): Turn off undo generation.
Richard M. Stallman <rms@gnu.org>
parents:
58742
diff
changeset
|
928 'face Man-overstrike-face))) |
53690
f428900fb582
(Man-fontify-manpage): Clean up message.
Richard M. Stallman <rms@gnu.org>
parents:
53477
diff
changeset
|
929 (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
|
930 |
66177
bd98d8a37303
* woman.el (WoMan-xref-man-page): New button type derived
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
931 (defun Man-highlight-references (&optional xref-man-type) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
932 "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
|
933 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
|
934 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
|
935 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
|
936 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
|
937 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
|
938 ;; `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
|
939 ;; woman.el doesn't set `Man-arguments'. |
9a04e09eb6c9
(Man-highlight-references): Set an empty
Masatake YAMATO <jet@gyve.org>
parents:
66729
diff
changeset
|
940 (unless Man-arguments |
9a04e09eb6c9
(Man-highlight-references): Set an empty
Masatake YAMATO <jet@gyve.org>
parents:
66729
diff
changeset
|
941 (setq Man-arguments "")) |
66729 | 942 (if (string-match "-k " Man-arguments) |
943 (progn | |
69793
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
944 (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
|
945 '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
|
946 (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
|
947 (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
|
948 '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
|
949 (or xref-man-type 'Man-xref-man-page))) |
69793
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
950 (Man-highlight-references0 Man-see-also-regexp Man-reference-regexp 1 |
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
951 '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
|
952 (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
|
953 (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
|
954 '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
|
955 (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
|
956 'Man-xref-normal-file))) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
957 |
66729 | 958 (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
|
959 ;; Based on `Man-build-references-alist' |
66729 | 960 (when (or (null start-section) |
961 (Man-find-section start-section)) | |
962 (let ((end (if start-section | |
963 (progn | |
964 (forward-line 1) | |
965 (back-to-indentation) | |
966 (save-excursion | |
967 (Man-next-section 1) | |
968 (point))) | |
969 (goto-char (point-min)) | |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
970 nil))) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
971 (while (re-search-forward regexp end t) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
972 (make-text-button |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
973 (match-beginning button-pos) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
974 (match-end button-pos) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
975 'type type |
66729 | 976 'Man-target-string (cond |
977 ((numberp target) | |
978 (match-string target)) | |
979 ((functionp target) | |
69793
93d87ad179a4
* man.el (Man-mode-map): Restore the \r binding.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
68651
diff
changeset
|
980 target) |
66729 | 981 (t nil))))))) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
982 |
57699
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
983 (defun Man-cleanup-manpage (&optional interactive) |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
984 "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
|
985 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
|
986 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
|
987 script would have done them." |
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
988 (interactive "p") |
9620
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
989 (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
|
990 Man-arguments) |
57699
f633084f70ae
(Man-cleanup-manpage): Instead of interactive-p,
Richard M. Stallman <rms@gnu.org>
parents:
56254
diff
changeset
|
991 (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
|
992 (progn |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
993 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
994 (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
|
995 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
996 (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
|
997 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
998 (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
|
999 (replace-match "\\1")) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1000 (goto-char (point-min)) |
1f58befcd1f1
* man.el (Man-init-defvars): Corrections to Man-filter-list.
Francesco Potortì <pot@gnu.org>
parents:
9354
diff
changeset
|
1001 (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
|
1002 (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
|
1003 (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
|
1004 )) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1005 (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
|
1006 (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) (replace-match "+")) |
20154
d0550e30957c
(Man-getpage-in-background): Bind inhibit-eol-conversion
Kenichi Handa <handa@m17n.org>
parents:
17436
diff
changeset
|
1007 (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
|
1008 (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
|
1009 |
3235 | 1010 (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
|
1011 "Manpage background process sentinel. |
28102 | 1012 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
|
1013 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
|
1014 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
|
1015 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
|
1016 manpage command." |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1017 (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
|
1018 (process-buffer process))) |
3235 | 1019 (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
|
1020 (err-mess nil)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1021 |
3235 | 1022 (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
|
1023 (or (stringp process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1024 (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
|
1025 |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1026 (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
|
1027 (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
|
1028 (goto-char (point-min)) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1029 (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
|
1030 (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
|
1031 (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
|
1032 (progn |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1033 (end-of-line) (point))) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1034 delete-buff t)) |
16973
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1035 ((or (stringp process) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1036 (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
|
1037 (= (process-exit-status process) 0)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1038 (or (zerop (length msg)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1039 (progn |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1040 (setq err-mess |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1041 (concat (buffer-name Man-buffer) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1042 ": process " |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1043 (let ((eos (1- (length msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1044 (if (= (aref msg eos) ?\n) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1045 (substring msg 0 eos) msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1046 (goto-char (point-max)) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1047 (insert (format "\nprocess %s" msg)))) |
39569e1b84b2
(Man-build-man-command): When async processes aren't
Eli Zaretskii <eliz@gnu.org>
parents:
16509
diff
changeset
|
1048 )) |
16509
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1049 (if delete-buff |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1050 (kill-buffer Man-buffer) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1051 (if Man-fontify-manpage-flag |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1052 (Man-fontify-manpage) |
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1053 (Man-cleanup-manpage)) |
64620
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1054 |
16509
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1055 (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
|
1056 (Man-mode) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1057 |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1058 (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
|
1059 (let ((args Man-arguments)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1060 (kill-buffer (current-buffer)) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1061 (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
|
1062 |
16509
75d463b202b5
(Man-bgproc-sentinel): Move the buffer creation
Richard M. Stallman <rms@gnu.org>
parents:
14733
diff
changeset
|
1063 (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
|
1064 )) |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1065 ;; 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
|
1066 ;; Man-notify-when-ready because it may switch buffers. |
3235 | 1067 |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1068 (if (not delete-buff) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1069 (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
|
1070 |
10040
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1071 (if err-mess |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1072 (error err-mess)) |
c69ddd9fa3a6
(Man-bgproc-sentinel): No need for save-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
9867
diff
changeset
|
1073 )))) |
3235 | 1074 |
1075 | |
1076 ;; ====================================================================== | |
1077 ;; set up manual mode in buffer and build alists | |
1078 | |
63336
423fcdb144f5
(Man-mode-map): Initialize it properly.
Lute Kamstra <lute@gnu.org>
parents:
62878
diff
changeset
|
1079 (put 'Man-mode 'mode-class 'special) |
423fcdb144f5
(Man-mode-map): Initialize it properly.
Lute Kamstra <lute@gnu.org>
parents:
62878
diff
changeset
|
1080 |
3235 | 1081 (defun Man-mode () |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
1082 "A mode for browsing Un*x manual pages. |
3235 | 1083 |
28102 | 1084 The following man commands are available in the buffer. Try |
3235 | 1085 \"\\[describe-key] <key> RET\" for more information: |
1086 | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1087 \\[man] Prompt to retrieve a new manpage. |
3235 | 1088 \\[Man-follow-manual-reference] Retrieve reference in SEE ALSO section. |
1089 \\[Man-next-manpage] Jump to next manpage in circular list. | |
1090 \\[Man-previous-manpage] Jump to previous manpage in circular list. | |
1091 \\[Man-next-section] Jump to next manpage section. | |
1092 \\[Man-previous-section] Jump to previous manpage section. | |
1093 \\[Man-goto-section] Go to a manpage section. | |
1094 \\[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
|
1095 \\[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
|
1096 \\[Man-kill] Deletes the manpage window, kill its buffer. |
3235 | 1097 \\[describe-mode] Prints this help text. |
1098 | |
28102 | 1099 The following variables may be of some use. Try |
3235 | 1100 \"\\[describe-variable] <variable-name> RET\" for more information: |
1101 | |
28102 | 1102 `Man-notify-method' What happens when manpage formatting is done. |
1103 `Man-downcase-section-letters-flag' Force section letters to lower case. | |
1104 `Man-circular-pages-flag' Treat multiple manpage list as circular. | |
1105 `Man-section-translations-alist' List of section numbers and their Un*x equiv. | |
1106 `Man-filter-list' Background manpage filter command. | |
1107 `Man-mode-map' Keymap bindings for Man mode buffers. | |
1108 `Man-mode-hook' Normal hook run on entry to Man mode. | |
1109 `Man-section-regexp' Regexp describing manpage section letters. | |
1110 `Man-heading-regexp' Regexp describing section headers. | |
1111 `Man-see-also-regexp' Regexp for SEE ALSO section (or your equiv). | |
1112 `Man-first-heading-regexp' Regexp for first heading on a manpage. | |
1113 `Man-reference-regexp' Regexp matching a references in SEE ALSO. | |
1114 `Man-switches' Background `man' command switches. | |
3235 | 1115 |
1116 The following key bindings are currently in effect in the buffer: | |
1117 \\{Man-mode-map}" | |
1118 (interactive) | |
62736
76864fc0acf0
(Man-mode): Use kill-all-local-variables and run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
61889
diff
changeset
|
1119 (kill-all-local-variables) |
3235 | 1120 (setq major-mode 'Man-mode |
3909
192e7aa8389a
(Man-auto-section-alist): Default value nil.
Richard M. Stallman <rms@gnu.org>
parents:
3833
diff
changeset
|
1121 mode-name "Man" |
3235 | 1122 buffer-auto-save-file-name nil |
38970
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1123 mode-line-buffer-identification |
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1124 (list (default-value 'mode-line-buffer-identification) |
e144797b4ece
(Man-mode-line-format): Variable removed.
Miles Bader <miles@gnu.org>
parents:
38646
diff
changeset
|
1125 " {" 'Man-page-mode-string "}") |
3235 | 1126 truncate-lines t |
1127 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
|
1128 (buffer-disable-undo) |
3235 | 1129 (auto-fill-mode -1) |
1130 (use-local-map Man-mode-map) | |
17132
07c01fa1e7fc
(man-mode-syntax-table): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17129
diff
changeset
|
1131 (set-syntax-table man-mode-syntax-table) |
54515 | 1132 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) |
1133 (set (make-local-variable 'outline-regexp) Man-heading-regexp) | |
1134 (set (make-local-variable 'outline-level) (lambda () 1)) | |
3235 | 1135 (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
|
1136 (Man-strip-page-headers) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1137 (Man-unindent) |
64620
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1138 (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
|
1139 (run-mode-hooks 'Man-mode-hook)) |
3235 | 1140 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1141 (defsubst Man-build-section-alist () |
3235 | 1142 "Build the association list of manpage sections." |
1143 (setq Man-sections-alist nil) | |
1144 (goto-char (point-min)) | |
7450 | 1145 (let ((case-fold-search nil)) |
1146 (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
|
1147 (aput 'Man-sections-alist (match-string 1)) |
7450 | 1148 (forward-line 1)))) |
3235 | 1149 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1150 (defsubst Man-build-references-alist () |
3235 | 1151 "Build the association list of references (in the SEE ALSO section)." |
1152 (setq Man-refpages-alist nil) | |
1153 (save-excursion | |
1154 (if (Man-find-section Man-see-also-regexp) | |
1155 (let ((start (progn (forward-line 1) (point))) | |
1156 (end (progn | |
1157 (Man-next-section 1) | |
1158 (point))) | |
1159 hyphenated | |
1160 (runningpoint -1)) | |
7450 | 1161 (save-restriction |
1162 (narrow-to-region start end) | |
1163 (goto-char (point-min)) | |
1164 (back-to-indentation) | |
1165 (while (and (not (eobp)) (/= (point) runningpoint)) | |
1166 (setq runningpoint (point)) | |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1167 (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
|
1168 (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
|
1169 (len (1- (length word)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1170 (if hyphenated |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1171 (setq word (concat hyphenated word) |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1172 hyphenated nil |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1173 ;; Update len, in case a reference spans |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1174 ;; more than two lines (paranoia). |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1175 len (1- (length word)))) |
51376
ec20af5e04b3
(Man-name-regexp): Also match Latin-1 soft hyphen.
Andreas Schwab <schwab@suse.de>
parents:
50602
diff
changeset
|
1176 (if (memq (aref word len) '(?- ?)) |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1177 (setq hyphenated (substring word 0 len))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1178 (if (string-match Man-reference-regexp word) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1179 (aput 'Man-refpages-alist word)))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1180 (skip-chars-forward " \t\n,")))))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1181 (setq Man-refpages-alist (nreverse Man-refpages-alist))) |
3235 | 1182 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1183 (defun Man-build-page-list () |
3235 | 1184 "Build the list of separate manpages in the buffer." |
1185 (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
|
1186 (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
|
1187 (page-end (point-max)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1188 (header "")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1189 (goto-char page-start) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1190 ;; (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
|
1191 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1192 (setq header |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1193 (if (looking-at Man-page-header-regexp) |
41698
722fe545e535
(man-follow-mouse): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38970
diff
changeset
|
1194 (match-string 1) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1195 nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1196 ;; 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
|
1197 (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
|
1198 (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
|
1199 ;; 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
|
1200 ;; 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
|
1201 ;; 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
|
1202 ;; 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
|
1203 ;; previous page header. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1204 (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
|
1205 (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
|
1206 (beginning-of-line)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1207 (setq page-end (point)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1208 (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
|
1209 (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
|
1210 (copy-marker page-end) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1211 header)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1212 (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
|
1213 ))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1214 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1215 (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
|
1216 "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
|
1217 (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
|
1218 (case-fold-search nil) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1219 (header "")) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1220 (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
|
1221 (and (nth 2 page) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1222 (goto-char (car page)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1223 (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
|
1224 (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
|
1225 ;; 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
|
1226 ;; 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
|
1227 ;; 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
|
1228 ;; 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
|
1229 ;; 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
|
1230 ;; 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
|
1231 ;; line. |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1232 ;; (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
|
1233 (while (search-forward header (nth 1 page) t) |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1234 (replace-match "")))))) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1235 |
9354
1ce43418547c
* man.el (Man-notify, Man-current-page, Man-page-list,
Francesco Potortì <pot@gnu.org>
parents:
9210
diff
changeset
|
1236 (defun Man-unindent () |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1237 "Delete the leading spaces that indent the manpage." |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1238 (let ((inhibit-read-only t) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1239 (case-fold-search nil)) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1240 (dolist (page Man-page-list) |
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1241 (let ((indent "") |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1242 (nindent 0)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1243 (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
|
1244 (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
|
1245 (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
|
1246 (if (catch 'unindent |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1247 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1248 (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
|
1249 (throw 'unindent nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1250 (beginning-of-line) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1251 (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
|
1252 (progn |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1253 (skip-chars-forward " ") |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1254 (point)))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1255 (setq nindent (length indent)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1256 (if (zerop nindent) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1257 (throw 'unindent nil)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1258 (setq indent (concat indent "\\|$")) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1259 (goto-char (point-min)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1260 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1261 (if (looking-at indent) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1262 (forward-line 1) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1263 (throw 'unindent nil))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1264 (goto-char (point-min))) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1265 (while (not (eobp)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1266 (or (eolp) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1267 (delete-char nindent)) |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1268 (forward-line 1))) |
7450 | 1269 )))) |
3235 | 1270 |
1271 | |
1272 ;; ====================================================================== | |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1273 ;; Man mode commands |
3235 | 1274 |
1275 (defun Man-next-section (n) | |
1276 "Move point to Nth next section (default 1)." | |
1277 (interactive "p") | |
78510
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
1278 (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
|
1279 (start (point))) |
7450 | 1280 (if (looking-at Man-heading-regexp) |
1281 (forward-line 1)) | |
1282 (if (re-search-forward Man-heading-regexp (point-max) t n) | |
1283 (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
|
1284 (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
|
1285 ;; 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
|
1286 (forward-line -1)) |
81f6622e1040
(Man-next-section): Make sure we do not move backward.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
1287 ;; 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
|
1288 ;; 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
|
1289 (if (< (point) start) (goto-char start)))) |
3235 | 1290 |
1291 (defun Man-previous-section (n) | |
1292 "Move point to Nth previous section (default 1)." | |
1293 (interactive "p") | |
7450 | 1294 (let ((case-fold-search nil)) |
1295 (if (looking-at Man-heading-regexp) | |
1296 (forward-line -1)) | |
1297 (if (re-search-backward Man-heading-regexp (point-min) t n) | |
1298 (beginning-of-line) | |
1299 (goto-char (point-min))))) | |
3235 | 1300 |
1301 (defun Man-find-section (section) | |
1302 "Move point to SECTION if it exists, otherwise don't move point. | |
1303 Returns t if section is found, nil otherwise." | |
7450 | 1304 (let ((curpos (point)) |
1305 (case-fold-search nil)) | |
3235 | 1306 (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
|
1307 (if (re-search-forward (concat "^" section) (point-max) t) |
3235 | 1308 (progn (beginning-of-line) t) |
1309 (goto-char curpos) | |
1310 nil) | |
1311 )) | |
1312 | |
1313 (defun Man-goto-section () | |
1314 "Query for section to move point to." | |
1315 (interactive) | |
1316 (aput 'Man-sections-alist | |
1317 (let* ((default (aheadsym Man-sections-alist)) | |
1318 (completion-ignore-case t) | |
1319 chosen | |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
1320 (prompt (concat "Go to section (default " default "): "))) |
3235 | 1321 (setq chosen (completing-read prompt Man-sections-alist)) |
1322 (if (or (not chosen) | |
1323 (string= chosen "")) | |
1324 default | |
1325 chosen))) | |
1326 (Man-find-section (aheadsym Man-sections-alist))) | |
1327 | |
1328 (defun Man-goto-see-also-section () | |
42706 | 1329 "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
|
1330 Actually the section moved to is described by `Man-see-also-regexp'." |
3235 | 1331 (interactive) |
1332 (if (not (Man-find-section Man-see-also-regexp)) | |
1333 (error (concat "No " Man-see-also-regexp | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1334 " section found in the current manpage")))) |
3235 | 1335 |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1336 (defun Man-possibly-hyphenated-word () |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1337 "Return a possibly hyphenated word at point. |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1338 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
|
1339 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
|
1340 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
|
1341 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
|
1342 \"tcgetp-\" instead of \"grp\"." |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1343 (save-excursion |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1344 (skip-syntax-backward "w()") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1345 (skip-chars-forward " \t") |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1346 (let ((beg (point)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1347 (word (current-word))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1348 (when (eq beg (save-excursion |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1349 (back-to-indentation) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1350 (point))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1351 (end-of-line 0) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1352 (if (eq (char-before) ?-) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1353 (setq word (current-word)))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1354 word))) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1355 |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1356 (defun Man-follow-manual-reference (reference) |
3235 | 1357 "Get one of the manpages referred to in the \"SEE ALSO\" section. |
28102 | 1358 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
|
1359 (interactive |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1360 (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
|
1361 (error "There are no references in the current man page") |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1362 (list (let* ((default (or |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1363 (car (all-completions |
60747
86c528510d44
(Man-follow-manual-reference): If current-word returns nil, use "".
Eli Zaretskii <eliz@gnu.org>
parents:
59784
diff
changeset
|
1364 (let ((word |
86c528510d44
(Man-follow-manual-reference): If current-word returns nil, use "".
Eli Zaretskii <eliz@gnu.org>
parents:
59784
diff
changeset
|
1365 (or (Man-possibly-hyphenated-word) |
86c528510d44
(Man-follow-manual-reference): If current-word returns nil, use "".
Eli Zaretskii <eliz@gnu.org>
parents:
59784
diff
changeset
|
1366 ""))) |
36575
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1367 ;; strip a trailing '-': |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1368 (if (string-match "-$" word) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1369 (substring word 0 |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1370 (match-beginning 0)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1371 word)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1372 Man-refpages-alist)) |
5394dc1db9f4
(Man-hyphenated-reference-regexp): New variable.
Eli Zaretskii <eliz@gnu.org>
parents:
35603
diff
changeset
|
1373 (aheadsym Man-refpages-alist))) |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1374 chosen |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65197
diff
changeset
|
1375 (prompt (concat "Refer to (default " default "): "))) |
50602
c7575377858f
(Man-follow-manual-reference): Don't require match
Richard M. Stallman <rms@gnu.org>
parents:
50519
diff
changeset
|
1376 (setq chosen (completing-read prompt Man-refpages-alist)) |
5269
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1377 (if (or (not chosen) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1378 (string= chosen "")) |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1379 default |
c6588bd7dd93
(Man-specified-section-option): Test system-configuration.
Richard M. Stallman <rms@gnu.org>
parents:
5108
diff
changeset
|
1380 chosen))))) |
3235 | 1381 (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
|
1382 (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
|
1383 (aput 'Man-refpages-alist reference) |
3235 | 1384 (Man-getpage-in-background |
9838
5fbd6165b408
(Man-follow-manual-reference): First arg deleted. Call
Karl Heuer <kwzh@gnu.org>
parents:
9828
diff
changeset
|
1385 (Man-translate-references (aheadsym Man-refpages-alist))))) |
3235 | 1386 |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1387 (defun Man-kill () |
3235 | 1388 "Kill the buffer containing the manpage." |
1389 (interactive) | |
22368
c3a15ab5924f
(Man-kill, Man-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
22217
diff
changeset
|
1390 (quit-window t)) |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1391 |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1392 (defun Man-quit () |
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1393 "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
|
1394 (interactive) |
22368
c3a15ab5924f
(Man-kill, Man-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
22217
diff
changeset
|
1395 (quit-window)) |
3235 | 1396 |
64622
b508a64c1b7e
(Man-goto-page): Make second argument NOERROR optional.
Juanma Barranquero <lekktu@gmail.com>
parents:
64620
diff
changeset
|
1397 (defun Man-goto-page (page &optional noerror) |
3235 | 1398 "Go to the manual page on page PAGE." |
1399 (interactive | |
8970
c0a15f821bd8
* man.el (Man-notify-flag): replaces the old Man-notify
Francesco Potortì <pot@gnu.org>
parents:
8697
diff
changeset
|
1400 (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
|
1401 (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
|
1402 (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
|
1403 (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
|
1404 (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
|
1405 (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
|
1406 (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
|
1407 (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
|
1408 (when Man-page-list |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1409 (if (or (< page 1) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1410 (> 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
|
1411 (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
|
1412 (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
|
1413 (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
|
1414 (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
|
1415 (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
|
1416 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
|
1417 (widen) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1418 (goto-char page-start) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1419 (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
|
1420 (Man-build-section-alist) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1421 (Man-build-references-alist) |
93523fb80568
(Man-bgproc-sentinel): Check here for failure to find
Richard M. Stallman <rms@gnu.org>
parents:
64091
diff
changeset
|
1422 (goto-char (point-min))))) |
3235 | 1423 |
1424 | |
1425 (defun Man-next-manpage () | |
1426 "Find the next manpage entry in the buffer." | |
1427 (interactive) | |
1428 (if (= (length Man-page-list) 1) | |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1429 (error "This is the only manpage in the buffer")) |
3235 | 1430 (if (< Man-current-page (length Man-page-list)) |
1431 (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
|
1432 (if Man-circular-pages-flag |
3235 | 1433 (Man-goto-page 1) |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1434 (error "You're looking at the last manpage in the buffer")))) |
3235 | 1435 |
1436 (defun Man-previous-manpage () | |
1437 "Find the previous manpage entry in the buffer." | |
1438 (interactive) | |
1439 (if (= (length Man-page-list) 1) | |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1440 (error "This is the only manpage in the buffer")) |
3235 | 1441 (if (> Man-current-page 1) |
1442 (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
|
1443 (if Man-circular-pages-flag |
3235 | 1444 (Man-goto-page (length Man-page-list)) |
7499
b3cacdf7bbfa
Remove periods from messages.
Richard M. Stallman <rms@gnu.org>
parents:
7453
diff
changeset
|
1445 (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
|
1446 |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1447 ;; Header file support |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1448 (defun Man-view-header-file (file) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1449 "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
|
1450 (let ((path Man-header-file-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1451 complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1452 (while path |
78511
0a3b41825002
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78510
diff
changeset
|
1453 (setq complete-path (expand-file-name file (car path)) |
50403
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1454 path (cdr path)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1455 (if (file-readable-p complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1456 (progn (view-file complete-path) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1457 (setq path nil)) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1458 (setq complete-path nil))) |
7dc2f9f7086b
(toplevel): Require button.
Juanma Barranquero <lekktu@gmail.com>
parents:
50062
diff
changeset
|
1459 complete-path)) |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1460 |
14672
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1461 ;; 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
|
1462 (Man-init-defvars) |
9556c7cfabe4
(man): Don't call Man-init-defvars here.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1463 |
28102 | 1464 (add-to-list 'debug-ignored-errors "^No manpage [0-9]* found$") |
1465 (add-to-list 'debug-ignored-errors "^Can't find the .* manpage$") | |
1466 | |
3833
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1467 (provide 'man) |
70551a213fae
* man.el (Man-switches): New variable.
Jim Blandy <jimb@redhat.com>
parents:
3714
diff
changeset
|
1468 |
58690
98e0ecc13fc5
(Man-fontify-manpage): Improve handling of ANSI escapes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57817
diff
changeset
|
1469 ;; arch-tag: 587cda76-8e23-4594-b1f3-89b6b09a0d47 |
3235 | 1470 ;;; man.el ends here |