From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Suggestion: Let the help command load autoloaded functions etc Date: Thu, 17 Jul 2008 12:41:32 +0200 Message-ID: <487F21DC.6010905@gmail.com> References: <47696238.6050601@gmail.com> <476B7BA6.80903@gmail.com> <476B990A.80602@gnu.org> <476BE7C7.2020005@gmail.com> <487DCD68.8050108@gmail.com> <86skuap092.fsf@lola.quinscape.zz> <487DD512.8080608@gmail.com> <86k5fmozmt.fsf@lola.quinscape.zz> <87k5flwt28.fsf@uwakimon.sk.tsukuba.ac.jp> <85y7417gfc.fsf@lola.goethe.zz> <878ww1wize.fsf@uwakimon.sk.tsukuba.ac.jp> <858ww1585y.fsf@lola.goethe.zz> <87d4lcrj2u.fsf@uwakimon.sk.tsukuba.ac.jp> <86lk00n8av.fsf@lola.quinscape.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030801030509020903060309" X-Trace: ger.gmane.org 1216291607 17240 80.91.229.12 (17 Jul 2008 10:46:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Jul 2008 10:46:47 +0000 (UTC) Cc: "Stephen J. Turnbull" , emacs-devel@gnu.org, rms@gnu.org, jasonr@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 17 12:47:35 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KJR1H-00013O-Jz for ged-emacs-devel@m.gmane.org; Thu, 17 Jul 2008 12:47:31 +0200 Original-Received: from localhost ([127.0.0.1]:59713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJR0O-0005dH-U0 for ged-emacs-devel@m.gmane.org; Thu, 17 Jul 2008 06:46:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJQw4-0003BI-KZ for emacs-devel@gnu.org; Thu, 17 Jul 2008 06:42:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJQw1-0003AN-DF for emacs-devel@gnu.org; Thu, 17 Jul 2008 06:42:05 -0400 Original-Received: from [199.232.76.173] (port=57484 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJQvz-0003AF-IC for emacs-devel@gnu.org; Thu, 17 Jul 2008 06:42:04 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]:34725) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KJQvl-0001ps-Ng; Thu, 17 Jul 2008 06:41:50 -0400 Original-Received: from c83-254-145-59.bredband.comhem.se ([83.254.145.59]:61495 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1KJQvj-0006PS-7J; Thu, 17 Jul 2008 12:41:47 +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 In-Reply-To: <86lk00n8av.fsf@lola.quinscape.zz> X-Antivirus: avast! (VPS 080712-0, 2008-07-12), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.145.59 X-Scan-Result: No virus found in message 1KJQvj-0006PS-7J. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1KJQvj-0006PS-7J 29fecf22b01b8b917e990d0c477642c0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:100877 Archived-At: This is a multi-part message in MIME format. --------------030801030509020903060309 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit David Kastrup wrote: > "Stephen J. Turnbull" 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. --------------030801030509020903060309 Content-Type: text/plain; name="help-fns-load-autoload.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="help-fns-load-autoload.diff" 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. --------------030801030509020903060309--