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 ...
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 ...
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 ...
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-...
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\\'" ...
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 ...
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 ...
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 ...
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
...
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 ...
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)
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 (...
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 ...
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-...
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-...
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-...
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 ...
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
:...
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 "~/....
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
:...
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 ...
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
:...
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-...
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.
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
use-package × 211init-file × 33
package × 32
key-bindings × 25
org-mode × 11
autoload × 11
hooks × 8
debugging × 7
package-repositories × 7
dired × 5
spacemacs × 4
magit × 4
emacsclient × 4
major-mode × 4
keymap × 4
projectile × 4
ess × 4
require × 4
python × 3
helm × 3
themes × 3
yasnippet × 3
start-up × 3
byte-compilation × 3
lsp-mode × 3