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