feature/workspaces: clear last workspace instead of erroring out

This commit is contained in:
Henrik Lissner 2018-04-02 05:50:39 -04:00
parent 7282553d2d
commit aad653d913
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -259,7 +259,6 @@ workspace to delete."
nil nil current-name)
current-name))))
(condition-case-unless-debug ex
(+workspace-message
(let ((workspaces (length (+workspace-list-names))))
(cond ((> workspaces 1)
(+workspace-delete name)
@ -268,16 +267,13 @@ workspace to delete."
+workspace--last
(car (+workspace-list-names))))
(unless (doom-buffer-frame-predicate (current-buffer))
(switch-to-buffer (doom-fallback-buffer)))
(format "Deleted '%s' workspace" name))
((= workspaces 1)
(format "Can't delete the last workspace!"))
(switch-to-buffer (doom-fallback-buffer))))
(t
(+workspace-delete name)
(+workspace-switch +workspaces-main t)
(switch-to-buffer (doom-fallback-buffer))
(format "No workspaces detected! Auto-creating '%s' workspace" +workspaces-main))))
'success)
(unless (string= (car workspaces) +workspaces-main)
(+workspace-delete name))
(doom/kill-all-buffers)))
(+workspace-message (format "Deleted '%s' workspace" name) 'success))
('error (+workspace-error ex t))))
;;;###autoload