Refactor +workspace/new: use persp-copy
Instead of manually adding buffers to new workspace.
This commit is contained in:
parent
16d3f75f1d
commit
863fa16bcc
1 changed files with 10 additions and 12 deletions
|
@ -332,18 +332,16 @@ workspace, otherwise the new workspace is blank."
|
||||||
(interactive "iP")
|
(interactive "iP")
|
||||||
(unless name
|
(unless name
|
||||||
(setq name (format "#%s" (+workspace--generate-id))))
|
(setq name (format "#%s" (+workspace--generate-id))))
|
||||||
(condition-case-unless-debug ex
|
(condition-case e
|
||||||
(if (+workspace-exists-p name)
|
(cond ((+workspace-exists-p name)
|
||||||
(error "%s already exists" name)
|
(error "%s already exists" name))
|
||||||
(+workspace-switch name t)
|
(clone-p (persp-copy name t))
|
||||||
(if clone-p
|
(t
|
||||||
(let ((persp (+workspace-get name)))
|
(+workspace-switch name t)
|
||||||
(dolist (window (window-list))
|
(persp-delete-other-windows)
|
||||||
(persp-add-buffer (window-buffer window) persp nil)))
|
(switch-to-buffer (doom-fallback-buffer))
|
||||||
(delete-other-windows-internal)
|
(+workspace/display)))
|
||||||
(switch-to-buffer (doom-fallback-buffer)))
|
((debug error) (+workspace-error (cadr e) t))))
|
||||||
(+workspace/display))
|
|
||||||
('error (+workspace-error (cadr ex) t))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +workspace/switch-to (index)
|
(defun +workspace/switch-to (index)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue