core: rename configuration-layer/sync to configuration-layer/load
Replace the optional argument `no-install` by a global variable named `spacemacs-sync-packages`. Rename the hooks to reflect the renaming of the function. Rename the flag `--no-sync` to the more explicit `--no-package-sync`
This commit is contained in:
parent
1e340f62f3
commit
cc0d8cafb2
|
@ -17,7 +17,8 @@
|
||||||
"If non-nil force Spacemacs to operate without secured protocols.")
|
"If non-nil force Spacemacs to operate without secured protocols.")
|
||||||
|
|
||||||
(defvar spacemacs-sync-packages t
|
(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)
|
(defun spacemacs//parse-command-line (args)
|
||||||
"Handle Spacemacs specific command line arguments.
|
"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)))
|
i (1+ i)))
|
||||||
("--resume-layouts"
|
("--resume-layouts"
|
||||||
(setq spacemacs-force-resume-layouts t))
|
(setq spacemacs-force-resume-layouts t))
|
||||||
("--no-sync"
|
("--no-package-sync"
|
||||||
(setq spacemacs-sync-packages nil))
|
(setq spacemacs-sync-packages nil))
|
||||||
(_ (push arg new-args))))
|
(_ (push arg new-args))))
|
||||||
(setq i (1+ i)))
|
(setq i (1+ i)))
|
||||||
|
|
|
@ -69,11 +69,11 @@ ROOT is returned."
|
||||||
(dir (car (directory-files elpa-dir 'full pkg-match))))
|
(dir (car (directory-files elpa-dir 'full pkg-match))))
|
||||||
(when dir (file-name-as-directory dir))))))
|
(when dir (file-name-as-directory dir))))))
|
||||||
|
|
||||||
(defvar configuration-layer-pre-sync-hook nil
|
(defvar configuration-layer-pre-load-hook nil
|
||||||
"Hook executed at the beginning of configuration synchronization.")
|
"Hook executed at the beginning of configuration loading.")
|
||||||
|
|
||||||
(defvar configuration-layer-post-sync-hook nil
|
(defvar configuration-layer-post-load-hook nil
|
||||||
"Hook executed at the end of configuration synchronization.")
|
"Hook executed at the end of configuration loading.")
|
||||||
|
|
||||||
(defvar configuration-layer-rollback-directory
|
(defvar configuration-layer-rollback-directory
|
||||||
(concat spacemacs-cache-directory ".rollback/")
|
(concat spacemacs-cache-directory ".rollback/")
|
||||||
|
@ -436,10 +436,11 @@ refreshed during the current session."
|
||||||
(package-read-all-archive-contents)
|
(package-read-all-archive-contents)
|
||||||
(unless quiet (spacemacs-buffer/append "\n")))))
|
(unless quiet (spacemacs-buffer/append "\n")))))
|
||||||
|
|
||||||
(defun configuration-layer/sync (&optional install)
|
(defun configuration-layer/load ()
|
||||||
"Synchronize declared layers in dotfile with spacemacs.
|
"Load layers declared in dotfile and install associated packages.
|
||||||
If INSTALL is non nil then install missing packages."
|
To prevent package from being installed or uninstalled set the variable
|
||||||
(run-hooks 'configuration-layer-pre-sync-hook)
|
`spacemacs-sync-packages' to nil."
|
||||||
|
(run-hooks 'configuration-layer-pre-load-hook)
|
||||||
(dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...")
|
(dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...")
|
||||||
(setq dotspacemacs--configuration-layers-saved
|
(setq dotspacemacs--configuration-layers-saved
|
||||||
dotspacemacs-configuration-layers)
|
dotspacemacs-configuration-layers)
|
||||||
|
@ -461,7 +462,7 @@ If INSTALL is non nil then install missing packages."
|
||||||
;; load layers lazy settings
|
;; load layers lazy settings
|
||||||
(configuration-layer/load-auto-layer-file)
|
(configuration-layer/load-auto-layer-file)
|
||||||
;; install and/or uninstall packages
|
;; install and/or uninstall packages
|
||||||
(when install
|
(when spacemacs-sync-packages
|
||||||
(let ((packages
|
(let ((packages
|
||||||
(append
|
(append
|
||||||
;; install used packages
|
;; 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//configure-packages configuration-layer--used-packages)
|
||||||
(configuration-layer//load-layers-files configuration-layer--used-layers
|
(configuration-layer//load-layers-files configuration-layer--used-layers
|
||||||
'("keybindings.el"))
|
'("keybindings.el"))
|
||||||
(run-hooks 'configuration-layer-post-sync-hook))
|
(run-hooks 'configuration-layer-post-load-hook))
|
||||||
|
|
||||||
(defun configuration-layer/load-auto-layer-file ()
|
(defun configuration-layer/load-auto-layer-file ()
|
||||||
"Load `auto-layer.el' 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?")
|
"layer %s, do you want to install it?")
|
||||||
mode layer-name)))
|
mode layer-name)))
|
||||||
(when (dotspacemacs/add-layer 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))
|
(let* ((layer (configuration-layer/get-layer layer-name))
|
||||||
(inst-pkgs
|
(inst-pkgs
|
||||||
(delq nil
|
(delq nil
|
||||||
|
|
|
@ -136,12 +136,12 @@ seconds to load")
|
||||||
(advice-add 'package-initialize
|
(advice-add 'package-initialize
|
||||||
:around
|
:around
|
||||||
(spacemacs||make-function-timer package-intialize))
|
(spacemacs||make-function-timer package-intialize))
|
||||||
(advice-add 'configuration-layer/sync
|
(advice-add 'configuration-layer/load
|
||||||
:around
|
:around
|
||||||
(spacemacs||make-function-timer configuration-layer/sync))
|
(spacemacs||make-function-timer configuration-layer/load))
|
||||||
;; (advice-add 'configuration-layer/sync
|
;; (advice-add 'configuration-layer/load
|
||||||
;; :around
|
;; :around
|
||||||
;; (spacemacs||make-function-profiler configuration-layer/sync))
|
;; (spacemacs||make-function-profiler configuration-layer/load))
|
||||||
(advice-add 'configuration-layer//configure-package
|
(advice-add 'configuration-layer//configure-package
|
||||||
:around
|
:around
|
||||||
(spacemacs||make-function-timer configuration-layer//configure-package)))
|
(spacemacs||make-function-timer configuration-layer//configure-package)))
|
||||||
|
|
|
@ -493,7 +493,7 @@ Called with `C-u C-u' skips `dotspacemacs/user-config' _and_ preleminary tests."
|
||||||
(setq dotspacemacs-editing-style
|
(setq dotspacemacs-editing-style
|
||||||
(dotspacemacs//read-editing-style-config
|
(dotspacemacs//read-editing-style-config
|
||||||
dotspacemacs-editing-style))
|
dotspacemacs-editing-style))
|
||||||
(configuration-layer/sync)
|
(configuration-layer/load)
|
||||||
(if (member arg '((4) (16)))
|
(if (member arg '((4) (16)))
|
||||||
(message (concat "Done (`dotspacemacs/user-config' "
|
(message (concat "Done (`dotspacemacs/user-config' "
|
||||||
"function has been skipped)."))
|
"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-buffer/set-mode-line "Dotfile wizard installer")
|
||||||
(spacemacs//redisplay)
|
(spacemacs//redisplay)
|
||||||
(when (dotspacemacs/install 'with-wizard)
|
(when (dotspacemacs/install 'with-wizard)
|
||||||
(configuration-layer/sync))))
|
(configuration-layer/load))))
|
||||||
|
|
||||||
(defun dotspacemacs/install (arg)
|
(defun dotspacemacs/install (arg)
|
||||||
"Install the dotfile, return non nil if the doftile has been installed.
|
"Install the dotfile, return non nil if the doftile has been installed.
|
||||||
|
|
|
@ -323,7 +323,7 @@ has been changed to THEME."
|
||||||
(setcar theme2 pkg-name)
|
(setcar theme2 pkg-name)
|
||||||
(setq theme2 pkg-name))
|
(setq theme2 pkg-name))
|
||||||
(add-to-list 'dotspacemacs--additional-theme-packages theme2)))))
|
(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)
|
'spacemacs//add-theme-packages-to-additional-packages)
|
||||||
|
|
||||||
(provide 'core-themes-support)
|
(provide 'core-themes-support)
|
||||||
|
|
2
init.el
2
init.el
|
@ -27,7 +27,7 @@
|
||||||
"core/core-load-paths.el"))
|
"core/core-load-paths.el"))
|
||||||
(require 'core-spacemacs)
|
(require 'core-spacemacs)
|
||||||
(spacemacs/init)
|
(spacemacs/init)
|
||||||
(configuration-layer/sync spacemacs-sync-packages)
|
(configuration-layer/load)
|
||||||
(spacemacs-buffer/display-startup-note)
|
(spacemacs-buffer/display-startup-note)
|
||||||
(spacemacs/setup-startup-hook)
|
(spacemacs/setup-startup-hook)
|
||||||
(require 'server)
|
(require 'server)
|
||||||
|
|
Loading…
Reference in New Issue