changeset 69793:93d87ad179a4

* man.el (Man-mode-map): Restore the \r binding. (Man-abstract-xref-man-page): If Man-target-string is a function, call it. (Man-highlight-references): Use Man-default-man-entry to get the target. Deal with xrefs too. (Man-highlight-references0): Don't call the target function. * woman.el (WoMan-xref-man-page): Strip the section number, woman cannot deal with it.
author Dan Nicolaescu <dann@ics.uci.edu>
date Tue, 04 Apr 2006 16:46:03 +0000
parents 06c899cdd0b6
children eaef81fe8393
files lisp/ChangeLog lisp/man.el lisp/woman.el
diffstat 3 files changed, 35 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Apr 04 12:46:32 2006 +0000
+++ b/lisp/ChangeLog	Tue Apr 04 16:46:03 2006 +0000
@@ -1,3 +1,15 @@
+2006-04-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* man.el (Man-mode-map): Restore the \r binding.
+	(Man-abstract-xref-man-page): If Man-target-string is a function,
+	call it.
+	(Man-highlight-references): Use Man-default-man-entry to get the
+	target. Deal with xrefs too.
+	(Man-highlight-references0): Don't call the target function.
+
+	* woman.el (WoMan-xref-man-page): Strip the section number, woman
+	cannot deal with it.
+
 2006-04-04  Daiki Ueno  <ueno@unixuser.org>
 
 	* pgg-gpg.el: Clean up process buffers every time gpg processes
--- a/lisp/man.el	Tue Apr 04 12:46:32 2006 +0000
+++ b/lisp/man.el	Tue Apr 04 16:46:03 2006 +0000
@@ -416,6 +416,9 @@
   (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 @@
   '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 @@
     (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 @@
 			     ((numberp target) 
 			      (match-string target))
 			     ((functionp target)
-			      (funcall target))
+			      target)
 			     (t nil)))))))
 
 (defun Man-cleanup-manpage (&optional interactive)
--- a/lisp/woman.el	Tue Apr 04 12:46:32 2006 +0000
+++ b/lisp/woman.el	Tue Apr 04 16:46:03 2006 +0000
@@ -428,7 +428,13 @@
 (require 'button)
 (define-button-type 'WoMan-xref-man-page 
   :supertype 'Man-abstract-xref-man-page
-  'func 'woman)
+  'func (lambda (arg)
+	  (woman
+	   ;; `woman' cannot deal with arguments that contain a
+	   ;; section name, like close(2), so strip the section name.
+	   (if (string-match Man-reference-regexp arg)
+	       (subqstring arg 0 (match-end 1))
+	     arg))))
 
 (eval-when-compile			; to avoid compiler warnings
   (require 'dired)