33 votes
Accepted

How to update packages installed with use-package

I just do this manually: run list-packages hit Uto mark available upgrades, then review to decide if there are any I don't want to pick up. Then x to upgrade. I do this pretty regularly, and often ...
user avatar
  • 19.1k
24 votes
Accepted

Difference between init and config in use-package

They are different if the package is deferred, i.e. not loaded until it is needed. In that case :init will be executed at the time your emacs file is first read, but :config will be executed at the ...
user avatar
  • 19.1k
23 votes
Accepted

`use-package` with :config to set variables

The below would work. For the sake of clarity, I am using :ensure org-plus-contrib which deviates a bit from the example in your question. (use-package org :mode (("\\.org$" . org-mode)) :ensure ...
user avatar
  • 24.2k
21 votes
Accepted

How to bind your keys to keymaps that aren't loaded yet?

You can use with-eval-after-load to defer the key binding until after a certain module has been loaded (and thus defined the keymap): (with-eval-after-load "helm" (bind-key "M-Y" #'helm-end-of-...
user avatar
  • 5,786
20 votes
Accepted

Use multiple `:mode` arguments with use-package

The right way to do it would be (use-package markdown-mode :mode ("\\.markdown\\'" "\\.md\\'")) or (use-package markdown-mode :mode (("\\.markdown\\'" . markdown-mode) ("\\.md\\'" ...
user avatar
  • 24.2k
19 votes

org-plus-contrib and org with `require` or `use-package`

The correct way to do this with use-package is as follows: (use-package org :ensure org-plus-contrib ... The first argument makes sure that it is the org.el file being sourced. The :ensure ...
user avatar
16 votes
Accepted

Unbinding key using use-package

If you C-h f and enter unbind-key, the help says: unbind-key is an autoloaded Lisp macro in `bind-key.el'. (unbind-key KEY-NAME &optional KEYMAP) Not documented. The second argument ...
user avatar
16 votes
Accepted

use-package - :init or :config

Is there any rule by which the user can determine whether the package configuration requires :init or :config? There is no general rule which applies to all settings and packages; you just need to ...
user avatar
  • 11.3k
15 votes

How to update packages installed with use-package

You can use auto-package-update to automatically update packages. Copied from my other post (https://emacs.stackexchange.com/a/31903/9972) (use-package auto-package-update :ensure t :config ...
user avatar
  • 361
15 votes
Accepted

When to specify a package name in use-package's :ensure tag?

But for some packages that doesn't work. Such as auctex. The reason (use-package tex :ensure t) doesn't work for auctex is because auctex names a GNU ELPA package (see (emacs) Packages), whereas tex ...
user avatar
  • 11.3k
14 votes

How to associate more than one file extension with a given mode in `use-package`

The following should work: (use-package js2-mode :mode (("\\.js\\'" . js2-mode) ("\\.jsx\\'" . js2-mode)) ... :ensure t)
user avatar
14 votes

Getting started `use-package` question

Do I need (package-initialize) before these lines? If your version of Emacs (M-xemacs-versionRET) is older than 27, and you are using the built-in package manager, then you indeed need to call (...
user avatar
  • 11.3k
12 votes
Accepted

How to use use-package with built-in packages?

The package's name is compile. Below should work. (use-package compile :init (progn (setq compilation-scroll-output t))) It would be worthwhile to note @JordonBiondo's comment on how to ...
user avatar
  • 24.2k
12 votes
Accepted

What is the standard way to install an elisp package?

You can use the package manager to install a package and keep it up to date. htmlize isn't in the default archive, but you can easily add new ones (Marmalade and MELPA are the two most popular): (add-...
user avatar
  • 12.1k
11 votes

Difference between init and config in use-package

This example made me much easy to understand the difference between :init and :config. Let's take an example of ace-window package (but this can be any package). Put this in your init.el file: (use-...
user avatar
  • 3,321
11 votes

Does use-package keep packages automatically updated?

I use auto-package-update to automatically update packages. (use-package auto-package-update :ensure t :config (setq auto-package-update-delete-old-versions t auto-package-update-...
user avatar
  • 361
11 votes
Accepted

error: Package `use-package-' is unavailable

This particular error happens if Emacs failed looking up the latest version of a package, like if there's no package-archives file containing that information. Before installing packages, make sure ...
user avatar
  • 21k
11 votes

How to avail of `:hook` using use-package?

As others said I think https://github.com/jwiegley/use-package#hooks is pretty clear. :hook replaces add-hook and creates autoloads for you. Your example with :hook would be: (use-package web-mode :...
user avatar
  • 346
11 votes
Accepted

Is it possible to load Dired+ automatically with use-package?

dired+ has left MELPA repository, and now you have to download it manually from EmacsWiki. You can still use use-package with a downloaded package, like this: (use-package dired+ :load-path "~/....
user avatar
  • 1,904
10 votes
Accepted

Bind f-key in use-package

You need to quote "<f11>", like this: :bind ("<f11>" . multi-term) And here's a full example, with ace-jump-mode: (use-package ace-jump-mode :commands ace-jump-mode :...
user avatar
  • 695
10 votes
Accepted

Using package.el to install and update but use-package for loading and configuring

IIUC what you want to do is: (package-initialize t) Note the t argument, which is the key to your happiness here since it will (or should, at least) initialize package.el without activating all the ...
user avatar
  • 25.2k
10 votes
Accepted

Activate global minor modes from use-package

I don't know why company-mode is getting diminished, but I think I know what's going on with whitespace-mode. Your block (use-package whitespace :ensure t ;; I also tried without this line :...
user avatar
  • 2,554
9 votes

How to bind your keys to keymaps that aren't loaded yet?

Solution In order to execute stuff after a given package is loaded, you need to put that after :config in use-package. Here's an example using the snippet in your question: Snippet # 1 (use-...
user avatar
  • 24.2k
9 votes

How do I edebug a function defined in a use-package block?

When you call edebug-defun it debugs the top-level form, which in this case is (use-package ...). You can use debug-on-entry to debug a named function.
user avatar
  • 19.1k
9 votes
Accepted

void-function when loading ido-mode in Emacs24

use-package is not part of standard Emacs. It's an extension you can install via the package manager from Melpa or download direct and as such you will need to: (require 'use-package) before you can ...
user avatar
  • 4,526
9 votes

Interaction between package, use-package, and quelpa

While quelpa and use-package have no direct relation with each other, there now is a package, quelpa-use-package, which adds a quelpa handler to use-package. This allows one to use use-package with a ...
user avatar
  • 191
9 votes

Use-package for a mode

As the README will tell you, the :mode keyword allows you to define a deferred binding (i.e. on-demand), which will load the package when visiting a buffer which filename matches the expression you ...
user avatar
  • 89
9 votes
Accepted

How to associate more than one file extension with a given mode in `use-package`

Use :mode "\\.jsx?\\'" Remember: all those backslashes are there because it's a regexp, so you really want to take advantage of it when you can, otherwise you're just suffering through those ...
user avatar
  • 25.2k

Only top scored, non community-wiki answers of a minimum length are eligible