]> code.delx.au - gnu-emacs/blobdiff - lisp/man.el
(enum event_kind) [MAC_OS]: Update comment for MAC_APPLE_EVENT.
[gnu-emacs] / lisp / man.el
index 52645db16f5945fe3382f1052e0e3b98921d690f..77c089b9d8db8870fe9130d45b7ea690f03d03bb 100644 (file)
@@ -1,7 +1,7 @@
 ;;; man.el --- browse UNIX manual pages -*- coding: iso-8859-1 -*-
 
 ;; Copyright (C) 1993, 1994, 1996, 1997, 2001, 2002, 2003,
-;;   2004, 2005 Free Software Foundation, Inc.
+;;   2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <bwarsaw@cen.com>
 ;; Maintainer: FSF
@@ -262,7 +262,7 @@ the associated section number."
 (defvar Man-name-regexp "[-a-zA-Z0-9_­+][-a-zA-Z0-9_.:­+]*"
   "Regular expression describing the name of a manpage (without section).")
 
-(defvar Man-section-regexp "[0-9][a-zA-Z+]*\\|[LNln]"
+(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]"
   "Regular expression describing a manpage section within parentheses.")
 
 (defvar Man-page-header-regexp
@@ -274,7 +274,7 @@ the associated section number."
            "(\\(" Man-section-regexp "\\))\\).*\\1"))
   "Regular expression describing the heading of a page.")
 
-(defvar Man-heading-regexp "^\\([A-Z][A-Z -]+\\)$"
+(defvar Man-heading-regexp "^\\([A-Z][A-Z /-]+\\)$"
   "Regular expression describing a manpage heading entry.")
 
 (defvar Man-see-also-regexp "SEE ALSO"
@@ -304,7 +304,7 @@ This regexp should not start with a `^' character.")
 (defvar Man-include-regexp "#[ \t]*include[ \t]*"
   "Regular expression describing the #include (directive of cpp).")
 
-(defvar Man-file-name-regexp "[^<>\" \t\n]+"
+(defvar Man-file-name-regexp "[^<>\", \t\n]+"
   "Regular expression describing <> in #include line (directive of cpp).")
 
 (defvar Man-normal-file-prefix-regexp "[/~$]"
@@ -416,6 +416,9 @@ Otherwise, the value is whatever the function
   (define-key Man-mode-map "k"    'Man-kill)
   (define-key Man-mode-map "q"    'Man-quit)
   (define-key Man-mode-map "m"    'man)
+  ;; Not all the man references get buttons currently. The text in the
+  ;; manual page can contain references to other man pages
+  (define-key Man-mode-map "\r"   'man-follow)
   (define-key Man-mode-map "?"    'describe-mode))
 
 ;; buttons
@@ -423,10 +426,13 @@ Otherwise, the value is whatever the function
   'follow-link t
   'help-echo "mouse-2, RET: display this man page"
   'func nil
-  'action (lambda (button) (funcall 
-                           (button-get button 'func)
-                           (or (button-get button 'Man-target-string)
-                               (button-label button)))))
+  'action (lambda (button) 
+           (funcall 
+            (button-get button 'func)
+            (let ((func (button-get button 'Man-target-string)))
+              (if func
+                  (if (functionp func) (funcall func) func)
+                (button-label button))))))
 
 (define-button-type 'Man-xref-man-page 
   :supertype 'Man-abstract-xref-man-page
@@ -929,15 +935,14 @@ default type, `Man-xref-man-page' is used for the buttons."
     (setq Man-arguments ""))
   (if (string-match "-k " Man-arguments)
       (progn
-       (Man-highlight-references0 nil Man-reference-regexp 1 nil
+       (Man-highlight-references0 nil Man-reference-regexp 1
+                                  'Man-default-man-entry
                                   (or xref-man-type 'Man-xref-man-page))
        (Man-highlight-references0 nil Man-apropos-regexp 1
-                                  (lambda ()
-                                    (format "%s(%s)"
-                                            (match-string 1)
-                                            (match-string 2)))
+                                  'Man-default-man-entry
                                   (or xref-man-type 'Man-xref-man-page)))
-    (Man-highlight-references0 Man-see-also-regexp Man-reference-regexp 1 nil
+    (Man-highlight-references0 Man-see-also-regexp Man-reference-regexp 1 
+                              'Man-default-man-entry
                               (or xref-man-type 'Man-xref-man-page))
     (Man-highlight-references0 Man-synopsis-regexp Man-header-regexp 0 2
                               'Man-xref-header-file)
@@ -966,7 +971,7 @@ default type, `Man-xref-man-page' is used for the buttons."
                             ((numberp target) 
                              (match-string target))
                             ((functionp target)
-                             (funcall target))
+                             target)
                             (t nil)))))))
 
 (defun Man-cleanup-manpage (&optional interactive)