Added check that *scratch* buffer exists (#15742)

Fixed that setting the dotspacemacs-scratch-mode can break if no scratch buffer exists.
This commit is contained in:
rommeswi 2022-10-20 02:44:05 +08:00 committed by GitHub
parent 33743922eb
commit 13c5f04dc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -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))