diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index 6517f0601..45135b03c 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -633,7 +633,7 @@ path." (condition-case err (set-default var (eval (pop variables))) ('error - (configuration-layer//set-error) + (configuration-layer//increment-error-count) (spacemacs-buffer/append (format (concat "\nAn error occurred while setting layer " "variable %s " @@ -737,7 +737,7 @@ path." (t (spacemacs-buffer/warning "Cannot install package %S." pkg-name))) ('error - (configuration-layer//set-error) + (configuration-layer//increment-error-count) (spacemacs-buffer/append (format (concat "\nAn error occurred while installing %s " "(error: %s)\n") pkg-name err)))))) @@ -904,7 +904,7 @@ path." (condition-case err (funcall (intern (format "%S/pre-init-%S" layer pkg-name))) ('error - (configuration-layer//set-error) + (configuration-layer//increment-error-count) (spacemacs-buffer/append (format (concat "\nAn error occurred while pre-configuring %S " @@ -924,7 +924,7 @@ path." (condition-case err (funcall (intern (format "%S/post-init-%S" layer pkg-name))) ('error - (configuration-layer//set-error) + (configuration-layer//increment-error-count) (spacemacs-buffer/append (format (concat "\nAn error occurred while post-configuring %S " @@ -1284,12 +1284,10 @@ to select one." (spacemacs-buffer/append "\n")) (spacemacs-buffer/message "No orphan package to delete.")))) -(defun configuration-layer//set-error () - "Set the error flag and change the mode-line color to red." +(defun configuration-layer//increment-error-count () + "Increment the error counter." (if configuration-layer-error-count - (setq configuration-layer-error-count - (1+ configuration-layer-error-count)) - (face-remap-add-relative 'mode-line '((:background "red") mode-line)) + (setq configuration-layer-error-count (1+ configuration-layer-error-count)) (setq configuration-layer-error-count 1))) (provide 'core-configuration-layer) diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index 5f53f338b..dba116f39 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -285,7 +285,7 @@ are caught and signalled to user in spacemacs buffer." (condition-case-unless-debug err (,func) (error - (configuration-layer//set-error) + (configuration-layer//increment-error-count) (spacemacs-buffer/append (format "Error in %s: %s\n" ',(symbol-name func) (error-message-string err)) diff --git a/core/core-spacemacs-buffer.el b/core/core-spacemacs-buffer.el index 7e01142f1..3b03d2463 100644 --- a/core/core-spacemacs-buffer.el +++ b/core/core-spacemacs-buffer.el @@ -604,20 +604,26 @@ already exist, and switch to it." (spacemacs-buffer/set-mode-line spacemacs--default-mode-line) (force-mode-line-update) (spacemacs-buffer-mode)) - (add-hook 'emacs-startup-hook - (lambda () - (with-current-buffer (get-buffer spacemacs-buffer-name) - (when dotspacemacs-startup-lists - (spacemacs-buffer/insert-startupify-lists)) - (if configuration-layer-error-count - (spacemacs-buffer/set-mode-line - (format (concat "%s error(s) at startup! " - "Spacemacs may not be able to operate properly.") - configuration-layer-error-count)) - (spacemacs-buffer/set-mode-line spacemacs--default-mode-line)) - (force-mode-line-update) - (spacemacs-buffer-mode) - (spacemacs-buffer/goto-link-line))) t))))) + (add-hook + 'emacs-startup-hook + (lambda () + (with-current-buffer (get-buffer spacemacs-buffer-name) + (when dotspacemacs-startup-lists + (spacemacs-buffer/insert-startupify-lists)) + (if configuration-layer-error-count + (progn + (spacemacs-buffer-mode) + (spacemacs-buffer/set-mode-line + (format + (concat "%s error(s) at startup! " + "Spacemacs may not be able to operate properly.") + configuration-layer-error-count)) + (face-remap-add-relative 'mode-line + '((:background "red") mode-line))) + (spacemacs-buffer/set-mode-line spacemacs--default-mode-line) + (spacemacs-buffer-mode)) + (force-mode-line-update) + (spacemacs-buffer/goto-link-line))) t))))) (spacemacs-buffer/goto-link-line) (switch-to-buffer spacemacs-buffer-name) (spacemacs//redisplay)) diff --git a/layers/+distribution/spacemacs/packages.el b/layers/+distribution/spacemacs/packages.el index 75127180a..1fb7f7557 100644 --- a/layers/+distribution/spacemacs/packages.el +++ b/layers/+distribution/spacemacs/packages.el @@ -1387,11 +1387,10 @@ on whether the spacemacs-ivy layer is used or not, with (if (display-graphic-p) 'wave 'utf-8))) (defun spacemacs//set-powerline-for-startup-buffers () "Set the powerline for buffers created when Emacs starts." - (unless configuration-layer-error-count - (dolist (buffer '("*Messages*" "*spacemacs*" "*Compile-Log*")) - (when (and (get-buffer buffer) - (configuration-layer/package-usedp 'spaceline)) - (spacemacs//restore-powerline buffer))))) + (dolist (buffer '("*Messages*" "*spacemacs*" "*Compile-Log*")) + (when (and (get-buffer buffer) + (configuration-layer/package-usedp 'spaceline)) + (spacemacs//restore-powerline buffer)))) (add-hook 'emacs-startup-hook 'spacemacs//set-powerline-for-startup-buffers)) :config diff --git a/layers/+vim/vim-powerline/packages.el b/layers/+vim/vim-powerline/packages.el index cb7d2fb09..0a8d29e36 100644 --- a/layers/+vim/vim-powerline/packages.el +++ b/layers/+vim/vim-powerline/packages.el @@ -33,12 +33,11 @@ PAD import on left (l) or right (r) or left-right (lr)." (defun spacemacs//set-vimish-powerline-for-startup-buffers () "Set the powerline for buffers created when Emacs starts." - (unless configuration-layer-error-count - (dolist (buffer '("*Messages*" "*spacemacs*" "*Compile-Log*")) - (when (get-buffer buffer) - (with-current-buffer buffer - (setq-local mode-line-format (default-value 'mode-line-format)) - (powerline-set-selected-window) - (powerline-reset)))))) + (dolist (buffer '("*Messages*" "*spacemacs*" "*Compile-Log*")) + (when (get-buffer buffer) + (with-current-buffer buffer + (setq-local mode-line-format (default-value 'mode-line-format)) + (powerline-set-selected-window) + (powerline-reset))))) (add-hook 'emacs-startup-hook 'spacemacs//set-vimish-powerline-for-startup-buffers))