]> code.delx.au - gnu-emacs/blobdiff - lisp/man.el
Merge from trunk.
[gnu-emacs] / lisp / man.el
index c8c2f8653e214c262dcaf36df63a45cdb15e1a3a..ed24e35f0eaacd89e895b52d007da4e42dcc2f9a 100644 (file)
@@ -254,8 +254,7 @@ Used in `bookmark-set' to get the default bookmark name."
   "Regular expression describing a manpage section within parentheses.")
 
 (defvar Man-page-header-regexp
-  (if (and (string-match "-solaris2\\." system-configuration)
-          (not (string-match "-solaris2\\.[123435]$" system-configuration)))
+  (if (string-match "-solaris2\\." system-configuration)
       (concat "^[-A-Za-z0-9_].*[ \t]\\(" Man-name-regexp
              "(\\(" Man-section-regexp "\\))\\)$")
     (concat "^[ \t]*\\(" Man-name-regexp
@@ -277,7 +276,9 @@ This regexp should not start with a `^' character.")
 This regular expression should start with a `^' character.")
 
 (defvar Man-reference-regexp
-  (concat "\\(" Man-name-regexp "\\)[ \t]*(\\(" Man-section-regexp "\\))")
+  (concat "\\(" Man-name-regexp
+         "\\(\n[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
+         Man-section-regexp "\\))")
   "Regular expression describing a reference to another manpage.")
 
 (defvar Man-apropos-regexp
@@ -598,8 +599,8 @@ and the `Man-section-translations-alist' variables)."
     (cond
      ;; "chmod(2V)" case ?
      ((string-match (concat "^" Man-reference-regexp "$") ref)
-      (setq name (match-string 1 ref)
-           section (match-string 2 ref)))
+      (setq name (replace-regexp-in-string "[\n\t ]" "" (match-string 1 ref))
+           section (match-string 3 ref)))
      ;; "2v chmod" case ?
      ((string-match (concat "^\\(" Man-section-regexp
                            "\\) +\\(" Man-name-regexp "\\)$") ref)
@@ -1107,7 +1108,7 @@ Same for the ANSI bold and normal escape sequences."
       (put-text-property (match-beginning 0)
                         (match-end 0)
                         'face Man-overstrike-face)))
-  (message "%s man page formatted" Man-arguments))
+  (message "%s man page formatted" (Man-page-from-arguments Man-arguments)))
 
 (defun Man-highlight-references (&optional xref-man-type)
   "Highlight the references on mouse-over.
@@ -1256,12 +1257,11 @@ manpage command."
          (Man-mode)
 
          (if (not Man-page-list)
-             (let ((args Man-arguments))
+             (let ((args Man-arguments))
                (kill-buffer (current-buffer))
-               (error "Can't find the %s manpage" args)))
-
-          (set-buffer-modified-p nil)
-          ))
+               (error "Can't find the %s manpage"
+                      (Man-page-from-arguments args)))
+           (set-buffer-modified-p nil))))
        ;; Restore case-fold-search before calling
        ;; Man-notify-when-ready because it may switch buffers.
 
@@ -1272,6 +1272,18 @@ manpage command."
            (error "%s" err-mess))
        ))))
 
+(defun Man-page-from-arguments (args)
+  ;; Skip arguments and only print the page name.
+  (mapconcat
+   'identity
+   (delete nil
+          (mapcar
+           (lambda (elem)
+             (and (not (string-match "^-" elem))
+                  elem))
+           (split-string args " ")))
+   " "))
+
 \f
 ;; ======================================================================
 ;; set up manual mode in buffer and build alists