unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should autoloaded functions show LIB.el for its location?
@ 2005-12-17 13:27 Lennart Borgman
  2005-12-17 13:28 ` Lennart Borgman
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman @ 2005-12-17 13:27 UTC (permalink / raw)


I just noticed that for an autoloaded function like `apropos-variable' 
the location is shown as "apropos", not "apropos.el". Is that intentional?

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

* Re: Should autoloaded functions show LIB.el for its location?
  2005-12-17 13:27 Should autoloaded functions show LIB.el for its location? Lennart Borgman
@ 2005-12-17 13:28 ` Lennart Borgman
  2005-12-18  0:00   ` Richard M. Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman @ 2005-12-17 13:28 UTC (permalink / raw)
  Cc: Emacs Devel

Lennart Borgman wrote:

> I just noticed that for an autoloaded function like `apropos-variable' 
> the location is shown as "apropos", not "apropos.el". Is that 
> intentional?
>
In describe-function of course. Sorry.

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

* Re: Should autoloaded functions show LIB.el for its location?
  2005-12-17 13:28 ` Lennart Borgman
@ 2005-12-18  0:00   ` Richard M. Stallman
  2005-12-18  9:47     ` Lennart Borgman
  0 siblings, 1 reply; 8+ messages in thread
From: Richard M. Stallman @ 2005-12-18  0:00 UTC (permalink / raw)
  Cc: emacs-devel

    > I just noticed that for an autoloaded function like `apropos-variable' 
    > the location is shown as "apropos", not "apropos.el". Is that 
    > intentional?
    >
    In describe-function of course. Sorry.

Since the file's name is `apropos.el', it would be clearer (all else
being equal) to show `apropos.el'.

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

* Re: Should autoloaded functions show LIB.el for its location?
  2005-12-18  0:00   ` Richard M. Stallman
@ 2005-12-18  9:47     ` Lennart Borgman
  2005-12-18 14:31       ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman @ 2005-12-18  9:47 UTC (permalink / raw)
  Cc: emacs-devel

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

Richard M. Stallman wrote:

>    > I just noticed that for an autoloaded function like `apropos-variable' 
>    > the location is shown as "apropos", not "apropos.el". Is that 
>    > intentional?
>    >
>    In describe-function of course. Sorry.
>
>Since the file's name is `apropos.el', it would be clearer (all else
>being equal) to show `apropos.el'.
>
Does the attached small fix do the right thing?

[-- Attachment #2: help-fns.el.autolfix --]
[-- Type: text/plain, Size: 837 bytes --]

Index: help-fns.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/help-fns.el,v
retrieving revision 1.82
diff -c -r1.82 help-fns.el
*** help-fns.el	30 Nov 2005 15:52:49 -0000	1.82
--- help-fns.el	18 Dec 2005 09:43:37 -0000
***************
*** 322,328 ****
  		((eq (car-safe def) 'macro)
  		 "a Lisp macro")
  		((eq (car-safe def) 'autoload)
! 		 (setq file-name (nth 1 def))
  		 (format "%s autoloaded %s"
  			 (if (commandp def) "an interactive" "an")
  			 (if (eq (nth 4 def) 'keymap) "keymap"
--- 322,328 ----
  		((eq (car-safe def) 'macro)
  		 "a Lisp macro")
  		((eq (car-safe def) 'autoload)
! 		 (setq file-name (concat (nth 1 def) ".el"))
  		 (format "%s autoloaded %s"
  			 (if (commandp def) "an interactive" "an")
  			 (if (eq (nth 4 def) 'keymap) "keymap"

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: Should autoloaded functions show LIB.el for its location?
  2005-12-18  9:47     ` Lennart Borgman
@ 2005-12-18 14:31       ` Stefan Monnier
  2005-12-18 17:23         ` Lennart Borgman
  2005-12-19  4:38         ` Richard M. Stallman
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2005-12-18 14:31 UTC (permalink / raw)
  Cc: rms, emacs-devel

>> > I just noticed that for an autoloaded function like
>> apropos-variable'    > the location is shown as "apropos", not
>> "apropos.el". Is that    > intentional?
>> >
>> In describe-function of course. Sorry.
>> 
>> Since the file's name is `apropos.el', it would be clearer (all else
>> being equal) to show `apropos.el'.
>> 
> Does the attached small fix do the right thing?

No, because the autoload entry may say "foo.el" or "foo.elc" instead of
"foo", in which case adding a ".el" doesn't make much sense.  I think it's
better to leave it as it is: after all, maybe you only have a "foo" file and
no "foo.el" or "foo.elc" file.

The only good alternative I can think of otherwise is to do a locate-library
to find the file that would be used if the function were to be loaded.


        Stefan

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

* Re: Should autoloaded functions show LIB.el for its location?
  2005-12-18 14:31       ` Stefan Monnier
@ 2005-12-18 17:23         ` Lennart Borgman
  2005-12-18 18:04           ` Stefan Monnier
  2005-12-19  4:38         ` Richard M. Stallman
  1 sibling, 1 reply; 8+ messages in thread
From: Lennart Borgman @ 2005-12-18 17:23 UTC (permalink / raw)
  Cc: rms, emacs-devel

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

Stefan Monnier wrote:

>>>>I just noticed that for an autoloaded function like
>>>>        
>>>>
>>>apropos-variable'    > the location is shown as "apropos", not
>>>"apropos.el". Is that    > intentional?
>>>      
>>>
>>>In describe-function of course. Sorry.
>>>
>>>Since the file's name is `apropos.el', it would be clearer (all else
>>>being equal) to show `apropos.el'.
>>>
>>>      
>>>
>>Does the attached small fix do the right thing?
>>    
>>
>
>No, because the autoload entry may say "foo.el" or "foo.elc" instead of
>"foo", in which case adding a ".el" doesn't make much sense.  I think it's
>better to leave it as it is: after all, maybe you only have a "foo" file and
>no "foo.el" or "foo.elc" file.
>
>The only good alternative I can think of otherwise is to do a locate-library
>to find the file that would be used if the function were to be loaded.
>  
>
I think it would be good to be consistent, because this is much less 
confusing for beginners. I tried locate-library as you suggested. 
Attached. Is this better?

[-- Attachment #2: help-fns.el.autolfix2 --]
[-- Type: text/plain, Size: 852 bytes --]

Index: help-fns.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/help-fns.el,v
retrieving revision 1.82
diff -c -r1.82 help-fns.el
*** help-fns.el	30 Nov 2005 15:52:49 -0000	1.82
--- help-fns.el	18 Dec 2005 17:17:56 -0000
***************
*** 323,328 ****
--- 323,333 ----
  		 "a Lisp macro")
  		((eq (car-safe def) 'autoload)
  		 (setq file-name (nth 1 def))
+                  (unless (file-name-extension file-name)
+                    (let ((ext (file-name-extension
+                                (locate-library file-name))))
+                      (when (equal ext "elc") (setq ext "el"))
+                      (setq file-name (concat file-name "." ext))))
  		 (format "%s autoloaded %s"
  			 (if (commandp def) "an interactive" "an")
  			 (if (eq (nth 4 def) 'keymap) "keymap"

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: Should autoloaded functions show LIB.el for its location?
  2005-12-18 17:23         ` Lennart Borgman
@ 2005-12-18 18:04           ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2005-12-18 18:04 UTC (permalink / raw)
  Cc: rms, emacs-devel

> +                  (unless (file-name-extension file-name)
> +                    (let ((ext (file-name-extension
> +                                (locate-library file-name))))
> +                      (when (equal ext "elc") (setq ext "el"))
> +                      (setq file-name (concat file-name "." ext))))

I suspect that if file-name equals "foo.el", you'll get "foo.el.el" with the
above code.  Since you want consistency, why not apply to the result of
(locate-library file-name) the same code as the one used to turn the
filename extracted from load-history into "foo.el"?


        Stefan

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

* Re: Should autoloaded functions show LIB.el for its location?
  2005-12-18 14:31       ` Stefan Monnier
  2005-12-18 17:23         ` Lennart Borgman
@ 2005-12-19  4:38         ` Richard M. Stallman
  1 sibling, 0 replies; 8+ messages in thread
From: Richard M. Stallman @ 2005-12-19  4:38 UTC (permalink / raw)
  Cc: lennart.borgman.073, emacs-devel

    The only good alternative I can think of otherwise is to do a locate-library
    to find the file that would be used if the function were to be loaded.

Since we would only do this on a specific function when the user asks
for it, it would not be too inefficient.  So this seems ok.

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

end of thread, other threads:[~2005-12-19  4:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-17 13:27 Should autoloaded functions show LIB.el for its location? Lennart Borgman
2005-12-17 13:28 ` Lennart Borgman
2005-12-18  0:00   ` Richard M. Stallman
2005-12-18  9:47     ` Lennart Borgman
2005-12-18 14:31       ` Stefan Monnier
2005-12-18 17:23         ` Lennart Borgman
2005-12-18 18:04           ` Stefan Monnier
2005-12-19  4:38         ` Richard M. 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).