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.

54 lines
1.7 KiB

  1. ;; -*- lexical-binding: t; -*-
  2. ;;; custom-package-setup --- Provide setup for packages and use-package
  3. ;; Configure Melpa
  4. ;; Package management
  5. ;; set load-path manually
  6. ;; don't call package-initialize
  7. (eval-and-compile
  8. (setq load-prefer-newer t
  9. package-user-dir "~/.emacs.d/elpa"
  10. package--init-file-ensured t ; so it doesn't call package initialize
  11. package-enable-at-startup nil) ; do not automatically load packages
  12. (unless (file-directory-p package-user-dir)
  13. (make-directory package-user-dir t)))
  14. (setq use-package-verbose t
  15. use-package-always-defer nil ;I'm not used to that
  16. use-package-minimum-reported-time 0.01)
  17. ;; Initialize package management
  18. (eval-when-compile ; when byte compiled skip this
  19. (require 'package)
  20. ;; add aditional package archives
  21. (setq package-archives
  22. `(("gnu" . "https://elpa.gnu.org/packages/")
  23. ("melpa" . "https://melpa.org/packages/")
  24. ("org" . "https://orgmode.org/elpa/")))
  25. ;; initialize packages and ensure that use-package is installed
  26. (package-initialize)
  27. (unless (package-installed-p 'use-package)
  28. (package-refresh-contents)
  29. (package-install 'use-package)) ; install if it's missing
  30. (unless (package-installed-p 'diminish)
  31. (package-refresh-contents)
  32. (package-install 'diminish)) ; install if it's missing
  33. (require 'use-package)
  34. (require 'bind-key)
  35. (require 'diminish)
  36. (setq use-package-always-ensure t))
  37. (eval-and-compile
  38. (require 'use-package)
  39. (require 'bind-key)
  40. (require 'diminish)
  41. (bind-keys :prefix-map my-ctrl-x-b-map
  42. :prefix "C-x b")
  43. (bind-keys :prefix-map my-ctrl-x-ctrl-l-map
  44. :prefix "C-x C-l"))
  45. (provide 'custom-package-setup)