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