Skip to content

Commit

Permalink
tweak(tabspaces): auto switch to scratch on create
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Jun 12, 2023
1 parent f7b42c6 commit 7d1447a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/me-workspaces.el
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@

(add-to-list 'consult-buffer-sources '+consult--source-workspace))

;; Switch to the scratch buffer after creating a new workspace
(advice-add
'tabspaces-switch-or-create-workspace :around
(defun +tabspaces--switch-to-scratch-after-create-a (origfn &rest workspace)
(let ((length-before (length (tabspaces--list-tabspaces))))
(apply origfn workspace)
(when (length> (tabspaces--list-tabspaces) length-before)
(switch-to-buffer (get-scratch-buffer-create))))))

(tabspaces-mode 1)

;; Rename the first tab to `tabspaces-default-tab'
Expand Down

0 comments on commit 7d1447a

Please sign in to comment.