diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-10-18 16:27:27 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-10-18 16:27:27 +0100 |
commit | 0b7b8e2e7925c3fead94288756cce6ea83b7532b (patch) | |
tree | cc36f27b24659b5d7877bf308992a6997aab3e06 | |
parent | e1f7d9ddcd335b99f4a672579189ba8c1f43c915 (diff) | |
download | dotfiles-0b7b8e2e7925c3fead94288756cce6ea83b7532b.tar.gz |
Try a difference approach to upgraded packages
-rw-r--r-- | .emacs.d/init.el | 66 | ||||
-rw-r--r-- | .emacs.d/lisp/init-packages.el | 22 |
2 files changed, 44 insertions, 44 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 74fcacf..18e46f4 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -28,34 +28,42 @@ (setq gc-cons-threshold (* 100 1024 1024) gc-cons-percentage 0.1))) -(require 'init-packages) -(require 'init-ui) -(require 'init-compile) -(require 'init-editor) -(require 'init-search) -(require 'init-windows) -(require 'init-project) -(require 'init-modeline) -(require 'init-completion) -(require 'init-minibuffer) -(require 'init-navigation) -(require 'init-kill) -(require 'init-dired) -(require 'init-smartparens) -(require 'init-emacs-lisp) -(require 'init-clojure) -(require 'init-paredit) -(require 'init-crux) -(require 'init-lsp) -(require 'init-git) -(require 'init-shell) -(require 'init-org) -;;(require 'init-latex) -(require 'init-xml) -(require 'init-web) -(require 'init-misc) -(require 'init-tramp) -(require 'init-sql) -(require 'init-local nil t) +;; Some straight functions need to be able to reload everything, so require won't do +(defun require! (feature &optional filename noerror) + "Like `require', but if `force-reload' is non-nil, `load' instead. +`FEATURE', `FILENAME' and `NOERROR' have the same meaning as with require" + (if (and (boundp 'force-reload) force-reload) + (load (prin1-to-string feature) noerror nil nil t) + (require feature filename noerror))) + +(require! 'init-packages) +(require! 'init-ui) +(require! 'init-compile) +(require! 'init-editor) +(require! 'init-search) +(require! 'init-windows) +(require! 'init-project) +(require! 'init-modeline) +(require! 'init-completion) +(require! 'init-minibuffer) +(require! 'init-navigation) +(require! 'init-kill) +(require! 'init-dired) +(require! 'init-smartparens) +(require! 'init-emacs-lisp) +(require! 'init-clojure) +(require! 'init-paredit) +(require! 'init-crux) +(require! 'init-lsp) +(require! 'init-git) +(require! 'init-shell) +(require! 'init-org) +;;(require! 'init-latex) +(require! 'init-xml) +(require! 'init-web) +(require! 'init-misc) +(require! 'init-tramp) +(require! 'init-sql) +(require! 'init-local nil t) ;;; init.el ends here diff --git a/.emacs.d/lisp/init-packages.el b/.emacs.d/lisp/init-packages.el index cbfdb25..ecd429b 100644 --- a/.emacs.d/lisp/init-packages.el +++ b/.emacs.d/lisp/init-packages.el @@ -52,33 +52,25 @@ (use-package diminish) -(defun run-straight-lock-file-function (func) - "Safely run straight lockfile-related function `FUNC'. -This will remove all init-* files from `features', so that they are reloaded." - (setq features (seq-filter '(lambda (elt) (not (string-prefix-p "init-" (prin1-to-string elt)))) features)) - (funcall func)) - -(defun reload-init () - "Reload `user-init-file', ensuring that requires are reloaded." - (run-straight-lock-file-function #'(lambda () (load (or user-init-file "~/.emacs.d/init.el") nil 'nomessage)))) - ;; emacs --batch -l "~/.emacs.d/init.el" -f "my/upgrade-packages" (defun my/upgrade-packages () "Upgrade all packages installed with straight." (interactive) - (straight-pull-recipe-repositories) ;; TODO is this needed? + (setq-local force-reload t) + (straight-pull-recipe-repositories) (straight-x-fetch-all) + (while straight-x-running + (sleep-for 1)) (straight-merge-all) - (reload-init) (straight-check-all) - ;; Do this automatically, as we can always revert and thaw - (run-straight-lock-file-function 'straight-freeze-versions)) + (straight-freeze-versions)) ;; emacs --batch -l "~/.emacs.d/init.el" -f "my/thaw-packages" (defun my/thaw-packages () "Restore all packages to the versions in the straight lockfile." (interactive) - (run-straight-lock-file-function 'straight-thaw-versions)) + (setq-local force-reload t) + (straight-thaw-versions)) (provide 'init-packages) ;;; init-packages.el ends here |