forked from ashton314/emacs-bedrock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgc.el
More file actions
34 lines (28 loc) · 1.44 KB
/
gc.el
File metadata and controls
34 lines (28 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;;; gc.el --- Backpack garbage collection mode -*- lexical-binding: t; -*-
;;
;; This file implements the `backpack gc' command which:
;; 1. Scans current configuration to determine which packages are needed
;; 2. Compares against installed packages
;; 3. Removes orphaned packages that are no longer required
;;
;; Usage: emacs --batch --eval "(setq user-emacs-directory \"/path/to/emacs-backpack/\")" -l gc.el
;; For dry-run: emacs --batch --eval "(setq user-emacs-directory \"/path/to/emacs-backpack/\")" -l gc.el --eval "(setq backpack-gc-dry-run t)"
;; Check for dry-run flag (can be set via command line)
(defvar backpack-gc-dry-run nil
"When non-nil, perform a dry run without deleting anything.")
;; Set up load paths for base-packages before loading backpack.el
(add-to-list 'load-path (expand-file-name "base-packages/leaf.el" user-emacs-directory))
(add-to-list 'load-path (expand-file-name "base-packages/leaf-keywords.el" user-emacs-directory))
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
;; Load backpack.el which sets up all the infrastructure
(let ((backpack-file (expand-file-name "lisp/backpack.el" user-emacs-directory)))
(load backpack-file nil nil nil t))
;; Run garbage collection
(message "")
(message "========================================")
(message "Backpack Garbage Collection")
(message "========================================")
(message "")
(backpack-gc backpack-gc-dry-run)
(message "")
(kill-emacs 0)