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 ...
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 ...
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.
:mode (("\\.org$" . org-mode))
;; config stuff
Here are some explanation notes for the above:
FEATURE-NAME is what ...
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):
(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 ...
The correct way to do this with use-package is as follows:
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-...
The right way to do it would be
:mode ("\\.markdown\\'" "\\.md\\'"))
: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-...
You can use auto-package-update to automatically update packages.
Copied from my other post (https://emacs.stackexchange.com/a/31903/9972)
(setq auto-package-update-delete-old-versions t
With that setup, packages will be ...
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 ...
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 ...
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)
The second argument to unbind-key is a key map -- for example org-mode-map.
This works for me:
(unbind-key "C-," org-mode-map)
(unbind-key "C-'" org-mode-map)
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 (package-initialize) before you can call on any installed packages, such as use-package.
From Emacs 27 onwards, package-initialize will effectively be called ...
The package's name is compile.
Below should work.
(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 ...
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):
'("marmalade" . "http://marmalade-repo.org/packages/"))
'("melpa" . "http://...
I use auto-package-update to automatically update packages.
(setq auto-package-update-delete-old-versions t
With that setup, packages will be updated every 4 days, and the old packages will be removed.
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 to run M-x package-refresh-contents so that there is one. Alternatively, use M-x package-list-packages for installing packages, that ensures that the 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:
(message "ace window: hello world")))
Now open your emacs and see in the *Messages* buffer to ...
IIUC what you want to do is:
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.
I don't know why company-mode is getting diminished, but I think I know what's going on with whitespace-mode. Your block
:ensure t ;; I also tried without this line
(([f10] . whitespace-mode)
([(shift f10)] . global-whitespace-mode)))
will automatically defer loading the ...
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
(bind-key "M-Y" #'helm-end-of-buffer helm-map)
(bind-key "M-k" #'helm-next-line helm-find-files-map)))
You need to quote "<f11>", like this:
:bind ("<f11>" . multi-term)
And here's a full example, with ace-jump-mode:
:bind ("<f7>" . ace-jump-mode))
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:
before you can use it to manage you package loads.
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:
:quelpa (flycheck-pony :fetcher github :repo "rmloveland/flycheck-pony"))
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.
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
or many other ways, of course.
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:
:mode (("\\.php$" . web-mode)
("\\.html$" . web-mode))
:hook (web-mode . dg/web-mode-hook)
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:
Another option is to use a dired+ repository mirror in github, along with a tool like quelpa, which allows you to fetch packages ...