core: new function configuration-layer/load-file

This commit is contained in:
syl20bnr 2018-06-10 02:46:16 -04:00
parent 39bf9e516c
commit c2211b32e3

View file

@ -419,7 +419,7 @@ cache folder.")
(defun configuration-layer/load-lock-file ()
"Load the .lock file"
(load configuration-layer-lock-file nil (not init-file-debug)))
(configuration-layer/load-file configuration-layer-lock-file))
(defun configuration-layer/initialize ()
"Initialize `package.el'."
@ -560,8 +560,8 @@ refreshed during the current session."
;; check if layer list has changed since last dump
(when (file-exists-p
configuration-layer--last-dotspacemacs-configuration-layers-file)
(load configuration-layer--last-dotspacemacs-configuration-layers-file
nil (not init-file-debug)))
(configuration-layer/load-file
configuration-layer--last-dotspacemacs-configuration-layers-file))
(let ((layers dotspacemacs-configuration-layers))
(dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...")
;; `dotspacemacs--configuration-layers-saved' is used to detect if the layer
@ -676,7 +676,7 @@ To prevent package from being installed or uninstalled set the variable
(let ((file (concat configuration-layer-directory "auto-layer.el")))
(when (file-exists-p file)
(spacemacs-buffer/message "Loading auto-layer file...")
(load file nil (not init-file-debug)))))
(configuration-layer/load-file file))))
(defun configuration-layer/create-layer ()
"Ask the user for a configuration layer name and the layer
@ -785,7 +785,7 @@ If USEDP or `configuration-layer--load-packages-files' is non-nil then the
(packages (when (and (null packages)
(or usedp configuration-layer--load-packages-files)
(file-exists-p packages-file))
(load packages-file nil (not init-file-debug))
(configuration-layer/load-file packages-file)
(symbol-value (intern (format "%S-packages"
layer-name)))))
(selected-packages (if packages
@ -1648,7 +1648,8 @@ RNAME is the name symbol of another existing layer."
(when obj
(dolist (file files)
(let ((file (concat (oref obj :dir) file)))
(if (file-exists-p file) (load file nil (not init-file-debug))))))))
(if (file-exists-p file)
(configuration-layer/load-file file)))))))
(defun configuration-layer/configured-packages-stats (packages)
"Return a statistics alist regarding the number of configured PACKAGES."
@ -2195,7 +2196,7 @@ to select one."
configuration-layer-rollback-info))))
(spacemacs-buffer/append
(format "\nRollbacking ELPA packages from slot %s...\n" slot-dir))
(load info-file nil (not init-file-debug))
(configuration-layer/load-file info-file)
(let ((rollback-count (length update-packages-alist))
(rollbacked-count 0))
(spacemacs-buffer/append
@ -2745,6 +2746,10 @@ install time in order to replace all `org' package installation by
ARGS: format string arguments."
(message "(Spacemacs) %s" (apply 'format msg args)))
(defun configuration-layer/load-file (file)
"Load file silently except if in debug mode."
(load file nil (not init-file-debug)))
(provide 'core-configuration-layer)
;;; core-configuration-layer.el ends here