Here are some notes as me reading the "use-package User Manual".
use-package
is a macro, to group emacs customization by packages. It put a list of variables assignments, key bindings, hooks into their package group, and saving some typing...
So:
(setopt indent-tabs-mode nil)
(setopt browser-url-browser-function 'w3m-browse-url)
(setopt rcirc-track-minor-mode t)
(global-set-key (kbd "C-z") 'eshell)
I was not aware setopt
, and it seems setopt can replace custom-set-variables
, not tried, but now I have use-package
builtin, so I don't have to try...
Can become:
(use-package emacs
:custom
(indent-tabs-mode nil)
:bind
(("C-z" . eshell)))
(use-package rcirc
:custom
(rcirc-track-minor-mode t))
(use-package w3m
:custom
(browser-url-browser-function 'w3m-browse-url))
Which may be more clear to me.
use-package can speed up emacs startup, by don't load packages immediate, defer their loading. Okay I don't have use for that, can ignore.
Configure a package by code can use :config
, :init
and :preface
,
preface
is first and be told that it's usually not needed. init
is before package loaded, config
is after package loaded, keep that in mind.
Most use cases should be :bind
, :hook
, :mode
, :interpreter
, :custom
and :custom-face
, seems straight.
I have a todo to write a post about my emacs config, using use-package
, later...