[Top][All Lists]
[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: |
Thu, 17 Jul 2008 12:41:32 +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 |
David Kastrup wrote:
"Stephen J. Turnbull" <address@hidden> writes:
David Kastrup writes:
> But printing the full file path (not present in the autocookie) in the
> arg list will absolutely not change anything with regard to how the
> libraries are found.
True, but it will remind me of which tree it's getting the library
from.
The arg list is not the right place for such a reminder, I think.
And even more since this is about loading the library, not visiting it.
It should load the same library as for example (require ...).
And I just realized that I made a mistake there. I did not use the file
name actually given in the autoload. I use this now in the attached
patch, with extension stripped.
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 17 Jul 2008 10:35:53 -0000
@@ -104,7 +104,7 @@
((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.]")
+ "[Show arg list and full help (loads library LIBNAME).]")
(t t)))
(defun help-make-usage (function arglist)
@@ -264,7 +264,7 @@
(def (if (symbolp real-function)
(symbol-function real-function)
function))
- file-name string
+ file-name file-auto-noext string
(beg (if (commandp def) "an interactive " "a "))
(pt1 (with-current-buffer (help-buffer) (point))))
(setq string
@@ -287,6 +287,7 @@
"a Lisp macro")
((eq (car-safe def) 'autoload)
(setq file-name (nth 1 def))
+ (setq file-auto-noext (file-name-sans-extension file-name))
(format "%s autoloaded %s"
(if (commandp def) "an interactive" "an")
(if (eq (nth 4 def) 'keymap) "keymap"
@@ -417,7 +418,26 @@
(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-marker))
+ (load-marker
+ (concat "\\(Show arg list and full help\\) "
+ "(loads library \\(LIBNAME\\))\.")))
+ (goto-char fill-begin)
+ (save-match-data
+ (when (re-search-forward load-marker here t)
+ (make-text-button (match-beginning 1)
+ (match-end 1)
+ 'action
+ `(lambda (btn) (interactive)
+ (load-library ,file-auto-noext)
+ (describe-function ',function)))
+ (replace-match
+ (file-name-sans-extension
+ (file-name-nondirectory file-name))
+ t t nil 2)))
+ (goto-char here)))
(setq doc (cdr high))))
(let* ((obsolete (and
;; function might be a lambda construct.
- Re: Suggestion: Let the help command load autoloaded functions etc, (continued)
- Re: Suggestion: Let the help command load autoloaded functions etc, Lennart Borgman (gmail), 2008/07/16
- Re: Suggestion: Let the help command load autoloaded functions etc, David Kastrup, 2008/07/16
- Re: Suggestion: Let the help command load autoloaded functions etc, Lennart Borgman, 2008/07/16
- Re: Suggestion: Let the help command load autoloaded functions etc, Stephen J. Turnbull, 2008/07/16
- Re: Suggestion: Let the help command load autoloaded functions etc, David Kastrup, 2008/07/16
- Re: Suggestion: Let the help command load autoloaded functions etc, Lennart Borgman (gmail), 2008/07/16
- Re: Suggestion: Let the help command load autoloaded functions etc, Stephen J. Turnbull, 2008/07/16
- Re: Suggestion: Let the help command load autoloaded functions etc, David Kastrup, 2008/07/17
- Re: Suggestion: Let the help command load autoloaded functions etc, Stephen J. Turnbull, 2008/07/17
- Re: Suggestion: Let the help command load autoloaded functions etc, David Kastrup, 2008/07/17
- Re: Suggestion: Let the help command load autoloaded functions etc,
Lennart Borgman (gmail) <=
- Re: Suggestion: Let the help command load autoloaded functions etc, Richard M Stallman, 2008/07/17