comparison lisp/packages/man.el @ 195:a2f645c6b9f8 r20-3b24

Import from CVS: tag r20-3b24
author cvs
date Mon, 13 Aug 2007 09:59:05 +0200
parents f53b5ca2e663
children e45d5e7c476e
comparison
equal deleted inserted replaced
194:2947057885e5 195:a2f645c6b9f8
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."
77 :type 'boolean
78 :group 'man)
79
80 (defcustom Manual-buffers-have-prefix t
81 "*When non-nil, manual page buffers are named with a prefix of `man '.
82 Otherwise, their titles do not have this prefix."
83 :type 'boolean 70 :type 'boolean
84 :group 'man) 71 :group 'man)
85 72
86 ;;Here is information on RosettaMan, from Neal.Becker@comsat.com (Neal Becker): 73 ;;Here is information on RosettaMan, from Neal.Becker@comsat.com (Neal Becker):
87 74
210 (setq section (match-string 1 section)))) 197 (setq section (match-string 1 section))))
211 198
212 (if (equal section "-k") 199 (if (equal section "-k")
213 (setq apropos-mode t)) 200 (setq apropos-mode t))
214 201
215 (let ((bufname (flet 202 (let ((bufname (concat "Man"
216 ((maybe-star () 203 (when apropos-mode " apropos")
217 (if (or Manual-buffers-have-stars 204 ": " topic
218 (not buffers-menu-submenus-for-groups-p)) 205 (when section (concat "(" section ")") "")))
219 "*"
220 "")))
221 (if apropos-mode
222 (concat (maybe-star) "man apropos " topic (maybe-star))
223 (concat (maybe-star)
224 (if Manual-buffers-have-prefix
225 "man ")
226 topic
227 (if section (concat "(" section ")") "")
228 (maybe-star)))))
229 (temp-buffer-show-function 206 (temp-buffer-show-function
230 (cond ((eq 't Manual-buffer-view-mode) 207 (cond ((eq 't Manual-buffer-view-mode)
231 'view-buffer) 208 'view-buffer)
232 ((eq 'nil Manual-buffer-view-mode) 209 ((eq 'nil Manual-buffer-view-mode)
233 temp-buffer-show-function) 210 temp-buffer-show-function)
325 ;; in v19, delete-char is compiled as a function call, but delete-region 302 ;; in v19, delete-char is compiled as a function call, but delete-region
326 ;; is byte-coded, so it's much faster. (We were spending 40% of our time 303 ;; is byte-coded, so it's much faster. (We were spending 40% of our time
327 ;; in delete-char alone.) 304 ;; in delete-char alone.)
328 (list 'delete-region '(point) (list '+ '(point) n))) 305 (list 'delete-region '(point) (list '+ '(point) n)))
329 306
330 ;; Hint: BS stands form more things than "back space" 307 ;; Hint: BS stands for more things than "back space"
331 (defun Manual-nuke-nroff-bs (&optional apropos-mode) 308 (defun Manual-nuke-nroff-bs (&optional apropos-mode)
332 (interactive "*") 309 (interactive "*")
333 (if Manual-use-rosetta-man 310 (if Manual-use-rosetta-man
334 (call-process-region (point-min) (point-max) "rman" t t nil) 311 (call-process-region (point-min) (point-max) "rman" t t nil)
335 ;; 312 ;;
656 (goto-char (- (point) 1))) 633 (goto-char (- (point) 1)))
657 (if (looking-at "\\([a-zA-Z0-9]+\\)[ \t]*(") 634 (if (looking-at "\\([a-zA-Z0-9]+\\)[ \t]*(")
658 (setq manpage (buffer-substring (match-beginning 1) 635 (setq manpage (buffer-substring (match-beginning 1)
659 (match-end 1))) 636 (match-end 1)))
660 (setq manpage "???")) 637 (setq manpage "???"))
661 (flet 638 (setq buffer
662 ((maybe-star () 639 (rename-buffer (generate-new-buffer-name
663 (if (or Manual-buffers-have-stars 640 (concat "Man: " manpage)))
664 (not buffers-menu-submenus-for-groups-p)) 641 buffer-file-name nil)
665 "*"
666 "")))
667 (setq buffer
668 (rename-buffer
669 (generate-new-buffer-name (concat (maybe-star)
670 manpage
671 (maybe-star))))))
672 (setq buffer-file-name nil)
673 (goto-char (point-min)) 642 (goto-char (point-min))
674 (insert (format "%s\n" buf-name)) 643 (insert (format "%s\n" buf-name))
675 (goto-char (point-min)) 644 (goto-char (point-min))
676 (buffer-disable-undo buffer) 645 (buffer-disable-undo buffer)
677 (set-buffer-modified-p nil) 646 (set-buffer-modified-p nil)