Skip to content

Commit

Permalink
tweak(straight): cleanup old byte compiled Elisp
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Oct 20, 2023
1 parent fd07d8b commit 733c89b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
16 changes: 16 additions & 0 deletions core/me-bootstrap.el
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@
;; Make the expanded code as minimal as possible, do not try to catch errors
use-package-expand-minimally (not minemacs-debug))

;;;###autoload
(defun +straight-compile-prune-cache ()
(let* ((straight-dir (file-name-concat straight-base-dir "straight/"))
(builds (seq-filter
(lambda (name)
(not (member name (list straight-build-dir
(concat straight-build-dir "-cache.el")
"versions"
"repos"))))
(directory-files straight-dir nil "[^.][^.]?$"))))
(dolist (file builds)
(let ((default-directory straight-dir))
(if (file-directory-p file)
(delete-directory file 'recursive 'trash)
(delete-file file 'trash))))))


(provide 'me-bootstrap)

Expand Down
5 changes: 5 additions & 0 deletions core/me-loaddefs.el
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,11 @@ Unmount eCryptfs' private directory." t)

(register-definition-prefixes "me-backports-29" '("loaddefs-generate" "messages-buffer-name" "native-compile-prune-cache" "scratch-buffer" "setopt" "with-memoization"))


;;; Generated autoloads from me-bootstrap.el

(autoload '+straight-compile-prune-cache "me-bootstrap")


;;; Generated autoloads from ../modules/extras/me-cape-super-capf.el

Expand Down
11 changes: 7 additions & 4 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,13 @@
(when (file-exists-p user-config)
(+load user-config))))

(+lazy-when! (featurep 'native-compile)
(+info! "Trying to clean outdated native compile cache")
;; Delete outdated natively compiled files when Emacs become idle
(+shutup! (native-compile-prune-cache)))
(+lazy!
(when (featurep 'native-compile)
(+info! "Trying to clean outdated native compile cache")
;; Delete outdated natively compiled files when Emacs become idle
(+shutup! (native-compile-prune-cache)))
(+shutup! (+straight-compile-prune-cache)))


(+log! "Loaded init.el")

Expand Down

0 comments on commit 733c89b

Please sign in to comment.