6

I installed package from M-x package-list-packages and want to disable this package without uninstalling.

UPDATE With (setq package-load-list '((company nil))) I have in *Packages* buffer:

company            0.9.3         disabled              Modular text completion framework

but completion dialog still appear.

I have

(defun my-company-prog-mode-setup ()
  (setq-local company-dabbrev-code-other-buffers 'code)
  (setq-local company-backends '((company-capf company-dabbrev-code company-files)))
  (company-mode 1))

(when (featurep 'company)
  (add-hook 'prog-mode-hook #'my-company-prog-mode-setup))

2 Answers 2

7

One of the many great things about use-package is that it lets you disable specific packages with a simple keyword (viz. :disabled t).

1
  • 3
    This only disables the use-package configuration, not package.el's initialization.
    – npostavs
    Apr 29, 2017 at 15:34
5

You can control which packages are loaded through the variable package-load-list. Set it in your init file, before calling package-initialize if you do this explicitly. You can reach it from the Customize interface (“Package” → “Package Load List”).

package-load-list is an list whose elements are lists whose first element is a package name (as a symbol). The second element of the list can be a string to force a specific version of the package to be loaded, t to load the latest version, or nil to disable the loading of the package. Also put all in the list, so that Emacs will load the latest version of packages which are not explicitly mentioned.

(setq package-load-list '(all
                          (unwanted-package nil)
                          ))
3
  • 1
    Hm... (setq package-load-list '((company nil))) doesn't work for me. Seems it's better to uninstall. At least this can be done in visual way because finding package name can be cumbersome.
    – gavenkoa
    Apr 28, 2017 at 20:19
  • 2
    @gavenkoa Works for me under Emacs 24.4. company-mode is not autoloaded. I forgot to mention that you should put all in the list, without it all your packages would have been disabled. Check that you're setting this before any call to package-initialize or anything that would call package-initialize, such as use-package (but if you're using use-package, see mclear's answer). Apr 29, 2017 at 10:00
  • 1
    @gavenkoa Did you also restart Emacs? This doesn't unload the package after the fact.
    – npostavs
    Apr 29, 2017 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.