comparison lisp/packages/man.el @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 0132846995bd
children bfd6434d15b3
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
55 :group 'man) 55 :group 'man)
56 56
57 (defvar Manual-page-history nil "\ 57 (defvar Manual-page-history nil "\
58 A list of names of previously visited man page buffers.") 58 A list of names of previously visited man page buffers.")
59 59
60 (defvar Manual-page-minibuffer-history nil "\
61 Minibuffer completion history for `manual-entry'.")
60 62
61 ;; New variables. 63 ;; New variables.
62 64
63 (defcustom Manual-snip-subchapter 65 (defcustom Manual-snip-subchapter
64 (not (string-match "solaris" system-configuration)) 66 (not (string-match "solaris" system-configuration))
163 165
164 ;;;###autoload 166 ;;;###autoload
165 (defun manual-entry (topic &optional arg silent) 167 (defun manual-entry (topic &optional arg silent)
166 "Display the Unix manual entry (or entries) for TOPIC." 168 "Display the Unix manual entry (or entries) for TOPIC."
167 (interactive 169 (interactive
168 (list (let* ((fmh "-A-Za-z0-9_.") 170 (list (let* ((fmh "-A-Za-z0-9_.:")
169 (default (save-excursion 171 (default (save-excursion
170 (buffer-substring 172 (buffer-substring
171 (progn 173 (progn
172 (re-search-backward "\\sw" nil t) 174 (re-search-backward "\\sw" nil t)
173 (skip-chars-backward fmh) (point)) 175 (skip-chars-backward fmh) (point))
174 (progn (skip-chars-forward fmh) (point))))) 176 (progn (skip-chars-forward fmh) (point)))))
175 (thing (read-string 177 (thing (read-string
176 (if (equal default "") "Manual entry: " 178 (if (equal default "") "Manual entry: "
177 (concat "Manual entry: (default " default ") "))))) 179 (concat "Manual entry: (default " default ") "))
180 nil 'Manual-page-minibuffer-history)))
178 (if (equal thing "") default thing)) 181 (if (equal thing "") default thing))
179 (prefix-numeric-value current-prefix-arg))) 182 (prefix-numeric-value current-prefix-arg)))
180 ;;(interactive "sManual entry (topic): \np") 183 ;;(interactive "sManual entry (topic): \np")
181 (or arg (setq arg 1)) 184 (or arg (setq arg 1))
182 (let (section apropos-mode) 185 (let (section apropos-mode)
486 (delete-region (point) p)) 489 (delete-region (point) p))
487 )) 490 ))
488 491
489 (defun Manual-mouseify-xrefs () 492 (defun Manual-mouseify-xrefs ()
490 (goto-char (point-min)) 493 (goto-char (point-min))
491 (forward-line 1)
492 (let ((case-fold-search nil) 494 (let ((case-fold-search nil)
493 s e name extent) 495 s e name extent)
494 ;; possibly it would be faster to rewrite this expression to search for 496 ;; possibly it would be faster to rewrite this expression to search for
495 ;; a less common sequence first (like "([0-9]") and then back up to see 497 ;; a less common sequence first (like "([0-9]") and then back up to see
496 ;; if it's really a match. This function is 15% of the total time, 13% 498 ;; if it's really a match. This function is 15% of the total time, 13%
497 ;; of which is this call to re-search-forward. 499 ;; of which is this call to re-search-forward.
498 (while (re-search-forward "[a-zA-Z_][-a-zA-Z0-9_.]*([0-9][a-zA-Z0-9]*)" 500 (while (re-search-forward "[a-zA-Z_][-a-zA-Z0-9_.:]*([0-9][a-zA-Z0-9]*)"
499 nil t) 501 nil t)
500 (setq s (match-beginning 0) 502 (setq s (match-beginning 0)
501 e (match-end 0) 503 e (match-end 0)
502 name (buffer-substring s e)) 504 name (buffer-substring s e))
503 (goto-char s) 505 (goto-char s)
504 (skip-chars-backward " \t") 506 (skip-chars-backward " \t")
505 (if (and (bolp) 507 (if (and (bolp) (not (bobp))
506 (progn (backward-char 1) (= (preceding-char) ?-))) 508 (progn (backward-char 1) (equal (char-before) ?-)))
507 (progn 509 (progn
508 (setq s (point)) 510 (setq s (point))
509 (skip-chars-backward "-a-zA-Z0-9_.") 511 (skip-chars-backward "-a-zA-Z0-9_.:")
510 (setq name (concat (buffer-substring (point) (1- s)) name)) 512 (setq name (concat (buffer-substring (point)
513 (if (>= s 0)
514 (1- s)
515 0))
516 name))
511 (setq s (point)))) 517 (setq s (point))))
512 ;; if there are upper case letters in the section, downcase them. 518 ;; if there are upper case letters in the section, downcase them.
513 (if (string-match "(.*[A-Z]+.*)$" name) 519 (if (string-match "(.*[A-Z]+.*)$" name)
514 (setq name (concat (substring name 0 (match-beginning 0)) 520 (setq name (concat (substring name 0 (match-beginning 0))
515 (downcase (substring name (match-beginning 0)))))) 521 (downcase (substring name (match-beginning 0))))))