Skip to content

Commit

Permalink
tweak(core): don't auto cleanup MinEmacs' directory
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Apr 11, 2024
1 parent dcd02af commit 58cbde9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
13 changes: 0 additions & 13 deletions core/me-bootstrap.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@
;; Make the expanded code as minimal as possible, do not try to catch errors
use-package-expand-minimally (not minemacs-debug-p))

;;;###autoload
(defun +straight-prune-build-cache ()
"Prune straight.el build directories for old Emacs versions."
(let* ((default-directory (file-name-concat straight-base-dir "straight/")))
;; Prune the build cache and build directory.
(straight-prune-build)
;; Prune old build directories
(mapc (+apply-partially-right #'+delete-file-or-directory 'trash 'recursive)
(seq-filter
(lambda (name)
(not (member name (list straight-build-dir (concat straight-build-dir "-cache.el") "versions" "repos"))))
(directory-files default-directory nil "[^.][^.]?\\'")))))


(provide 'me-bootstrap)

Expand Down
25 changes: 25 additions & 0 deletions core/me-lib.el
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,31 @@ This calls `minemacs-update-restore-locked' asynchronously."
(mapc (+apply-partially-right #'+delete-file-or-directory 'trash 'recursive)
(directory-files minemacs-root-dir nil (rx (seq bol (or "eln-cache" "auto-save-list" "elpa") eol))))))

(defun +straight-prune-build-cache ()
"Prune straight.el build directories for old Emacs versions."
(let* ((default-directory (file-name-concat straight-base-dir "straight/")))
;; Prune the build cache and build directory.
(straight-prune-build)
;; Prune old build directories
(mapc (+apply-partially-right #'+delete-file-or-directory 'trash 'recursive)
(seq-filter
(lambda (name)
(not (member name (list straight-build-dir (concat straight-build-dir "-cache.el") "versions" "repos"))))
(directory-files default-directory nil "[^.][^.]?\\'")))))

(defun +minemacs-cleanup-emacs-directory ()
"Cleanup unwanted files/directories from MinEmacs' directory."
(interactive)
(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)))
(+info! "Trying to clean outdated straight build cache")
(+shutup! (+straight-prune-build-cache))
(+info! "Trying to clean MinEmacs' root directory")
(+shutup! (+minemacs-root-dir-cleanup)))




;;; Files, directories and IO helper functions
Expand Down
10 changes: 0 additions & 10 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,6 @@ goes idle."
;; Load user configuration
(+load-user-configs 'config 'local/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)))
(+info! "Trying to clean outdated straight build cache")
(+shutup! (+straight-prune-build-cache))
(+info! "Trying to clean MinEmacs' root directory")
(+shutup! (+minemacs-root-dir-cleanup)))


(+log! "Loaded init.el")

Expand Down

0 comments on commit 58cbde9

Please sign in to comment.