unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Suggestion: Let the help command load autoloaded functions etc
@ 2007-12-19 18:26 Lennart Borgman (gmail)
  2007-12-21  3:05 ` Richard Stallman
  0 siblings, 1 reply; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-19 18:26 UTC (permalink / raw)
  To: Emacs Devel

Wouldn't it be good if the help functions loaded autoloaded functions 
etc? At least I believe this would make it a bit less confusing for 
newbies. And the penalty should not be big, or?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-19 18:26 Suggestion: Let the help command load autoloaded functions etc Lennart Borgman (gmail)
@ 2007-12-21  3:05 ` Richard Stallman
  2007-12-21  8:39   ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 32+ messages in thread
From: Richard Stallman @ 2007-12-21  3:05 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

    Wouldn't it be good if the help functions loaded autoloaded functions 
    etc? At least I believe this would make it a bit less confusing for 
    newbies. And the penalty should not be big, or?

These functions give information about Emacs.  I think it would be
very undesirable for them to alter the state they are examining.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21  3:05 ` Richard Stallman
@ 2007-12-21  8:39   ` Lennart Borgman (gmail)
  2007-12-21 10:44     ` Jason Rumney
  2007-12-22  6:29     ` Richard Stallman
  0 siblings, 2 replies; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-21  8:39 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:
>     Wouldn't it be good if the help functions loaded autoloaded functions 
>     etc? At least I believe this would make it a bit less confusing for 
>     newbies. And the penalty should not be big, or?
> 
> These functions give information about Emacs.  I think it would be
> very undesirable for them to alter the state they are examining.

But loading a library should not change the state of Emacs, or? Is not 
that one of the design goals?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21  8:39   ` Lennart Borgman (gmail)
@ 2007-12-21 10:44     ` Jason Rumney
  2007-12-21 16:20       ` Lennart Borgman (gmail)
  2007-12-22  6:29     ` Richard Stallman
  1 sibling, 1 reply; 32+ messages in thread
From: Jason Rumney @ 2007-12-21 10:44 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: rms, emacs-devel

Lennart Borgman (gmail) wrote:
> Richard Stallman wrote:
>>     Wouldn't it be good if the help functions loaded autoloaded
>> functions     etc? At least I believe this would make it a bit less
>> confusing for     newbies. And the penalty should not be big, or?
>>
>> These functions give information about Emacs.  I think it would be
>> very undesirable for them to alter the state they are examining.
>
> But loading a library should not change the state of Emacs, or? Is not
> that one of the design goals?

Of course loading a library changes the state of Emacs. At very least,
it increases the memory footprint.
What benefit do you suppose would be gained from doing this?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21 10:44     ` Jason Rumney
@ 2007-12-21 16:20       ` Lennart Borgman (gmail)
  2007-12-21 16:43         ` Jason Rumney
  2007-12-22  6:30         ` Richard Stallman
  0 siblings, 2 replies; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-21 16:20 UTC (permalink / raw)
  To: Jason Rumney; +Cc: rms, emacs-devel

Jason Rumney wrote:
> Lennart Borgman (gmail) wrote:
>> Richard Stallman wrote:
>>>     Wouldn't it be good if the help functions loaded autoloaded
>>> functions     etc? At least I believe this would make it a bit less
>>> confusing for     newbies. And the penalty should not be big, or?
>>>
>>> These functions give information about Emacs.  I think it would be
>>> very undesirable for them to alter the state they are examining.
>> But loading a library should not change the state of Emacs, or? Is not
>> that one of the design goals?
> 
> Of course loading a library changes the state of Emacs. At very least,
> it increases the memory footprint.
> What benefit do you suppose would be gained from doing this?

A few things:

- Argument list
- Correct doc string
- Links in doc string

But, yes, one might think that the state changes are a bit too big. 
However this is the same state change is the same as you get when you 
customize something from the library in question.

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_.]

for an autoloaded function?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21 16:20       ` Lennart Borgman (gmail)
@ 2007-12-21 16:43         ` Jason Rumney
  2007-12-21 17:35           ` Lennart Borgman (gmail)
  2007-12-22  6:30         ` Richard Stallman
  1 sibling, 1 reply; 32+ messages in thread
From: Jason Rumney @ 2007-12-21 16:43 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: rms, emacs-devel

Lennart Borgman (gmail) wrote:
> Jason Rumney wrote:
>> What benefit do you suppose would be gained from doing this?
>
> A few things:
>
> - Argument list
> - Correct doc string
> - Links in doc string
>

I don't see what you mean by the first two. When I use C-h f 5x5, for
example (without having loaded 5x5 previously), I see the arg list, and
the documentation is correct. Under what circumstances do you get
incorrect documentation and no arg list?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21 16:43         ` Jason Rumney
@ 2007-12-21 17:35           ` Lennart Borgman (gmail)
  2007-12-21 17:40             ` Leo
  0 siblings, 1 reply; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-21 17:35 UTC (permalink / raw)
  To: Jason Rumney; +Cc: rms, emacs-devel

Jason Rumney wrote:
> Lennart Borgman (gmail) wrote:
>> Jason Rumney wrote:
>>> What benefit do you suppose would be gained from doing this?
>> A few things:
>>
>> - Argument list
>> - Correct doc string
>> - Links in doc string
>>
> 
> I don't see what you mean by the first two. When I use C-h f 5x5, for
> example (without having loaded 5x5 previously), I see the arg list, and
> the documentation is correct. Under what circumstances do you get
> incorrect documentation and no arg list?

Not sure, but it looks to me like it will be correct if you use

   ;;;###autoload

before the function. However if you do something like

   (autoload '5x1 "5x1" "Play 5x1" t)

you will just get what is on this line.

I believe many people are writing autoload's the second way. Maybe 
something like this in autoload.el could be helpful:

   (defun generate-library-autoloads (library)
     "Insert at point autoloads for Emacs library LIBRARY.
   Works like `generate-file-autoloads', but for a library."
     (interactive
      (list (completing-read "Generate autoloads for library: "
                             'locate-file-completion
                             (cons load-path (get-load-suffixes)))))
     (let ((file (locate-library library)))
       (generate-file-autoloads file)))

But that does not cure the third problem, that links in autoloaded 
functions doc strings often does not work because they point to other 
things in the same yet not loaded library where the function is defined.

I still believe me suggestion for a better [Args not available ...] 
string is useful. It could be expanded to the ;;;###autoload cookie 
case, maybe by adding something at the end of the description.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21 17:35           ` Lennart Borgman (gmail)
@ 2007-12-21 17:40             ` Leo
  2007-12-21 18:46               ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 32+ messages in thread
From: Leo @ 2007-12-21 17:40 UTC (permalink / raw)
  To: emacs-devel

On 2007-12-21 17:35 +0000, Lennart Borgman (gmail) wrote:
>(autoload '5x1 "5x1" "Play 5x1" t)
>
> you will just get what is on this line.
>
> I believe many people are writing autoload's the second way.
I don't think so.

If help command load autoloaded functions, it'll be EXTREMELY annoying.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21 17:40             ` Leo
@ 2007-12-21 18:46               ` Lennart Borgman (gmail)
  2007-12-22  9:57                 ` Eli Zaretskii
  0 siblings, 1 reply; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-21 18:46 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Leo wrote:
> On 2007-12-21 17:35 +0000, Lennart Borgman (gmail) wrote:
>> (autoload '5x1 "5x1" "Play 5x1" t)
>>
>> you will just get what is on this line.
>>
>> I believe many people are writing autoload's the second way.
> I don't think so.
> 
> If help command load autoloaded functions, it'll be EXTREMELY annoying.

Could you please explain why?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21  8:39   ` Lennart Borgman (gmail)
  2007-12-21 10:44     ` Jason Rumney
@ 2007-12-22  6:29     ` Richard Stallman
  1 sibling, 0 replies; 32+ messages in thread
From: Richard Stallman @ 2007-12-22  6:29 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

    But loading a library should not change the state of Emacs, or? Is not 
    that one of the design goals?

Loading a library will at least define new functions and variables.
I would rather that the help functions not even change things that way.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21 16:20       ` Lennart Borgman (gmail)
  2007-12-21 16:43         ` Jason Rumney
@ 2007-12-22  6:30         ` Richard Stallman
  2007-12-22 10:36           ` Thien-Thi Nguyen
  2008-07-16 10:28           ` Lennart Borgman (gmail)
  1 sibling, 2 replies; 32+ messages in thread
From: Richard Stallman @ 2007-12-22  6:30 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel, jasonr

    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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-21 18:46               ` Lennart Borgman (gmail)
@ 2007-12-22  9:57                 ` Eli Zaretskii
  0 siblings, 0 replies; 32+ messages in thread
From: Eli Zaretskii @ 2007-12-22  9:57 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: sdl.web, emacs-devel

> Date: Fri, 21 Dec 2007 19:46:23 +0100
> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
> Cc: emacs-devel@gnu.org
> 
> > If help command load autoloaded functions, it'll be EXTREMELY annoying.
> 
> Could you please explain why?

Because I don't expect my Emacs to load gobs of unneeded stuff just
because I wanted to see a doc string of a function.  If we wanted
that, we'd probably not put such a big effort into preloading only the
packages that are absolutely necessary.

Please don't forget that accessing a doc string could be utterly
unrelated to the specific function/variable whose doc string is being
accessed: for example, the various apropos commands scan _all_ the doc
strings; you don't suggest we load all of the related packages, do
you?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-22  6:30         ` Richard Stallman
@ 2007-12-22 10:36           ` Thien-Thi Nguyen
  2007-12-22 10:42             ` Lennart Borgman (gmail)
  2007-12-22 21:08             ` Richard Stallman
  2008-07-16 10:28           ` Lennart Borgman (gmail)
  1 sibling, 2 replies; 32+ messages in thread
From: Thien-Thi Nguyen @ 2007-12-22 10:36 UTC (permalink / raw)
  To: emacs-devel

() Richard Stallman <rms@gnu.org>
() Sat, 22 Dec 2007 01:30:15 -0500

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

i don't think it would be always ok.  for example, consider a set
of interdependent libraries misbehaving when components are loaded
in the wrong order.  the result is curiosity- but not necessarily
user-induced bug reports.  i would hate to have this conversation:

 user      : i clicked on "foo link" and emacs barfed: FOO-ERROR.
 programmer: well don't do that.
          u: well, why is that link displayed?
          p: because we don't handle "improper load sequence".
          u: what is the "proper load sequence"?
          p: advertized entry point is M-x bar RET.
          u: what does that have to do w/ foo?
          p: nothing.
          u: ???

in other words, i personally am disinclined to support this kind
of fuzziness (entering the subroutine from the side).

thi

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-22 10:36           ` Thien-Thi Nguyen
@ 2007-12-22 10:42             ` Lennart Borgman (gmail)
  2007-12-22 10:45               ` Lennart Borgman (gmail)
                                 ` (2 more replies)
  2007-12-22 21:08             ` Richard Stallman
  1 sibling, 3 replies; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-22 10:42 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: emacs-devel

Thien-Thi Nguyen wrote:
> () Richard Stallman <rms@gnu.org>
> () Sat, 22 Dec 2007 01:30:15 -0500
> 
>    That would be an ok feature, since it
>    would not do anything automatically.
> 
> i don't think it would be always ok.  for example, consider a set
> of interdependent libraries misbehaving when components are loaded
> in the wrong order.  the result is curiosity- but not necessarily
> user-induced bug reports.  i would hate to have this conversation:
> 
>  user      : i clicked on "foo link" and emacs barfed: FOO-ERROR.
>  programmer: well don't do that.
>           u: well, why is that link displayed?
>           p: because we don't handle "improper load sequence".
>           u: what is the "proper load sequence"?
>           p: advertized entry point is M-x bar RET.
>           u: what does that have to do w/ foo?
>           p: nothing.
>           u: ???
> 
> in other words, i personally am disinclined to support this kind
> of fuzziness (entering the subroutine from the side).


But that should not happen for autoloaded functions, or?

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-22 10:42             ` Lennart Borgman (gmail)
@ 2007-12-22 10:45               ` Lennart Borgman (gmail)
  2007-12-22 11:23               ` Robert J. Chassell
  2007-12-22 11:44               ` Thien-Thi Nguyen
  2 siblings, 0 replies; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-22 10:45 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: emacs-devel

Lennart Borgman (gmail) wrote:
> Thien-Thi Nguyen wrote:
>> () Richard Stallman <rms@gnu.org>
>> () Sat, 22 Dec 2007 01:30:15 -0500
>>
>>    That would be an ok feature, since it
>>    would not do anything automatically.
>>
>> i don't think it would be always ok.  for example, consider a set
>> of interdependent libraries misbehaving when components are loaded
>> in the wrong order.  the result is curiosity- but not necessarily
>> user-induced bug reports.  i would hate to have this conversation:
>>
>>  user      : i clicked on "foo link" and emacs barfed: FOO-ERROR.
>>  programmer: well don't do that.
>>           u: well, why is that link displayed?
>>           p: because we don't handle "improper load sequence".
>>           u: what is the "proper load sequence"?
>>           p: advertized entry point is M-x bar RET.
>>           u: what does that have to do w/ foo?
>>           p: nothing.
>>           u: ???
>>
>> in other words, i personally am disinclined to support this kind
>> of fuzziness (entering the subroutine from the side).
> 
> 
> But that should not happen for autoloaded functions, or?


I mean autoloaded commands.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-22 10:42             ` Lennart Borgman (gmail)
  2007-12-22 10:45               ` Lennart Borgman (gmail)
@ 2007-12-22 11:23               ` Robert J. Chassell
  2007-12-22 11:44               ` Thien-Thi Nguyen
  2 siblings, 0 replies; 32+ messages in thread
From: Robert J. Chassell @ 2007-12-22 11:23 UTC (permalink / raw)
  To: emacs-devel

    > > If help command load autoloaded functions, it'll be EXTREMELY annoying.
    > 
    > Could you please explain why?

Not all of us have large memories or hard disks in our computers.  We
often do not want to load extraneous libraries but do want to find out
about functions in them.

Help about a function or variable should only tell about it,
not do anything else.  

`Autoloading' exists to load automatically.  Help exists to help us.

-- 
    Robert J. Chassell                          GnuPG Key ID: 004B4AC8
    bob@rattlesnake.com                         bob@gnu.org
    http://www.rattlesnake.com                  http://www.teak.cc

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-22 10:42             ` Lennart Borgman (gmail)
  2007-12-22 10:45               ` Lennart Borgman (gmail)
  2007-12-22 11:23               ` Robert J. Chassell
@ 2007-12-22 11:44               ` Thien-Thi Nguyen
  2 siblings, 0 replies; 32+ messages in thread
From: Thien-Thi Nguyen @ 2007-12-22 11:44 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

() "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
() Sat, 22 Dec 2007 11:42:19 +0100

   But that should not happen for autoloaded functions, or?

i'm sorry, i don't understand your question.

my (fuzzy :-) concern is support burden for rogue execution
paths.  how those manifest i don't care.

thi

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-22 10:36           ` Thien-Thi Nguyen
  2007-12-22 10:42             ` Lennart Borgman (gmail)
@ 2007-12-22 21:08             ` Richard Stallman
  1 sibling, 0 replies; 32+ messages in thread
From: Richard Stallman @ 2007-12-22 21:08 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: emacs-devel

    i don't think it would be always ok.  for example, consider a set
    of interdependent libraries misbehaving when components are loaded
    in the wrong order.  the result is curiosity- but not necessarily
    user-induced bug reports.  i would hate to have this conversation:

Users can always load any library in any order they want.
When libraries depend on a certain loading order, the ones to
be loaded later should call `require'.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2007-12-22  6:30         ` Richard Stallman
  2007-12-22 10:36           ` Thien-Thi Nguyen
@ 2008-07-16 10:28           ` Lennart Borgman (gmail)
  2008-07-16 10:54             ` David Kastrup
  1 sibling, 1 reply; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-16 10:28 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel, jasonr

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

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?)

[-- Attachment #2: help-fns-load-autoload-changelog --]
[-- Type: text/plain, Size: 146 bytes --]

2008-07-16 Lennart Borgman <lennart.borgman@gmail.com>

	* help-fns.el (describe-function-1): Add link to load library for
	autoloaded functions.

[-- Attachment #3: help-fns-load-autoload.diff --]
[-- Type: text/plain, Size: 1719 bytes --]

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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 10:28           ` Lennart Borgman (gmail)
@ 2008-07-16 10:54             ` David Kastrup
  2008-07-16 11:01               ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 32+ messages in thread
From: David Kastrup @ 2008-07-16 10:54 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: jasonr, rms, emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> 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?

I think the connection in the text between first and second part may be
nonobvious to non-specialists.  How about

[To see Arg list, _click for loading xxx_]

With xxx being the autoloaded file name.

-- 
David Kastrup




^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 10:54             ` David Kastrup
@ 2008-07-16 11:01               ` Lennart Borgman (gmail)
  2008-07-16 11:08                 ` David Kastrup
  0 siblings, 1 reply; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-16 11:01 UTC (permalink / raw)
  To: David Kastrup; +Cc: jasonr, rms, emacs-devel

David Kastrup wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> 
>> 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?
> 
> I think the connection in the text between first and second part may be
> nonobvious to non-specialists.  How about
> 
> [To see Arg list, _click for loading xxx_]
> 
> With xxx being the autoloaded file name.

I think that will be too long. How about this:

   [To see Arg list, _click for loading library above_]




^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 11:01               ` Lennart Borgman (gmail)
@ 2008-07-16 11:08                 ` David Kastrup
  2008-07-16 11:55                   ` Lennart Borgman
  0 siblings, 1 reply; 32+ messages in thread
From: David Kastrup @ 2008-07-16 11:08 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: jasonr, rms, emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> David Kastrup wrote:
>> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>>
>>> 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?
>>
>> I think the connection in the text between first and second part may be
>> nonobvious to non-specialists.  How about
>>
>> [To see Arg list, _click for loading xxx_]
>>
>> With xxx being the autoloaded file name.
>
> I think that will be too long. How about this:
>
>   [To see Arg list, _click for loading library above_]

I think it will usually be longer...  And "library above" takes too much
of a double-take, _if_ you don't want the library name, just "library"
will likely be sufficient.  Or even just "_click for loading_".

-- 
David Kastrup




^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 11:08                 ` David Kastrup
@ 2008-07-16 11:55                   ` Lennart Borgman
  2008-07-16 19:02                     ` Stephen J. Turnbull
  0 siblings, 1 reply; 32+ messages in thread
From: Lennart Borgman @ 2008-07-16 11:55 UTC (permalink / raw)
  To: David Kastrup; +Cc: jasonr, rms, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

On 7/16/08, David Kastrup <dak@gnu.org> wrote:
>
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>
> > David Kastrup wrote:
> >> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> >>
> >>> 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?
> >>
> >> I think the connection in the text between first and second part may be
> >> nonobvious to non-specialists.  How about
> >>
> >> [To see Arg list, _click for loading xxx_]
> >>
> >> With xxx being the autoloaded file name.
> >
> > I think that will be too long. How about this:
> >
> >   [To see Arg list, _click for loading library above_]
>
> I think it will usually be longer...  And "library above" takes too much
> of a double-take, _if_ you don't want the library name, just "library"
> will likely be sufficient.  Or even just "_click for loading_".


I think "_click for loading library_" is my favorite.

[-- Attachment #2: Type: text/html, Size: 2281 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 11:55                   ` Lennart Borgman
@ 2008-07-16 19:02                     ` Stephen J. Turnbull
  2008-07-16 19:55                       ` David Kastrup
  0 siblings, 1 reply; 32+ messages in thread
From: Stephen J. Turnbull @ 2008-07-16 19:02 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: emacs-devel, rms, jasonr

Lennart Borgman writes:

 > > >> I think the connection in the text between first and second part may be
 > > >> nonobvious to non-specialists.  How about
 > > >>
 > > >> [To see Arg list, _click for loading xxx_]
 > > >>
 > > >> With xxx being the autoloaded file name.
 > > >
 > > > I think that will be too long. How about this:
 > > >
 > > >   [To see Arg list, _click for loading library above_]
 > >
 > > I think it will usually be longer...  And "library above" takes too much
 > > of a double-take, _if_ you don't want the library name, just "library"
 > > will likely be sufficient.  Or even just "_click for loading_".
 > 
 > 
 > I think "_click for loading library_" is my favorite.

The file name probably has the full path, which is indeed too long.

I don't volunteer to do the work, but how about

    [To see Arg list, _click for loading LIBNAME_]

where LIBNAME is the library name (ie, basename without .el), and add
a tooltip with the full file name.

By the way, the English usage can be improved.  Here are some
variations:

_Show Arg list_ (loads LIBNAME).
To show Arg list, _click to load LIBNAME_.

The big advantage is that these are the shortest suggestions yet.




^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 19:02                     ` Stephen J. Turnbull
@ 2008-07-16 19:55                       ` David Kastrup
  2008-07-16 21:11                         ` Lennart Borgman (gmail)
                                           ` (2 more replies)
  0 siblings, 3 replies; 32+ messages in thread
From: David Kastrup @ 2008-07-16 19:55 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: emacs-devel, Lennart Borgman, rms, jasonr

"Stephen J. Turnbull" <stephen@xemacs.org> writes:

> Lennart Borgman writes:
>
>  > > > I think that will be too long. How about this:
>  > > >
>  > > >   [To see Arg list, _click for loading library above_]
>  > >
>  > I think "_click for loading library_" is my favorite.
>
> The file name probably has the full path, which is indeed too long.

I don't see why it should have the full path.  The autoload cookies
don't usually have this info in them, so there is no point in deriving
and displaying it before the time of the load.

> I don't volunteer to do the work, but how about
>
>     [To see Arg list, _click for loading LIBNAME_]
>
> where LIBNAME is the library name (ie, basename without .el), and add
> a tooltip with the full file name.
>
> By the way, the English usage can be improved.  Here are some
> variations:
>
> _Show Arg list_ (loads LIBNAME).

I think in the context of the arg list, I find this text the most
straightforward suggestion yet.  It has a link for the point of interest
and mentions the side effect as a side effect.

> To show Arg list, _click to load LIBNAME_.

Clearly inferior.  The other proposal is much more of an improvement
over my suggestion.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 19:55                       ` David Kastrup
@ 2008-07-16 21:11                         ` Lennart Borgman (gmail)
  2008-07-16 22:40                         ` Stephen J. Turnbull
  2008-07-17 22:54                         ` Richard M Stallman
  2 siblings, 0 replies; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-16 21:11 UTC (permalink / raw)
  To: David Kastrup; +Cc: Stephen J. Turnbull, emacs-devel, rms, jasonr

[-- Attachment #1: Type: text/plain, Size: 1423 bytes --]

David Kastrup wrote:
> "Stephen J. Turnbull" <stephen@xemacs.org> writes:
> 
>> Lennart Borgman writes:
>>
>>  > > > I think that will be too long. How about this:
>>  > > >
>>  > > >   [To see Arg list, _click for loading library above_]
>>  > >
>>  > I think "_click for loading library_" is my favorite.
>>
>> The file name probably has the full path, which is indeed too long.
> 
> I don't see why it should have the full path.  The autoload cookies
> don't usually have this info in them, so there is no point in deriving
> and displaying it before the time of the load.
> 
>> I don't volunteer to do the work, but how about
>>
>>     [To see Arg list, _click for loading LIBNAME_]
>>
>> where LIBNAME is the library name (ie, basename without .el), and add
>> a tooltip with the full file name.
>>
>> By the way, the English usage can be improved.  Here are some
>> variations:
>>
>> _Show Arg list_ (loads LIBNAME).
> 
> I think in the context of the arg list, I find this text the most
> straightforward suggestion yet.  It has a link for the point of interest
> and mentions the side effect as a side effect.
> 
>> To show Arg list, _click to load LIBNAME_.
> 
> Clearly inferior.  The other proposal is much more of an improvement
> over my suggestion.

Thanks David and Stephen. I have attached a patch similar to Stephen's 
suggestion, but a little bit more verbose.

If this looks good then please install it.

[-- Attachment #2: help-fns-load-autoload.diff --]
[-- Type: text/plain, Size: 1978 bytes --]

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 21:07:29 -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)
@@ -417,7 +417,25 @@
                  (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-name)
+                                                 (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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 19:55                       ` David Kastrup
  2008-07-16 21:11                         ` Lennart Borgman (gmail)
@ 2008-07-16 22:40                         ` Stephen J. Turnbull
  2008-07-17  6:36                           ` David Kastrup
  2008-07-17 22:54                         ` Richard M Stallman
  2 siblings, 1 reply; 32+ messages in thread
From: Stephen J. Turnbull @ 2008-07-16 22:40 UTC (permalink / raw)
  To: David Kastrup; +Cc: jasonr, Lennart Borgman, rms, emacs-devel

David Kastrup writes:
 > "Stephen J. Turnbull" <stephen@xemacs.org> writes:

 > > The file name probably has the full path, which is indeed too long.
 > 
 > I don't see why it should have the full path.

Maybe it's just me (or just XEmacs), but I often end up with the
"wrong" library (i.e., the installed one) in the buffer, when I want
one from some source tree.  On reflection, this may mostly be a
problem with XEmacs's separate package tree.

 > The autoload cookies don't usually have this info in them, so there
 > is no point in deriving and displaying it before the time of the
 > load.

(locate-library "LIBNAME") is not that expensive.





^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 22:40                         ` Stephen J. Turnbull
@ 2008-07-17  6:36                           ` David Kastrup
  2008-07-17  8:49                             ` Stephen J. Turnbull
  0 siblings, 1 reply; 32+ messages in thread
From: David Kastrup @ 2008-07-17  6:36 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: jasonr, Lennart Borgman, rms, emacs-devel

"Stephen J. Turnbull" <stephen@xemacs.org> writes:

> David Kastrup writes:
>  > "Stephen J. Turnbull" <stephen@xemacs.org> writes:
>
>  > > The file name probably has the full path, which is indeed too long.
>  > 
>  > I don't see why it should have the full path.
>
> Maybe it's just me (or just XEmacs), but I often end up with the
> "wrong" library (i.e., the installed one) in the buffer, when I want
> one from some source tree.  On reflection, this may mostly be a
> problem with XEmacs's separate package tree.

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.

>  > The autoload cookies don't usually have this info in them, so there
>  > is no point in deriving and displaying it before the time of the
>  > load.
>
> (locate-library "LIBNAME") is not that expensive.

Sure, but it is pointless in the arglist.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-17  6:36                           ` David Kastrup
@ 2008-07-17  8:49                             ` Stephen J. Turnbull
  2008-07-17  9:56                               ` David Kastrup
  0 siblings, 1 reply; 32+ messages in thread
From: Stephen J. Turnbull @ 2008-07-17  8:49 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel, Lennart Borgman, rms, jasonr

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.





^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-17  8:49                             ` Stephen J. Turnbull
@ 2008-07-17  9:56                               ` David Kastrup
  2008-07-17 10:41                                 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 32+ messages in thread
From: David Kastrup @ 2008-07-17  9:56 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: emacs-devel, Lennart Borgman, rms, jasonr

"Stephen J. Turnbull" <stephen@xemacs.org> 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.

-- 
David Kastrup




^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-17  9:56                               ` David Kastrup
@ 2008-07-17 10:41                                 ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 32+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-17 10:41 UTC (permalink / raw)
  To: David Kastrup; +Cc: Stephen J. Turnbull, emacs-devel, rms, jasonr

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

David Kastrup wrote:
> "Stephen J. Turnbull" <stephen@xemacs.org> 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.

[-- Attachment #2: help-fns-load-autoload.diff --]
[-- Type: text/plain, Size: 2607 bytes --]

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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Suggestion: Let the help command load autoloaded functions etc
  2008-07-16 19:55                       ` David Kastrup
  2008-07-16 21:11                         ` Lennart Borgman (gmail)
  2008-07-16 22:40                         ` Stephen J. Turnbull
@ 2008-07-17 22:54                         ` Richard M Stallman
  2 siblings, 0 replies; 32+ messages in thread
From: Richard M Stallman @ 2008-07-17 22:54 UTC (permalink / raw)
  To: David Kastrup; +Cc: stephen, emacs-devel, lennart.borgman, jasonr

    I don't see why it should have the full path.

A reminder: in GNU the term "path" is reserved for a list
of directories to search.  We don't refer to file names as "paths".




^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2008-07-17 22:54 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-19 18:26 Suggestion: Let the help command load autoloaded functions etc Lennart Borgman (gmail)
2007-12-21  3:05 ` Richard Stallman
2007-12-21  8:39   ` Lennart Borgman (gmail)
2007-12-21 10:44     ` Jason Rumney
2007-12-21 16:20       ` Lennart Borgman (gmail)
2007-12-21 16:43         ` Jason Rumney
2007-12-21 17:35           ` Lennart Borgman (gmail)
2007-12-21 17:40             ` Leo
2007-12-21 18:46               ` Lennart Borgman (gmail)
2007-12-22  9:57                 ` Eli Zaretskii
2007-12-22  6:30         ` Richard Stallman
2007-12-22 10:36           ` Thien-Thi Nguyen
2007-12-22 10:42             ` Lennart Borgman (gmail)
2007-12-22 10:45               ` Lennart Borgman (gmail)
2007-12-22 11:23               ` Robert J. Chassell
2007-12-22 11:44               ` Thien-Thi Nguyen
2007-12-22 21:08             ` Richard Stallman
2008-07-16 10:28           ` Lennart Borgman (gmail)
2008-07-16 10:54             ` David Kastrup
2008-07-16 11:01               ` Lennart Borgman (gmail)
2008-07-16 11:08                 ` David Kastrup
2008-07-16 11:55                   ` Lennart Borgman
2008-07-16 19:02                     ` Stephen J. Turnbull
2008-07-16 19:55                       ` David Kastrup
2008-07-16 21:11                         ` Lennart Borgman (gmail)
2008-07-16 22:40                         ` Stephen J. Turnbull
2008-07-17  6:36                           ` David Kastrup
2008-07-17  8:49                             ` Stephen J. Turnbull
2008-07-17  9:56                               ` David Kastrup
2008-07-17 10:41                                 ` Lennart Borgman (gmail)
2008-07-17 22:54                         ` Richard M Stallman
2007-12-22  6:29     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).