From 0c23ff43a4787c6ba0e8e59c7e17d1400150e44e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 11 Apr 2017 08:43:26 -0400 Subject: [PATCH] Add doom-protected-packages for excluding packages from autoremoval --- core/autoload/packages.el | 3 ++- core/core-os.el | 5 +++++ core/core-packages.el | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/autoload/packages.el b/core/autoload/packages.el index 04278e50d..f79eb7e2e 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -108,7 +108,8 @@ Used by `doom/packages-autoremove'." (doom-initialize-packages t) (let ((package-selected-packages (append (mapcar 'car doom-packages) doom-core-packages))) - (package--removable-packages))) + (cl-set-difference (package--removable-packages) + doom-protected-packages))) ;;;###autoload (defun doom-get-missing-packages () diff --git a/core/core-os.el b/core/core-os.el index 1720d8479..181c87a77 100644 --- a/core/core-os.el +++ b/core/core-os.el @@ -3,6 +3,11 @@ (defconst IS-MAC (eq system-type 'darwin)) (defconst IS-LINUX (eq system-type 'gnu/linux)) +;; In case this config is shared across multiple computers (like mine are), +;; let's protect these from autoremoval. +(push 'exec-path-from-shell doom-protected-packages) +(push 'osx-clipboard doom-protected-packages) + ;; clipboard (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING) ;; Use a shared clipboard diff --git a/core/core-packages.el b/core/core-packages.el index d3a8cbdd8..a90538cb8 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -54,6 +54,9 @@ package's name as a symbol, and whose CDR is the plist supplied to its "A list of packages that must be installed (and will be auto-installed if missing) and shouldn't be deleted.") +(defvar doom-protected-packages nil + "A list of packages that shouldn't be deleted by `doom/packages-autoremove'.") + (defvar doom-init-time nil "The time it took, in seconds, for DOOM Emacs to initialize.")