add --skip-sync startup flag

This adds a new startup flag `--skip-sync`. It will force spacemacs to skip
package synchonization. This can be useful in cases when you're working under
poor or restrictive network.

Thanks, @zaript, for this idea!
This commit is contained in:
ZarsBranchkin 2017-06-30 10:49:27 +03:00 committed by syl20bnr
parent ebc6ba015e
commit 1e340f62f3
3 changed files with 9 additions and 4 deletions

View File

@ -16,6 +16,9 @@
(defvar spacemacs-insecure nil
"If non-nil force Spacemacs to operate without secured protocols.")
(defvar spacemacs-sync-packages t
"If non-nil synchronize packages on startup")
(defun spacemacs//parse-command-line (args)
"Handle Spacemacs specific command line arguments.
The reason why we don't use the Emacs hooks for processing user defined
@ -53,6 +56,8 @@ 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"
(setq spacemacs-sync-packages nil))
(_ (push arg new-args))))
(setq i (1+ i)))
(nreverse new-args)))

View File

@ -436,9 +436,9 @@ refreshed during the current session."
(package-read-all-archive-contents)
(unless quiet (spacemacs-buffer/append "\n")))))
(defun configuration-layer/sync (&optional no-install)
(defun configuration-layer/sync (&optional install)
"Synchronize declared layers in dotfile with spacemacs.
If NO-INSTALL is non nil then install steps are skipped."
If INSTALL is non nil then install missing packages."
(run-hooks 'configuration-layer-pre-sync-hook)
(dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...")
(setq dotspacemacs--configuration-layers-saved
@ -461,7 +461,7 @@ If NO-INSTALL is non nil then install steps are skipped."
;; load layers lazy settings
(configuration-layer/load-auto-layer-file)
;; install and/or uninstall packages
(unless no-install
(when install
(let ((packages
(append
;; install used packages

View File

@ -27,7 +27,7 @@
"core/core-load-paths.el"))
(require 'core-spacemacs)
(spacemacs/init)
(configuration-layer/sync)
(configuration-layer/sync spacemacs-sync-packages)
(spacemacs-buffer/display-startup-note)
(spacemacs/setup-startup-hook)
(require 'server)