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

5 years ago
5 years ago
  1. ;;; 02-custom-package-setup --- Provide setup for packages and use-package
  2. ;;; Commentary:
  3. ;; Configure Melpa
  4. ;; Package management
  5. ;; set load-path manually
  6. ;; don't call package-initialize
  7. ;;; Code:
  8. (eval-and-compile
  9. (setq load-prefer-newer t
  10. package-user-dir (concat user-emacs-directory "elpa")
  11. package--init-file-ensured t ; so it doesn't call package initialize
  12. package-enable-at-startup nil) ; do not automatically load packages
  13. (unless (file-directory-p package-user-dir)
  14. (make-directory package-user-dir t)))
  15. (setq use-package-verbose t
  16. use-package-always-defer t ; this is default, but setting here anyway for clarity
  17. use-package-minimum-reported-time 0.01)
  18. ;; Initialize package management
  19. (eval-when-compile ; when byte compiled skip this
  20. (require 'package)
  21. ;; add aditional package archives
  22. (setq package-archives
  23. `(("gnu" . "https://elpa.gnu.org/packages/")
  24. ("melpa" . "https://melpa.org/packages/")
  25. ("org" . "https://orgmode.org/elpa/")))
  26. ;; initialize packages and ensure that use-package is installed
  27. (package-initialize)
  28. (unless (package-installed-p 'use-package)
  29. (package-refresh-contents)
  30. (package-install 'use-package)) ; install if it's missing
  31. (unless (package-installed-p 'diminish)
  32. (package-refresh-contents)
  33. (package-install 'diminish)) ; install if it's missing
  34. (require 'use-package)
  35. (require 'bind-key)
  36. (require 'diminish)
  37. (setq use-package-always-ensure t))
  38. (eval-and-compile
  39. (require 'use-package)
  40. (require 'bind-key)
  41. (require 'diminish)
  42. (bind-keys :prefix-map my-ctrl-x-b-map
  43. :prefix "C-x b")
  44. (bind-keys :prefix-map my-ctrl-x-ctrl-l-map
  45. :prefix "C-x C-l")
  46. (bind-keys :prefix-map my-ctrl-c-h-map
  47. :prefix "C-c h")
  48. )
  49. (defvar bootstrap-version)
  50. (let ((bootstrap-file
  51. (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
  52. (bootstrap-version 5))
  53. (unless (file-exists-p bootstrap-file)
  54. (with-current-buffer
  55. (url-retrieve-synchronously
  56. "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
  57. 'silent 'inhibit-cookies)
  58. (goto-char (point-max))
  59. (eval-print-last-sexp)))
  60. (load bootstrap-file nil 'nomessage))
  61. (provide '02-custom-package-setup)
  62. ;;; 02-custom-package-setup.el ends here