Subject: Re: bug#5474: 23.1.91.1; describe-mode does not offer link to the .el

From: Juri Linkov <[email-masked]>
Date: Mon, 25 Jan 2010 19:54:09 +0200

> We hit C-h m. We see the following:
>
>   XXXX mode:
>   Major mode for editing XXXX.
>
>   key             binding
>   ---             -------
>
>   C-c		Prefix Command
>   ESC		Prefix Command
>
>   C-M-x		XXXX-eval-defun
>
> Nowhere is there a link to XXXX.el.
> We have to hit XXXX-eval-defun to get a link to XXXX.el.
>
> It should say at top
>   XXXX mode:
>   Major mode for editing XXXX. Defined in XXXX.el <---clickable.
>
> Or
>   XXXX mode (... XXXX-mode, defined in XXXX.el):
>   Major mode for editing XXXX.

This can be implemented after feature freeze with the following patch
that adds links to the major/minor mode names for `C-h m':

Index: emacs/lisp/help.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/help.el,v
retrieving revision 1.327
diff -u -r1.327 help.el
--- emacs/lisp/help.el	21 Mar 2007 16:15:45 -0000	1.327
+++ emacs/lisp/help.el	5 May 2007 17:01:30 -0000
@@ -815,7 +815,12 @@
 		  (princ "\n\f\n")
 		  (push (point-marker) help-button-cache)
 		  ;; Document the minor modes fully.
-		  (insert pretty-minor-mode)
+		  (insert-button pretty-minor-mode
+				 'action `(lambda (button)
+					    (describe-function ',mode-function))
+				 'follow-link t
+				 'help-echo (format "mouse-2, RET: show information about %S"
+						    mode-function))
 		  (princ (format " minor mode (%s):\n"
 				 (if (zerop (length indicator))
 				     "no indicator"
@@ -833,10 +838,15 @@
 
 	  (princ "\n(Information about these minor modes follows the major mode info.)\n\n"))
 	;; Document the major mode.
-	(let ((mode mode-name))
+	(let ((major-mode-function major-mode) (mode mode-name))
 	  (with-current-buffer standard-output
             (let ((start (point)))
-              (insert (format-mode-line mode))
+	      (insert-button (format-mode-line mode)
+			     'action `(lambda (button)
+					(describe-function ',major-mode-function))
+			     'follow-link t
+			     'help-echo (format "mouse-2, RET: show information about %S"
+						major-mode-function))
               (add-text-properties start (point) '(face bold)))))
 	(princ " mode:\n")
 	(princ (documentation major-mode)))

-- 
Juri Linkov
http://www.jurta.org/emacs/