I need CEDET for eassist (eassist-list-methods is quite handy). In eassist.el there’s the line
(require 'semantic)
which fails if CEDET isn’t loaded. The thing is that I don’t need CEDET all the time and it takes a long time to load so I want to defer loading it until I call eassist-list-methods.
Is there a way to run
(load "cedet")
when semantic (or something else that is provided by CEDET) is required?
I’m looking for a simple solution that doesn’t change eassist.el.
Genehack is probably right; I’m being too literal in answering the question. The best way to handle something like this is to figure out which function(s) are required by external code, and add
autoloads for them.But if
autoloadwon’t work in your case, the normal way to do something when a file is loaded is to doBut I just noticed that you say that semantic.el fails to load if CEDET hasn’t been loaded first. As implied by the name,
eval-after-loadruns the code after the specified file is loaded.You can try finding a different file to trigger loading, instead of using semantic.el. (Perhaps some other file that semantic.el requires.)
If necessary, you could hook into
require:Although
(load "cedet")should probably be(require 'cedet), or you’ll wind up reloading it every time. (I’m not sure if CEDET has a(provide 'cedet), so I didn’t do it that way in my example.)Note that putting advice on
requirewill not do anything if semantic has already been loaded, so you may need to check(featurep 'semantic)first and load cedet.el immediately if necessary.