From 13c5f04dc0edf9e5d5a2f283e33685bbf2154d0f Mon Sep 17 00:00:00 2001 From: rommeswi Date: Thu, 20 Oct 2022 02:44:05 +0800 Subject: [PATCH] Added check that *scratch* buffer exists (#15742) Fixed that setting the dotspacemacs-scratch-mode can break if no scratch buffer exists. --- core/core-spacemacs.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/core-spacemacs.el b/core/core-spacemacs.el index 07810ad17..e223579d4 100644 --- a/core/core-spacemacs.el +++ b/core/core-spacemacs.el @@ -240,9 +240,10 @@ Note: the hooked function is not executed when in dumped mode." (run-hooks 'spacemacs-post-user-config-hook) (setq spacemacs-post-user-config-hook-run t) (when (fboundp dotspacemacs-scratch-mode) - (with-current-buffer "*scratch*" - (funcall dotspacemacs-scratch-mode) - (run-hooks 'spacemacs-scratch-mode-hook))) + (when (get-buffer "*scratch*") + (with-current-buffer "*scratch*" + (funcall dotspacemacs-scratch-mode) + (run-hooks 'spacemacs-scratch-mode-hook)))) (when spacemacs--delayed-user-theme (spacemacs/load-theme spacemacs--delayed-user-theme spacemacs--fallback-theme t))