Skip to content

Commit

Permalink
window-purpose layer: fix for opening new eyebrowse workspace
Browse files Browse the repository at this point in the history
Make sure spacemacs home buffers is the only window in the frame after
creating a new eyebrowse workspace.
  • Loading branch information
Bar Magal committed Jun 13, 2015
1 parent c1a7af0 commit 5ef60c8
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion contrib/!window-management/window-purpose/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,28 @@ PURPOSE defaults to the purpose of the current buffer."

(defun window-purpose/post-init-window-purpose ()
;; *LV* buffer is used by corelv.el
(push "^\\*LV\\*$" purpose-action-function-ignore-buffer-names))
(push "^\\*LV\\*$" purpose-action-function-ignore-buffer-names)

(defvar window-purpose--eyebrowse-new-workspace eyebrowse-new-workspace)

(defun window-purpose/new-workspace ()
"Create a new eyebrowse workspace."
;; partially copied from `eyebrowse-switch-to-window-config'
(cond
((stringp window-purpose--eyebrowse-new-workspace)
(switch-to-buffer (get-buffer-create window-purpose--eyebrowse-new-workspace)))
((functionp window-purpose--eyebrowse-new-workspace)
(funcall window-purpose--eyebrowse-new-workspace))
(t (switch-to-buffer "*scratch*")))

;; in case opening the new buffer splitted the frame (e.g.
;; `eyebrowse-switch-to-window-config' was called from a purpose-dedicated
;; buffer)
(delete-other-windows))

(defun window-purpose/sync-eyebrowse ()
(if purpose-mode
(setq eyebrowse-new-workspace #'window-purpose/new-workspace)
(setq eyebrowse-new-workspace window-purpose--eyebrowse-new-workspace)))
(add-hook 'purpose-mode-hook #'window-purpose/sync-eyebrowse)
(window-purpose/sync-eyebrowse))

0 comments on commit 5ef60c8

Please sign in to comment.