I am using company-mode for completion purposes. But somehow, some package always draws in auto-complete as well, which collides with company-mode, since both offer a popup with completion candidates. I want to blacklist auto-complete, since I do not need it. How can I do that? I know there is a variable package-pinned-package, but I cannot see how to blacklist a package — maybe by using an invalid archive?
2 Answers
I don't know how to blacklist the installation of a package. But it's easy to prevent it from loading. If you put (provide 'auto-complete) in your init file, then any package that tries to load auto-complete will be told that it's already loaded.
(More precisely, this takes care of libraries that load auto-complete in the normal way, with require. If there's any code that uses load directly (which would be unusual), you need to put this in a separate file called auto-complete.el.)
Of course, if the package requires auto-complete, it's probably because it'll use it. But maybe a package only declares autocomplete sources and has useful functionality otherwise. So you can make the part that you don't want a no-op. Depending on what the package does, you may need other similar definitions.
(provide 'auto-complete) (defmacro ac-define-source (&rest ignored) "A no-op since I blacklist `auto-complete'.") What @Gilles wrote is the general answer I would have given also.
But note that using provide does not prevent code from loading the package. It prevents code from loading the package only by require. If code uses load, load-library, load-file etc. then this trick has no effect.
If you really need to prevent code from loading a given library, a better approach is to provide a proxy library that gets loaded in its stead. For example, in a directory that comes earlier in your load-path, add a phony auto-complete.el that does nothing except (provide 'auto-complete).
That way, whenever code tries to load the library using load or load-library your proxy library will be loaded instead of the one you are avoiding.
However, if code uses load-file and provides the absolute address of the file of the library you are trying to avoid, then that file will be loaded. I don't see a good solution for that case (except to remove or replace that file).
autocomplete-modeto be a problem, it must be enabled first, same goes forcompany-mode.autocompletebe active in any buffer wherecompany-modeis active. Perhaps you need to manually disableautocompletein the*mode-hookof any affected major modes?~/.emacs.dfor something along the lines of(auto-complete-mode)would work.