From: Artur Malabarba Date: Tue, 30 Jun 2015 09:17:55 +0000 (+0100) Subject: * lisp/emacs-lisp/package.el (package--save-selected-packages): X-Git-Tag: emacs-25.0.90~1606 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d0a5162fd825acbbd863e61099e1fa1ce5975773;p=emacs.git * lisp/emacs-lisp/package.el (package--save-selected-packages): Don't save before init time, to avoid overwriting configurations. (Bug#20855) --- diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 9f563457748..e599e840fb7 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1620,12 +1620,14 @@ Used to populate `package-selected-packages'." unless (memq name dep-list) collect name))) -(defun package--save-selected-packages (value) +(defun package--save-selected-packages (&optional value) "Set and save `package-selected-packages' to VALUE." - (let ((save-silently inhibit-message)) - (customize-save-variable - 'package-selected-packages - (setq package-selected-packages value)))) + (when value + (setq package-selected-packages value)) + (if after-init-time + (let ((save-silently inhibit-message)) + (customize-save-variable 'package-selected-packages package-selected-packages)) + (add-hook 'after-init-hook #'package--save-selected-packages))) (defun package--user-selected-p (pkg) "Return non-nil if PKG is a package was installed by the user.