diff --git a/core/core-command-line.el b/core/core-command-line.el index ce7c61190..f0e0ef031 100644 --- a/core/core-command-line.el +++ b/core/core-command-line.el @@ -17,7 +17,8 @@ "If non-nil force Spacemacs to operate without secured protocols.") (defvar spacemacs-sync-packages t - "If non-nil synchronize packages on startup") + "If non-nil packages are synchronized when the configuration layer system is +loaded.") (defun spacemacs//parse-command-line (args) "Handle Spacemacs specific command line arguments. @@ -56,7 +57,7 @@ arguments is that we want to process these arguments as soon as possible." i (1+ i))) ("--resume-layouts" (setq spacemacs-force-resume-layouts t)) - ("--no-sync" + ("--no-package-sync" (setq spacemacs-sync-packages nil)) (_ (push arg new-args)))) (setq i (1+ i))) diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index 29944a4fa..19f8d2862 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -69,11 +69,11 @@ ROOT is returned." (dir (car (directory-files elpa-dir 'full pkg-match)))) (when dir (file-name-as-directory dir)))))) -(defvar configuration-layer-pre-sync-hook nil - "Hook executed at the beginning of configuration synchronization.") +(defvar configuration-layer-pre-load-hook nil + "Hook executed at the beginning of configuration loading.") -(defvar configuration-layer-post-sync-hook nil - "Hook executed at the end of configuration synchronization.") +(defvar configuration-layer-post-load-hook nil + "Hook executed at the end of configuration loading.") (defvar configuration-layer-rollback-directory (concat spacemacs-cache-directory ".rollback/") @@ -436,10 +436,11 @@ refreshed during the current session." (package-read-all-archive-contents) (unless quiet (spacemacs-buffer/append "\n"))))) -(defun configuration-layer/sync (&optional install) - "Synchronize declared layers in dotfile with spacemacs. -If INSTALL is non nil then install missing packages." - (run-hooks 'configuration-layer-pre-sync-hook) +(defun configuration-layer/load () + "Load layers declared in dotfile and install associated packages. +To prevent package from being installed or uninstalled set the variable +`spacemacs-sync-packages' to nil." + (run-hooks 'configuration-layer-pre-load-hook) (dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...") (setq dotspacemacs--configuration-layers-saved dotspacemacs-configuration-layers) @@ -461,7 +462,7 @@ If INSTALL is non nil then install missing packages." ;; load layers lazy settings (configuration-layer/load-auto-layer-file) ;; install and/or uninstall packages - (when install + (when spacemacs-sync-packages (let ((packages (append ;; install used packages @@ -496,7 +497,7 @@ If INSTALL is non nil then install missing packages." (configuration-layer//configure-packages configuration-layer--used-packages) (configuration-layer//load-layers-files configuration-layer--used-layers '("keybindings.el")) - (run-hooks 'configuration-layer-post-sync-hook)) + (run-hooks 'configuration-layer-post-load-hook)) (defun configuration-layer/load-auto-layer-file () "Load `auto-layer.el' file" @@ -1440,7 +1441,8 @@ wether the declared layer is an used one or not." "layer %s, do you want to install it?") mode layer-name))) (when (dotspacemacs/add-layer layer-name) - (configuration-layer/sync 'no-install)) + (let (spacemacs-sync-packages) + (configuration-layer/load))) (let* ((layer (configuration-layer/get-layer layer-name)) (inst-pkgs (delq nil diff --git a/core/core-debug.el b/core/core-debug.el index c6f72b31b..37951b86a 100644 --- a/core/core-debug.el +++ b/core/core-debug.el @@ -136,12 +136,12 @@ seconds to load") (advice-add 'package-initialize :around (spacemacs||make-function-timer package-intialize)) - (advice-add 'configuration-layer/sync + (advice-add 'configuration-layer/load :around - (spacemacs||make-function-timer configuration-layer/sync)) - ;; (advice-add 'configuration-layer/sync + (spacemacs||make-function-timer configuration-layer/load)) + ;; (advice-add 'configuration-layer/load ;; :around - ;; (spacemacs||make-function-profiler configuration-layer/sync)) + ;; (spacemacs||make-function-profiler configuration-layer/load)) (advice-add 'configuration-layer//configure-package :around (spacemacs||make-function-timer configuration-layer//configure-package))) diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index 0ba60aef2..d36848174 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -493,7 +493,7 @@ Called with `C-u C-u' skips `dotspacemacs/user-config' _and_ preleminary tests." (setq dotspacemacs-editing-style (dotspacemacs//read-editing-style-config dotspacemacs-editing-style)) - (configuration-layer/sync) + (configuration-layer/load) (if (member arg '((4) (16))) (message (concat "Done (`dotspacemacs/user-config' " "function has been skipped).")) @@ -557,7 +557,7 @@ a display strng and the value is the actual value to return." (spacemacs-buffer/set-mode-line "Dotfile wizard installer") (spacemacs//redisplay) (when (dotspacemacs/install 'with-wizard) - (configuration-layer/sync)))) + (configuration-layer/load)))) (defun dotspacemacs/install (arg) "Install the dotfile, return non nil if the doftile has been installed. diff --git a/core/core-themes-support.el b/core/core-themes-support.el index b441be49a..8e72d6559 100644 --- a/core/core-themes-support.el +++ b/core/core-themes-support.el @@ -323,7 +323,7 @@ has been changed to THEME." (setcar theme2 pkg-name) (setq theme2 pkg-name)) (add-to-list 'dotspacemacs--additional-theme-packages theme2))))) -(add-hook 'configuration-layer-pre-sync-hook +(add-hook 'configuration-layer-pre-load-hook 'spacemacs//add-theme-packages-to-additional-packages) (provide 'core-themes-support) diff --git a/init.el b/init.el index 0211d7471..34d14a72a 100644 --- a/init.el +++ b/init.el @@ -27,7 +27,7 @@ "core/core-load-paths.el")) (require 'core-spacemacs) (spacemacs/init) - (configuration-layer/sync spacemacs-sync-packages) + (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (require 'server)