all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5661: 23.1.92; `find-library-name' should find a loaded library
@ 2010-02-28 23:11 Drew Adams
  2016-04-27 21:23 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2010-02-28 23:11 UTC (permalink / raw)
  To: 5661

emacs -Q

Put this code in a new file throw-a.el in a directory that is not in your
`load-path':

(defun foo () (message "foo"))
(provide 'throw-a)

In that same directory, do this:

M-x load-file RET throw-a.el RET
M-x load-library RET find-func RET
M-: (find-library-name "throw-a") RET

It should find the library (since it was loaded and thus provided), but instead
it raises an error:

Debugger entered--Lisp error: (error "Can't find library throw-a")
  signal(error ("Can't find library throw-a"))
  error("Can't find library %s" "throw-a")
  find-library-name("throw-a")
  eval((find-library-name "throw-a"))
  eval-expression((find-library-name "throw-a") nil)
  call-interactively(eval-expression nil nil)

The doc string says nothing about searching only the `load-path'. It's
reasonable to think that this should be able to find the library either by
checking loaded libraries or by searching the `load-path'.

Consider, for example, using `finder-commentary' after having loaded the library
using `load-file' but not having the library in the `load-path'. The library is
known to the current session, but Emacs isn't smart enough to find it.







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

* bug#5661: 23.1.92; `find-library-name' should find a loaded library
  2010-02-28 23:11 bug#5661: 23.1.92; `find-library-name' should find a loaded library Drew Adams
@ 2016-04-27 21:23 ` Lars Ingebrigtsen
  2016-04-27 21:28   ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 21:23 UTC (permalink / raw)
  To: Drew Adams; +Cc: 5661

"Drew Adams" <drew.adams@oracle.com> writes:

> Put this code in a new file throw-a.el in a directory that is not in your
> `load-path':
>
> (defun foo () (message "foo"))
> (provide 'throw-a)
>
> In that same directory, do this:
>
> M-x load-file RET throw-a.el RET
> M-x load-library RET find-func RET
> M-: (find-library-name "throw-a") RET
>
> It should find the library (since it was loaded and thus provided), but instead
> it raises an error:
>
> Debugger entered--Lisp error: (error "Can't find library throw-a")
>   signal(error ("Can't find library throw-a"))
>   error("Can't find library %s" "throw-a")
>   find-library-name("throw-a")
>   eval((find-library-name "throw-a"))
>   eval-expression((find-library-name "throw-a") nil)
>   call-interactively(eval-expression nil nil)
>
> The doc string says nothing about searching only the `load-path'. It's
> reasonable to think that this should be able to find the library either by
> checking loaded libraries or by searching the `load-path'.

That would be nice.  But does Emacs have a record of all files it has
done `load-file' on somewhere?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#5661: 23.1.92; `find-library-name' should find a loaded library
  2016-04-27 21:23 ` Lars Ingebrigtsen
@ 2016-04-27 21:28   ` Drew Adams
  2016-04-27 21:37     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2016-04-27 21:28 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 5661

> > The doc string says nothing about searching only the `load-path'. It's
> > reasonable to think that this should be able to find the library either
> by
> > checking loaded libraries or by searching the `load-path'.
> 
> That would be nice.  But does Emacs have a record of all files it has
> done `load-file' on somewhere?

Sorry, I'm reading these really quickly.  But does `load-history'
apply here?





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

* bug#5661: 23.1.92; `find-library-name' should find a loaded library
  2016-04-27 21:28   ` Drew Adams
@ 2016-04-27 21:37     ` Lars Ingebrigtsen
  2016-05-01 16:39       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 21:37 UTC (permalink / raw)
  To: Drew Adams; +Cc: 5661

Drew Adams <drew.adams@oracle.com> writes:

>> > The doc string says nothing about searching only the `load-path'. It's
>> > reasonable to think that this should be able to find the library either
>> by
>> > checking loaded libraries or by searching the `load-path'.
>> 
>> That would be nice.  But does Emacs have a record of all files it has
>> done `load-file' on somewhere?
>
> Sorry, I'm reading these really quickly.  But does `load-history'
> apply here?

Indeed it seems like that should do the trick.  Does anybody object to
me extending `find-library-name' to check with `load-history' after it's
gone through the paths it's currently searching?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#5661: 23.1.92; `find-library-name' should find a loaded library
  2016-04-27 21:37     ` Lars Ingebrigtsen
@ 2016-05-01 16:39       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2016-05-01 16:39 UTC (permalink / raw)
  To: Drew Adams; +Cc: 5661

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Drew Adams <drew.adams@oracle.com> writes:
>
>>> > The doc string says nothing about searching only the `load-path'. It's
>>> > reasonable to think that this should be able to find the library either
>>> by
>>> > checking loaded libraries or by searching the `load-path'.
>>> 
>>> That would be nice.  But does Emacs have a record of all files it has
>>> done `load-file' on somewhere?
>>
>> Sorry, I'm reading these really quickly.  But does `load-history'
>> apply here?
>
> Indeed it seems like that should do the trick.  Does anybody object to
> me extending `find-library-name' to check with `load-history' after it's
> gone through the paths it's currently searching?

Nobody seemed to object, so I've now implemented it.  It was more
twiddly than I assumed.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2016-05-01 16:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-28 23:11 bug#5661: 23.1.92; `find-library-name' should find a loaded library Drew Adams
2016-04-27 21:23 ` Lars Ingebrigtsen
2016-04-27 21:28   ` Drew Adams
2016-04-27 21:37     ` Lars Ingebrigtsen
2016-05-01 16:39       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.