comparison lisp/packages/man.el @ 183:e121b013d1f0 r20-3b18

Import from CVS: tag r20-3b18
author cvs
date Mon, 13 Aug 2007 09:54:23 +0200
parents bfd6434d15b3
children 489f57a838ef
comparison
equal deleted inserted replaced
182:f07455f06202 183:e121b013d1f0
65 (defcustom Manual-snip-subchapter 65 (defcustom Manual-snip-subchapter
66 (not (string-match "solaris" system-configuration)) 66 (not (string-match "solaris" system-configuration))
67 "*Should man look in chapter 3 for ctime(3c)? 67 "*Should man look in chapter 3 for ctime(3c)?
68 This is relavent for Solaris and, perhaps, other systems which have 68 This is relavent for Solaris and, perhaps, other systems which have
69 `man -s 3' not find things in chapter 3c, or other such sub-chapters" 69 `man -s 3' not find things in chapter 3c, or other such sub-chapters"
70 :type 'boolean
71 :group 'man)
72
73 (defcustom Manual-buffers-have-stars nil
74 "*When T, manual page buffers are always named like *man*.
75 Otherwise, they are not if `buffers-menu-submenus-for-groups-p' is T,
76 so that Manual-mode buffers will have their own submenu."
70 :type 'boolean 77 :type 'boolean
71 :group 'man) 78 :group 'man)
72 79
73 (defcustom Manual-use-rosetta-man (not (null (locate-file "rman" exec-path))) "\ 80 (defcustom Manual-use-rosetta-man (not (null (locate-file "rman" exec-path))) "\
74 If non-nil, use RosettaMan (rman) to filter man pages. 81 If non-nil, use RosettaMan (rman) to filter man pages.
200 (if (equal section "-k") 207 (if (equal section "-k")
201 (setq apropos-mode t)) 208 (setq apropos-mode t))
202 209
203 (let ((bufname (flet 210 (let ((bufname (flet
204 ((maybe-star () 211 ((maybe-star ()
205 (if buffers-menu-submenus-for-groups-p 212 (if (or Manual-buffers-have-stars
206 "" 213 (not buffers-menu-submenus-for-groups-p))
207 "*"))) 214 "*"
215 "")))
208 (if apropos-mode 216 (if apropos-mode
209 (concat (maybe-star) "man apropos " topic (maybe-star)) 217 (concat (maybe-star) "man apropos " topic (maybe-star))
210 (concat (maybe-star) 218 (concat (maybe-star)
211 topic 219 topic
212 (if section (concat "(" section ")") "") 220 (if section (concat "(" section ")") "")
259 (message "%s (cleaning...)" args-string) 267 (message "%s (cleaning...)" args-string)
260 (Manual-nuke-nroff-bs apropos-mode) 268 (Manual-nuke-nroff-bs apropos-mode)
261 (message "%s (done.)" args-string)) 269 (message "%s (done.)" args-string))
262 (set-buffer-modified-p nil) 270 (set-buffer-modified-p nil)
263 (Manual-mode))))) 271 (Manual-mode)))))
264 272 (let ((page (if section
265 (let ((page (flet 273 (concat topic "(" section ")")
266 ((maybe-star () 274 topic)))
267 (if buffers-menu-submenus-for-groups-p
268 ""
269 "*")))
270 (if section
271 (concat (maybe-star) topic "(" section ")" (maybe-star))
272 topic))))
273 (setq Manual-page-history 275 (setq Manual-page-history
274 (cons (buffer-name) 276 (cons (buffer-name)
275 (delete (buffer-name) Manual-page-history)) 277 (delete (buffer-name) Manual-page-history))
276 Manual-page-minibuffer-history 278 Manual-page-minibuffer-history
277 (cons page (delete page Manual-page-minibuffer-history)))))) 279 (cons page (delete page Manual-page-minibuffer-history))))))
511 (delete-region (point) p)) 513 (delete-region (point) p))
512 )) 514 ))
513 515
514 (defun Manual-mouseify-xrefs () 516 (defun Manual-mouseify-xrefs ()
515 (goto-char (point-min)) 517 (goto-char (point-min))
518 ;; skip the top line of manual pages, but not apropos listings.
519 (unless apropos-mode (forward-line 1))
516 (let ((case-fold-search nil) 520 (let ((case-fold-search nil)
517 s e name splitp extent) 521 s e name splitp extent)
518 ;; possibly it would be faster to rewrite this expression to search for 522 ;; possibly it would be faster to rewrite this expression to search for
519 ;; a less common sequence first (like "([0-9]") and then back up to see 523 ;; a less common sequence first (like "([0-9]") and then back up to see
520 ;; if it's really a match. This function is 15% of the total time, 13% 524 ;; if it's really a match. This function is 15% of the total time, 13%
526 name (buffer-substring s e) 530 name (buffer-substring s e)
527 splitp nil) 531 splitp nil)
528 532
529 (goto-char s) 533 (goto-char s)
530 ;; if this is a hyphenated xref, we're on the second line, 1st char now. 534 ;; if this is a hyphenated xref, we're on the second line, 1st char now.
531
532 (when (progn 535 (when (progn
533 (beginning-of-line) 536 (beginning-of-line)
534 (and (looking-at (concat "^[ \t]+" (regexp-quote name))) 537 (and (looking-at (concat "^[ \t]+" (regexp-quote name)))
535 (progn 538 (progn
536 (backward-char 1) 539 (backward-char 1)
648 (setq manpage (buffer-substring (match-beginning 1) 651 (setq manpage (buffer-substring (match-beginning 1)
649 (match-end 1))) 652 (match-end 1)))
650 (setq manpage "???")) 653 (setq manpage "???"))
651 (flet 654 (flet
652 ((maybe-star () 655 ((maybe-star ()
653 (if buffers-menu-submenus-for-groups-p 656 (if (or Manual-buffers-have-stars
654 "*" 657 (not buffers-menu-submenus-for-groups-p))
655 ""))) 658 "*"
659 "")))
656 (setq buffer 660 (setq buffer
657 (rename-buffer 661 (rename-buffer
658 (generate-new-buffer-name (concat (maybe-star) 662 (generate-new-buffer-name (concat (maybe-star)
659 manpage 663 manpage
660 (maybe-star)))))) 664 (maybe-star))))))