UsePackage

use-package is a declarative way to load packages in your init.el.

use-package aims to decrease Emacs startup time by loading packages on use rather than on startup

I have over 80 packages and things were getting difficult to manage. With this utility my total load time is around 2 seconds, with no loss of functionality!

use-package is included as of Emacs 29.1

Configuration

A simple use-package declaration may look like:

(use-package dired-x)

(use-package dired
  :bind (("C-c d" . dired-jump)
	 :map dired-mode-map
	 ("/" . dired-omit-mode)
	 ("h" . dired-hide-details-mode)
	 ("-" . dired-up-directory))
  :hook '((dired-hide-details-mode)
	  (dired-omit-mode))
  :config
  (setq
   dired-x-hands-off-my-keys nil
   ls-lisp-dirs-first t
   ls-lisp-use-insert-directory-program nil))

It customizes Dired. With this configuration, dired and its configuration are not loaded until dired is called.

The syntax used in this example is explained below:

(use-package package-name
  :bind   -- A list of global keybindings
    :map  -- A list of local  keybindings
  :hook   -- A list of hooks
  :config -- Variables to set after the package is loaded