emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/exwm 6ecd8b9 2/3: Fix issues with deleting the last wor


From: Chris Feng
Subject: [elpa] externals/exwm 6ecd8b9 2/3: Fix issues with deleting the last workspace
Date: Fri, 22 Jul 2016 04:33:43 +0000 (UTC)

branch: externals/exwm
commit 6ecd8b921fade26f30bdf4c0b047fcc9d9b57e9d
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    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.
---
 exwm-workspace.el |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/exwm-workspace.el b/exwm-workspace.el
index e58c554..01f5b50 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)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]