Use use-package-{check-before-init,always-defer} to speed/quiet loading

This commit is contained in:
Adam Goldsmith 2019-07-21 00:42:18 -04:00
parent cb798a6b74
commit 7cfdcd3946

View File

@ -28,11 +28,15 @@
(unless (package-installed-p 'use-package) (unless (package-installed-p 'use-package)
(package-refresh-contents) (package-refresh-contents)
(package-install 'use-package)) (package-install 'use-package))
(use-package quelpa :ensure (use-package use-package
:config
(setq use-package-check-before-init t
use-package-always-defer t))
(use-package quelpa :ensure :demand
:init :init
(setq quelpa-update-melpa-p nil) (setq quelpa-update-melpa-p nil)
:config :config
(use-package quelpa-use-package :ensure)) (use-package quelpa-use-package :ensure :demand))
;;;; not sure where to put this ;;;; not sure where to put this
(defun open-thunar-in-current-directory () (defun open-thunar-in-current-directory ()
@ -47,21 +51,20 @@
(bind-key "s-t" 'open-thunar-in-current-directory) (bind-key "s-t" 'open-thunar-in-current-directory)
;;;; internal packages ;;;; internal packages
(use-package tool-bar (use-package tool-bar :demand
:config :config
(when (fboundp 'tool-bar-mode) (when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))) (tool-bar-mode -1)))
(use-package savehist (use-package savehist :demand
:config :config
(savehist-mode)) (savehist-mode))
(use-package paren (use-package paren :demand
:config :config
(show-paren-mode 1)) (show-paren-mode 1))
(use-package sh-script (use-package sh-script
:defer
:config :config
(add-hook 'sh-mode-hook (lambda () (setq tab-width 4)))) (add-hook 'sh-mode-hook (lambda () (setq tab-width 4))))
@ -101,7 +104,6 @@
(lambda (x) (setq-local scroll-up-aggressively 0.0)))) (lambda (x) (setq-local scroll-up-aggressively 0.0))))
(use-package verilog-mode (use-package verilog-mode
:defer
:config :config
(setq verilog-indent-level 4 (setq verilog-indent-level 4
verilog-indent-level-behavioral 4 verilog-indent-level-behavioral 4
@ -113,7 +115,6 @@
(add-to-list 'company-keywords-alist (cons 'verilog-mode verilog-keywords))) (add-to-list 'company-keywords-alist (cons 'verilog-mode verilog-keywords)))
(use-package python (use-package python
:defer
:config :config
(when (executable-find "ipython") (when (executable-find "ipython")
(setq python-shell-interpreter "ipython") (setq python-shell-interpreter "ipython")
@ -147,7 +148,6 @@
'(lambda () (setq-local show-trailing-whitespace nil)))) '(lambda () (setq-local show-trailing-whitespace nil))))
(use-package semantic (use-package semantic
:defer
:hook (c-mode . semantic-mode) :hook (c-mode . semantic-mode)
:config :config
(setq semantic-default-submodes '(global-semantic-idle-scheduler-mode (setq semantic-default-submodes '(global-semantic-idle-scheduler-mode
@ -179,7 +179,6 @@
'(lambda () (setq-local comint-prompt-read-only t)))) '(lambda () (setq-local comint-prompt-read-only t))))
(use-package org (use-package org
:defer
:bind (:map org-mode-map (("C-z" . org-latex-export-to-pdf-no-kr) :bind (:map org-mode-map (("C-z" . org-latex-export-to-pdf-no-kr)
("M-[" . org-metaleft) ("M-[" . org-metaleft)
("M-]" . org-metaright) ("M-]" . org-metaright)
@ -256,7 +255,7 @@
'org-babel-load-languages 'org-babel-load-languages
'((ipython . t))))) '((ipython . t)))))
(use-package windmove (use-package windmove :demand
:config :config
(windmove-default-keybindings)) (windmove-default-keybindings))
@ -275,7 +274,7 @@
(add-hook 'prog-mode-hook (add-hook 'prog-mode-hook
#'(lambda () (setq-local show-trailing-whitespace t)))) #'(lambda () (setq-local show-trailing-whitespace t))))
(use-package frame (use-package frame :demand
:config :config
(defun suspend-frame () (defun suspend-frame ()
"If running in a secondary tty, call `suspend-tty', else nop" "If running in a secondary tty, call `suspend-tty', else nop"
@ -302,7 +301,7 @@
(server-start)) (server-start))
;;;; external packages (required) ;;;; external packages (required)
(use-package delight :ensure) (use-package delight :ensure :demand)
(use-package company :ensure :demand (use-package company :ensure :demand
:delight :delight
@ -313,12 +312,12 @@
company-dabbrev-downcase nil company-dabbrev-downcase nil
company-dabbrev-ignore-case nil) company-dabbrev-ignore-case nil)
(use-package company-posframe :ensure (use-package company-posframe :ensure :demand
:delight :delight
:config :config
(company-posframe-mode 1)) (company-posframe-mode 1))
(use-package company-quickhelp :ensure (use-package company-quickhelp :ensure :demand
:disabled :disabled
:config :config
(company-quickhelp-mode 1) (company-quickhelp-mode 1)
@ -331,7 +330,7 @@
:config :config
(company-statistics-mode))) (company-statistics-mode)))
(use-package smart-mode-line :ensure (use-package smart-mode-line :ensure :demand
:config :config
(setq sml/no-confirm-load-theme t) (setq sml/no-confirm-load-theme t)
(sml/setup) (sml/setup)
@ -369,6 +368,8 @@
:delight :delight
:config :config
(ivy-mode 1)) (ivy-mode 1))
(use-package ivy-hydra :ensure)
(defun ivy-backward-delete-char () (defun ivy-backward-delete-char ()
"Forward to `backward-delete-char'. "Forward to `backward-delete-char'.
Do less dumb things with directories Do less dumb things with directories
@ -392,8 +393,6 @@
(when ivy-on-del-error-function (when ivy-on-del-error-function
(funcall ivy-on-del-error-function))))))) (funcall ivy-on-del-error-function)))))))
(use-package ivy-hydra :ensure)
(use-package counsel :ensure (use-package counsel :ensure
:bind (("M-x" . counsel-M-x) :bind (("M-x" . counsel-M-x)
("C-M-y" . counsel-yank-pop) ("C-M-y" . counsel-yank-pop)
@ -420,7 +419,7 @@
(use-package ace-window :ensure (use-package ace-window :ensure
:bind ("M-S-p" . ace-window)) :bind ("M-S-p" . ace-window))
(use-package undo-tree :ensure (use-package undo-tree :ensure :demand
:delight :delight
:config :config
(bind-key "M-/" 'undo-tree-visualize) (bind-key "M-/" 'undo-tree-visualize)
@ -457,17 +456,15 @@
(use-package dired+ (use-package dired+
:quelpa (dired+ :fetcher url :url "https://www.emacswiki.org/emacs/download/dired+.el") :quelpa (dired+ :fetcher url :url "https://www.emacswiki.org/emacs/download/dired+.el")
:defer
:init :init
(setq diredp-hide-details-initially-flag nil) (setq diredp-hide-details-initially-flag nil)
:config :config
(toggle-diredp-find-file-reuse-dir 1)) (toggle-diredp-find-file-reuse-dir 1))
(use-package outline-magic :ensure (use-package outline-magic :ensure :demand
:demand
:bind (:map outline-minor-mode-map ("M-<tab>" . outline-cycle))) :bind (:map outline-minor-mode-map ("M-<tab>" . outline-cycle)))
(use-package column-enforce-mode :ensure (use-package column-enforce-mode :ensure :demand
:delight :delight
:config :config
:hook prog-mode) :hook prog-mode)
@ -478,12 +475,12 @@
:bind ("C-S-<right>" . forward-mark) :bind ("C-S-<right>" . forward-mark)
:bind ("C-S-<down>" . show-marks)) :bind ("C-S-<down>" . show-marks))
(use-package immortal-scratch :ensure (use-package immortal-scratch :ensure :demand
:config :config
(setq immortal-scratch-switch-to-respawned-scratch t) (setq immortal-scratch-switch-to-respawned-scratch t)
(immortal-scratch-mode t)) (immortal-scratch-mode t))
(use-package frames-only-mode :ensure (use-package frames-only-mode :ensure :demand
:config :config
; seems to need to be before mode init ; seems to need to be before mode init
(add-to-list 'frames-only-mode-use-window-functions 'undo-tree-visualize) (add-to-list 'frames-only-mode-use-window-functions 'undo-tree-visualize)
@ -863,7 +860,7 @@
("claremontmakerspace\\.org" . mediawiki-mode) ("claremontmakerspace\\.org" . mediawiki-mode)
))) )))
(use-package which-key (use-package which-key :demand
:delight :delight
:config :config
(which-key-mode) (which-key-mode)