atilaneves / cmake-ide

Use Emacs as a C/C++ IDE
BSD 3-Clause "New" or "Revised" License
716 stars 92 forks source link

Add support for deferred loading of cmake-ide #47

Open ennokde opened 8 years ago

ennokde commented 8 years ago

I might fix this myself. Just leaving this here for information and in hope of additional creative input.

When I found use-package and req-package I started deferring the load of packages to reduce the Emacs startup time. In that process I kind of ran into a wall concerning cmake-ide and its surrounding packages. Running CMake and setting flags for other packages is only triggered automatically on find-file-hook.

When I defer the load of cmake-ide I have to start things myself for existing buffers. I am not sure about a nice way to correct this yet. The hook handling in req-package looks like a good idea to start from.

Similar problems arise when cmake-ide is loaded before one of its dependencies. All packages loaded after cmake-ide need at least a cmake-ide-maybe-run-cmake to get their flags set. Splitting up the flag setting into separate functions for each dependency and hooking them to the loading of those packages with with-eval-after-load could solve this.

atilaneves commented 8 years ago

I haven't tried use-package myself, but I can see why you'd have the problems above. I only load cmake-ide myself as a C and C++ hook, so maybe that's why I haven't run into this?

ennokde commented 8 years ago

Probably. The find file hook is executed last when opening files so it is only a problem when the package(s) are loaded after that point.

I'll work on this in the next days. It is a good reason and a nicely sized problem for me to learn a bit more about lisp, emacs and the packages that I plan to rely on in the future.

myrgy commented 7 years ago

Hello, seems that this feature will allow to perform deferred project parsing: https://cmake.org/cmake/help/v3.7/manual/cmake-server.7.html