emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion: Let the help command load autoloaded functions etc


From: Lennart Borgman (gmail)
Subject: Re: Suggestion: Let the help command load autoloaded functions etc
Date: Wed, 16 Jul 2008 12:28:56 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

Richard Stallman wrote:
A little milder suggestion just because it is close to X-max: How about adding a link that loads the library, something like replacing

      [Arg list not available until function definition is loaded.]

    with

      [Arg list not available, _click to load function library_.]

That would be an ok feature, since it would not do anything automatically.

I forgot this, here is a path for it. Could someone please look at it and install it if it looks ok?

(The link created does not work using mouse-1 on w32, but that is AFAIK a bug in Emacs. Or did I misunderstand something there?)
2008-07-16 Lennart Borgman <address@hidden>

        * help-fns.el (describe-function-1): Add link to load library for
        autoloaded functions.
Index: help-fns.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/help-fns.el,v
retrieving revision 1.122
diff -u -r1.122 help-fns.el
--- help-fns.el 6 Jun 2008 20:02:42 -0000       1.122
+++ help-fns.el 16 Jul 2008 10:19:34 -0000
@@ -104,7 +104,8 @@
    ((byte-code-function-p def) (aref def 0))
    ((eq (car-safe def) 'lambda) (nth 1 def))
    ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap)))
-    "[Arg list not available until function definition is loaded.]")
+    ;;"[Arg list not available until function definition is loaded.]")
+    "[Arg list not available, click to load function library.]")
    (t t)))
 
 (defun help-make-usage (function arglist)
@@ -417,7 +418,18 @@
                  (high (help-highlight-arguments use doc)))
             (let ((fill-begin (point)))
              (insert (car high) "\n")
-             (fill-region fill-begin (point)))
+             (fill-region fill-begin (point))
+              ;; Add load link for autoloaded functions.
+              (let ((here (point))
+                    (load-marker "click to load function library"))
+                (goto-char fill-begin)
+                (when (search-forward load-marker here t)
+                  (make-text-button (match-beginning 0)
+                                    (match-end 0)
+                                    'action `(lambda (btn) (interactive)
+                                              (load-library ,file-name)
+                                              (describe-function ',function))))
+                (goto-char here)))
             (setq doc (cdr high))))
         (let* ((obsolete (and
                          ;; function might be a lambda construct.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]