My attempt to optimize my emacs load time <1 second
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

73 lines
2.4 KiB

;;; 02-custom-package-setup --- Provide setup for packages and use-package
;;; Commentary:
;; Configure Melpa
;; Package management
;; set load-path manually
;; don't call package-initialize
;;; Code:
(eval-and-compile
(setq load-prefer-newer t
package-user-dir (concat user-emacs-directory "elpa")
package--init-file-ensured t ; so it doesn't call package initialize
package-enable-at-startup nil) ; do not automatically load packages
(unless (file-directory-p package-user-dir)
(make-directory package-user-dir t)))
(setq use-package-verbose t
use-package-always-defer t ; this is default, but setting here anyway for clarity
use-package-minimum-reported-time 0.01)
;; Initialize package management
(eval-when-compile ; when byte compiled skip this
(require 'package)
;; add aditional package archives
(setq package-archives
`(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")))
;; initialize packages and ensure that use-package is installed
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package)) ; install if it's missing
(unless (package-installed-p 'diminish)
(package-refresh-contents)
(package-install 'diminish)) ; install if it's missing
(require 'use-package)
(require 'bind-key)
(require 'diminish)
(setq use-package-always-ensure t))
(eval-and-compile
(require 'use-package)
(require 'bind-key)
(require 'diminish)
(bind-keys :prefix-map my-ctrl-x-b-map
:prefix "C-x b")
(bind-keys :prefix-map my-ctrl-x-ctrl-l-map
:prefix "C-x C-l")
(bind-keys :prefix-map my-ctrl-c-h-map
:prefix "C-c h")
)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(provide '02-custom-package-setup)
;;; 02-custom-package-setup.el ends here