diff --git a/init.el b/init.el index 38c3e7d6..0bf6748a 100644 --- a/init.el +++ b/init.el @@ -148,6 +148,34 @@ melpa-stable.") (message "Loading tapped before-init file: %s" tapped-file) (load (file-name-sans-extension tapped-file))) +(require 'cl-lib) + +(defvar exordium--dbg-last-load-history nil) +(defvar exordium--dbg-last-load-path nil) + +(defun exordium--dbg-print-load-history-and-path (marker) + "Print all new entries in `load-history' and `load-path'. +Use MARKER to denote where it's been printed from." + (message "[%s] new load-history: %s" + marker + (mapcar #'file-truename + (cl-remove-if-not #'stringp + (mapcar #'car + (cl-subseq load-history + 0 + (cl-position exordium--dbg-last-load-history + load-history)))))) + (setq exordium--dbg-last-load-history (car load-history)) + (message "[%s] new load-path: %s" + marker + (cl-subseq load-path + 0 + (cl-position exordium--dbg-last-load-path + load-path))) + (setq exordium--dbg-last-load-path (car load-path))) + +(exordium--dbg-print-load-history-and-path "init") + (eval-and-compile (load (file-name-concat (locate-user-emacs-file "modules") "init-require"))) @@ -156,9 +184,13 @@ melpa-stable.") ;; Use M-x `package-list-package' to load and display the list of packages, ;; then press I to mark for installation and X to execute (it's like `dired'). +(exordium--dbg-print-load-history-and-path "after init-require") + ;; Initialize the package system (require 'package) +(exordium--dbg-print-load-history-and-path "after package") + (add-to-list 'package-archives (cons "melpa" exordium-melpa-package-repo) t) @@ -183,11 +215,18 @@ melpa-stable.") (package-refresh-contents) (package-install 'use-package)) +(exordium--dbg-print-load-history-and-path "after refresh") + + ;; This is only needed once, near the top of the file (require 'use-package) +(exordium--dbg-print-load-history-and-path "after use-package") + (exordium-require 'init-force-elpa) +(exordium--dbg-print-load-history-and-path "after force-elpa") + ;; Pin user extra packages early, in case they are dependencies of some other ;; packages that are installed early. (dolist (pkg exordium-extra-pinned) @@ -199,6 +238,8 @@ melpa-stable.") (use-package-always-ensure t) (use-package-compute-statistics t)) +(exordium--dbg-print-load-history-and-path "after use-package config") + ;; Some packages (i.e., magit, forge) require relatively new package `seq'. ;; Unfortunately, `package' is unable to bump the built-in `seq'. Ensure it is ;; installed in the newest available version. @@ -206,6 +247,8 @@ melpa-stable.") :defer t :exordium-force-elpa gnu) +(exordium--dbg-print-load-history-and-path "after seq") + ;; `org' may be upgraded from ELPA (for example, as a part of a first start) ;; and some packages depend on it. To prevent loading a built in version by ;; such packages make sure `org' has been upgraded early. @@ -213,17 +256,23 @@ melpa-stable.") :defer t :exordium-force-elpa gnu) +(exordium--dbg-print-load-history-and-path "after org") + (use-package diminish :exordium-force-elpa gnu) (use-package bind-key :exordium-force-elpa gnu) +(exordium--dbg-print-load-history-and-path "after bind-key") + (dolist (pkg (append exordium-extra-packages (mapcar #'car exordium-extra-pinned))) (unless (package-installed-p pkg) (package-install pkg))) + +(exordium--dbg-print-load-history-and-path "after bind-key") ;; Byte recompile modules, if necessary @@ -252,6 +301,7 @@ Also discard .elc without corresponding .el." (delete-file elc))))))) (exordium-recompile-modules) +(exordium--dbg-print-load-history-and-path "after recompile modules") ;; Exordium's CI sometimes signals `ask-user-about-lock' cannot be used in non ;; interactive mode. It used to be that `helm' (and perhaps other packages as @@ -340,11 +390,17 @@ Also remove temp file and relevant entry from This is to mimic what `package-unpack' does: it reloads package after it's been byte compiled." (when-let* ((desc (package-load-descriptor (car args)))) + (exordium--dbg-print-load-history-and-path + (format "before reloading %s" + (package-desc-name desc))) (cond ((fboundp 'package--reload-previously-loaded) ;; Since Emacs-29 (package--reload-previously-loaded desc)) ((fboundp 'package--load-files-for-activation) ;; Until Emacs-28 - (package--load-files-for-activation desc :reload))))) + (package--load-files-for-activation desc :reload))) + (exordium--dbg-print-load-history-and-path + (format "after reloading %s" + (package-desc-name desc))))) :config (advice-add 'async-byte-compile-file @@ -357,6 +413,8 @@ after it's been byte compiled." :after #'exordium--async-package-reload-previously-loaded) (async-bytecomp-package-mode)) +(exordium--dbg-print-load-history-and-path "after async") + ;;; Load Modules @@ -364,6 +422,7 @@ after it's been byte compiled." (exordium-require 'init-lib) ; Utility functions - load this first (exordium-require 'init-environment) ; environment variables +(exordium--dbg-print-load-history-and-path "after environment") (dolist (tapped-file exordium-tapped-prefs-files) (message "Loading tapped prefs file: %s" tapped-file) @@ -379,6 +438,8 @@ after it's been byte compiled." (when exordium-theme (exordium-require 'init-themes)) +(exordium--dbg-print-load-history-and-path "after themes") + ;; Look and feel (exordium-require 'init-look-and-feel) ; fonts, UI, keybindings, saving files etc. (exordium-require 'init-font-lock) ; enables/disables font-lock globally. @@ -387,6 +448,8 @@ after it's been byte compiled." (exordium-require 'init-smooth-scroll) (smooth-scroll-mode 1)) ; smooth scroll +(exordium--dbg-print-load-history-and-path "after smooth-scroll") + (update-progress-bar) ;; Usability @@ -396,6 +459,8 @@ after it's been byte compiled." (exordium-require 'init-ido)) ; supercharged completion engine (exordium-require 'init-highlight) ; highlighting current line, symbol under point +(exordium--dbg-print-load-history-and-path "after highlight") + (pcase exordium-complete-mode (:auto-complete (exordium-require 'init-autocomplete)) @@ -408,6 +473,8 @@ after it's been byte compiled." (when (and exordium-projectile exordium-helm-projectile) (exordium-require 'init-helm-projectile)) +(exordium--dbg-print-load-history-and-path "after helm") + (when exordium-help-extensions (exordium-require 'init-help)) ; extra help @@ -419,6 +486,8 @@ after it's been byte compiled." (exordium-require 'init-forge) ; Forge (exordium-require 'init-flb-mode) ; frame-local buffers +(exordium--dbg-print-load-history-and-path "after flb") + (update-progress-bar) ;; Prog mode @@ -436,6 +505,8 @@ after it's been byte compiled." (when exordium-osx (exordium-require 'init-osx)) +(exordium--dbg-print-load-history-and-path "after osx") + ;; C++ (exordium-require 'init-cpp) (exordium-require 'init-bde-style) @@ -443,6 +514,8 @@ after it's been byte compiled." (exordium-require 'init-yasnippet)) (exordium-require 'init-gdb) +(exordium--dbg-print-load-history-and-path "after gdb") + ;; RTags (exordium-require 'init-rtags nil :functions (rtags-auto-complete)) @@ -477,6 +550,8 @@ after it's been byte compiled." ;; include-what-you-use (exordium-require 'init-iwyu) +(exordium--dbg-print-load-history-and-path "after iwyu") + (update-progress-bar) (when (and exordium-theme exordium-enable-powerline) @@ -496,6 +571,8 @@ after it's been byte compiled." (when exordium-lsp-mode-enable (exordium-require 'init-lsp)) +(exordium--dbg-print-load-history-and-path "after lsp") + ;; Desktop - close to the end so customisations had a chance to kick in (when exordium-desktop (exordium-require 'init-desktop)) @@ -505,6 +582,8 @@ after it's been byte compiled." (message "Loading tapped after-init file: %s" tapped-file) (load (file-name-sans-extension tapped-file))) +(exordium--dbg-print-load-history-and-path "after tapped after-init") + (update-progress-bar) ;; Greetings