2

I am trying to find out if a library has been loaded after another one. For example has the ox-bibtex library been loaded after the org-ref library. I know you can look at fboundp, featurep, but I need to know the order of loading.

I thought I coudl use something like (seq-position obarray 'org-ref-command) but obarray seems to have symbols that are not even loaded.

The reason for this is in this case, the second library is clobbering something in the first library, and I am looking for a way to see what order things have been loaded.

Dan
  • 32,584
  • 6
  • 98
  • 168
John Kitchin
  • 11,555
  • 1
  • 19
  • 41
  • If library A is clobbering something that only exists in library B, doesn't that prove that A was loaded after B? – NickD Jan 05 '21 at 19:34
  • It isn't that straightforward I think. library B is redefining an org-mode link, but this sometimes also shows up that a function name is redefined. – John Kitchin Jan 05 '21 at 19:39
  • Does this answer your question? [How to identify the file of an already loaded feature, independently on how the file was loaded?](https://emacs.stackexchange.com/questions/62243/how-to-identify-the-file-of-an-already-loaded-feature-independently-on-how-the) – Drew Jan 06 '21 at 00:07
  • @Drew I don't think that answers the question. I need the order they were loaded, not if they were loaded. The functions in that interesting answer show how to find the file it was loaded from I think. What I need is the positions of those files in the load-history. – John Kitchin Jan 07 '21 at 01:58
  • Ok, it's not exactly the same question. It's the same answer, however - the load history is a history, so it tells you both whether and when, showing what's loaded just before and just after. The general question that covers both is something like, "How can I tell whether or when a given library was loaded?" Maybe Someone (TM) will change the original question into a general Q &A... – Drew Jan 07 '21 at 05:14

1 Answers1

4

I remembered load-historywith that, I came up with this that seems to work. Libraries that are loaded more recently have a smaller position (i.e. closer to the beginning of the list).

(let ((org-ref-i (seq-position load-history (assoc (locate-library "org-ref") load-history)) )
      (ox-bibtex-i (seq-position load-history (assoc (locate-library "ox-bibtex") load-history))))
  (and org-ref-i ox-bibtex-i
       (> org-ref-i ox-bibtex-i)))
John Kitchin
  • 11,555
  • 1
  • 19
  • 41