[Top][All Lists]

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

Re: Should autoloaded functions show LIB.el for its location?

From: Lennart Borgman
Subject: Re: Should autoloaded functions show LIB.el for its location?
Date: Sun, 18 Dec 2005 18:23:33 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

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

reply via email to

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