+workspace/delete: error if workspace doesn't exist

This commit is contained in:
Henrik Lissner 2018-08-26 14:14:53 +02:00
parent e40a58c423
commit 1ed8894826
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -301,6 +301,8 @@ workspace to delete."
current-name))))
(condition-case-unless-debug ex
(let ((workspaces (+workspace-list-names)))
(if (not (member name workspaces))
(+workspace-message (format "'%s' workspace doesn't exist" name) 'warn)
(cond ((delq (selected-frame) (persp-frames-with-persp (get-frame-persp)))
(user-error "Can't close workspace, it's visible in another frame"))
((> (length workspaces) 1)
@ -316,7 +318,7 @@ workspace to delete."
(unless (string= (car workspaces) +workspaces-main)
(+workspace-delete name))
(doom/kill-all-buffers)))
(+workspace-message (format "Deleted '%s' workspace" name) 'success))
(+workspace-message (format "Deleted '%s' workspace" name) 'success)))
('error (+workspace-error ex t))))
;;;###autoload