20

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-buffer helm-map)) Use C-h v helm-map to find which module the keymap is defined in, and thus what to put in the string on the first line. with-eval-after-load was ...


17

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 org-plus-contrib :config (progn ;; config stuff )) Here are some explanation notes for the above: (use-package FEATURE-NAME FEATURE-NAME is what ...


16

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 argument makes sure that you are getting the version with all the extras. Of course you also need to have ("org" . "http://orgmode.org/elpa/") in your package-...


15

With your current configuration, you've effectively disabled package.el, as you don't initialise the package manager and prevent Emacs from automatically initialising it. All you do in return is to add ELPA to the load-path, but that's just a small subset of what package.el does. I'm not sure why you do that, but it's not a setup that I'd recommend. ...


15

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 check what's new at the same time. I've got a couple tweaks to simplify this (see below). I suspect upgrading could be automated, but you do want to consider the ...


14

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 time the package is actually loaded. In your example, the use of mode implicitly defers loading the package. You have configured the package to be loaded the ...


14

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\\'" . markdown-mode))) In general, to see what any macro is expanding to, take the cursor to the closing parenthesis of that macro and do M-x pp-macroexpand-...


13

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 to unbind-key is a key map -- for example org-mode-map. This works for me: (require 'bind-key) (unbind-key "C-," org-mode-map) (unbind-key "C-'" org-mode-map) ...


12

Emacs' built-in package manager, and thus use-package as well, automatically installs the latest version a package, across all repositories. Normally, that means packages are installed from MELPA, because MELPA serves the highest version numbers. However, from Emacs 24.4 onwards you can pin individual packages to specific archives with the :pin keyword: (...


12

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-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) (add-to-list 'package-archives '("melpa" . "http://...


12

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 familiarise yourself with the meaning of these keywords by reading the README file of use-package. In summary, the :init block is run at startup, as if you had ...


11

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 installed packages.


11

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


11

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 names a feature (see (elisp) Named Features) provided by the auctex package. In other words, tex names a single file tex.el which is distributed as part of the ...


10

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 figure out a package's name. If you want to know which package a variable belongs to, do C-h v or M-x describe-variable followed by the var name (for a function ...


10

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 (setq auto-package-update-delete-old-versions t auto-package-update-interval 4) (auto-package-update-maybe)) With that setup, packages will be ...


9

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-package helm :config (progn (bind-key "M-Y" #'helm-end-of-buffer helm-map) (bind-key "M-k" #'helm-next-line helm-find-files-map))) (use-package gnus :...


9

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

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 provided. The :init and :config keywords are what you are looking for: They allow you to respectively execute code before and after the package is loaded. ...


8

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 :init :bind ("<f7>" . ace-jump-mode))


8

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 use it to manage you package loads.


8

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 backslashes for nothing. You could also write it :mode "\\.\\(js\\|jsx\\)\\'" or many other ways, of course.


8

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 :config (global-whitespace-mode) :bind (([f10] . whitespace-mode) ([(shift f10)] . global-whitespace-mode))) will automatically defer loading the ...


8

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-interval 4) (auto-package-update-maybe)) With that setup, packages will be updated every 4 days, and the old packages will be removed.


8

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 "~/.emacs.d/packages/dired+") Another option is to use a dired+ repository mirror in github, along with a tool like quelpa, which allows you to fetch packages ...


7

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-package ace-window :ensure t :defer t :config (progn (message "ace window: hello world"))) Now open your emacs and see in the *Messages* buffer to ...


6

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 quelpa source package name or recipe, for example: (use-package flycheck-pony :quelpa (flycheck-pony :fetcher github :repo "rmloveland/flycheck-pony"))


6

I don’t know Elpy, so I’m not sure whether I understand your problem correctly. I do know use-package, though, and recently suffered from the very same issue, namely the removal of :idle. Basically, there are two ways out, depending on how you need to use Elpy. You can either use a poor man’s :idle, with run-with-idle-timer, e.g. :init (run-with-idle-...


6

Debugger entered--Lisp error: (error "Package ‘dired-’ is unavailable") You get this error when package.el tries to install a non-existent package. use-package will attempt to install the given package name if you pass or :ensure t or you have set use-package-always-ensure to non-nil. Use :ensure nil to override use-package-always-ensure. You need to do ...


6

The :ensure option in use-package does not automatically keep packages up to date. It ensures that the package is installed. This might be useful if you pull your Emacs config on to a new machine (or are using it across several machines), because when you start up all your required packages would get installed. You'll still need to deal with installing ...


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