switch-to-scratch-buffer with prefix arg opens in other window

This commit is contained in:
deb0ch 2016-12-10 20:33:20 +01:00 committed by d12frosted
parent 10c59bb142
commit 352c76ca72
No known key found for this signature in database
GPG Key ID: 8F60E862D6F5CE8F
1 changed files with 5 additions and 3 deletions

View File

@ -988,11 +988,13 @@ a split-side entry, its value must be usable as the SIDE argument for
(let ((buffer (find-file-noselect file)))
(pop-to-buffer buffer '(spacemacs//display-in-split (split-side . below)))))
(defun spacemacs/switch-to-scratch-buffer ()
(defun spacemacs/switch-to-scratch-buffer (&optional arg)
"Switch to the `*scratch*' buffer. Create it first if needed."
(interactive)
(interactive "P")
(let ((exists (get-buffer "*scratch*")))
(switch-to-buffer (get-buffer-create "*scratch*"))
(if arg
(switch-to-buffer-other-window (get-buffer-create "*scratch*"))
(switch-to-buffer (get-buffer-create "*scratch*")))
(when (and (not exists)
(not (eq major-mode dotspacemacs-scratch-mode))
(fboundp dotspacemacs-scratch-mode))