diff options
author | Chris Feng <chris.w.feng@gmail.com> | 2016-07-22T04·29+0800 |
---|---|---|
committer | Chris Feng <chris.w.feng@gmail.com> | 2016-07-22T04·29+0800 |
commit | 6ecd8b921fade26f30bdf4c0b047fcc9d9b57e9d (patch) | |
tree | 549186d6f2986aed54f843934e96fcf4aca038c1 /exwm-workspace.el | |
parent | d86db3edd675d4c9fc00b4c3677507a9fd453c54 (diff) |
Fix issues with deleting the last workspace
* exwm-workspace.el (exwm-workspace-delete): Prevent deleting the last workspace. * exwm-workspace.el (exwm-workspace--remove-frame-as-workspace): Create a new workspace if the last one is deleted.
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r-- | exwm-workspace.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el index e58c55411416..01f5b505fb29 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -604,10 +604,11 @@ INDEX must not exceed the current number of workspaces." (defun exwm-workspace-delete (&optional frame-or-index) "Delete the workspace FRAME-OR-INDEX." (interactive) - (delete-frame - (if frame-or-index - (exwm-workspace--workspace-from-frame-or-index frame-or-index) - exwm-workspace--current))) + (when (< 1 (exwm-workspace--count)) + (delete-frame + (if frame-or-index + (exwm-workspace--workspace-from-frame-or-index frame-or-index) + exwm-workspace--current)))) (defun exwm-workspace--on-focus-in () "Handle unexpected frame switch." @@ -1198,12 +1199,13 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (cond ((not (exwm-workspace--workspace-p frame)) (exwm--log "Frame `%s' is not a workspace" frame)) - ((= 1 (exwm-workspace--count)) - ;; FIXME: When using dedicated minibuffer frame, deleting the last - ;; frame hangs Emacs. - (user-error "[EXWM] Cannot remove last workspace")) (t (exwm--log "Removing frame `%s' as workspace" frame) + (when (= 1 (exwm-workspace--count)) + ;; The user managed to delete the last workspace, so create a new one. + (exwm--log "Last worksapce deleted; create a new one") + (let ((exwm-workspace--create-silently t)) + (make-frame))) (let* ((index (exwm-workspace--position frame)) (lastp (= index (1- (exwm-workspace--count)))) (nextw (elt exwm-workspace--list (+ index (if lastp -1 +1))))) |