diff --git a/layers/+distribution/spacemacs-base/funcs.el b/layers/+distribution/spacemacs-base/funcs.el index 985eacca3..52856f2c9 100644 --- a/layers/+distribution/spacemacs-base/funcs.el +++ b/layers/+distribution/spacemacs-base/funcs.el @@ -879,10 +879,12 @@ is nonempty." (defun spacemacs/switch-to-scratch-buffer () "Switch to the `*scratch*' buffer. Create it first if needed." (interactive) - (switch-to-buffer (get-buffer-create "*scratch*")) - (when (and (not (eq major-mode dotspacemacs-scratch-mode)) - (fboundp dotspacemacs-scratch-mode)) - (funcall dotspacemacs-scratch-mode))) + (let ((exists (get-buffer "*scratch*"))) + (switch-to-buffer (get-buffer-create "*scratch*")) + (when (and (not exists) + (not (eq major-mode dotspacemacs-scratch-mode)) + (fboundp dotspacemacs-scratch-mode)) + (funcall dotspacemacs-scratch-mode)))) ;; http://stackoverflow.com/questions/11847547/emacs-regexp-count-occurrences (defun how-many-str (regexp str)