From 9105f2312161a402ab7e7b4d6e8bcf127cbf51f5 Mon Sep 17 00:00:00 2001 From: Ved Vyas Date: Tue, 30 Aug 2016 12:10:45 -0400 Subject: [PATCH 1/2] Improve exwm-workspace-move-window behavior in specific case This is a small change that improves the behavior of `exwm-workspace-move-window` in the following situation: 0. `exwm-workspace-show-all-buffers` and `exwm-layout-show-all-buffers` are `nil`*. 1. On active workspace `i`, there is X window `a` in the selected Emacs window. 2. On workspace `j`, there is X window `b` in the selected Emacs window on that workspace frame. 3. While workspace `i` is active, use `exwm-workspace-move-window` to move `a` to workspace `j`. 4. Switch to workspace `j` and use `exwm-workspace-move-window` to move `a` back to workspace `i`. Expected behavior: X window `a` is once again shown in the selected Emacs window on workspace `i` and X window `b` is once again shown in the selected Emacs window on workspace `j`. What is observed: `a` is OK but the selected Emacs window on workspace `j` does not show `b`. However, `b` is the first candidate when doing a `switch-to-buffer` in that Emacs window on workspace `j`. I'm not sure if this is the correct and complete change required, but it is working well so far. *The expected behavior is observed with EXWM 0.10 if exwm-{workspace,layout}-show-all-buffers are non-nil. --- exwm-workspace.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/exwm-workspace.el b/exwm-workspace.el index 9585112..a99186c 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -746,10 +746,9 @@ INDEX must not exceed the current number of workspaces." (frame-root-window exwm--floating-frame))))) ;; Move the X window container. - (if (eq frame exwm-workspace--current) - (set-window-buffer (get-buffer-window (current-buffer) t) - (other-buffer)) - (bury-buffer) + (set-window-buffer (get-buffer-window (current-buffer) t) + (other-buffer)) + (unless (eq frame exwm-workspace--current) ;; Clear the 'exwm-selected-window' frame parameter. (set-frame-parameter frame 'exwm-selected-window nil)) (exwm-layout--hide id) From b4517fbfa058e38b9c229d3e76674221d89a2e2b Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Wed, 31 Aug 2016 19:18:42 +0800 Subject: [PATCH 2/2] Force using visible buffers in `other-buffer' * exwm-floating.el (exwm-floating--set-floating): * exwm-workspace.el (exwm-workspace-move-window): Buffers visible on other frames should be treated as invisible. One side effect is visible buffers on the current frame is also taken into account. --- exwm-floating.el | 5 +++-- exwm-workspace.el | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/exwm-floating.el b/exwm-floating.el index 6f6cfec..f2cc09b 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -82,8 +82,9 @@ context of the corresponding buffer.") (defun exwm-floating--set-floating (id) "Make window ID floating." (let ((window (get-buffer-window (exwm--id->buffer id)))) - (when window ;window in non-floating state - (set-window-buffer window (other-buffer)))) ;hide it first + (when window + ;; Hide the non-floating X window first. + (set-window-buffer window (other-buffer nil t)))) (let* ((original-frame exwm-workspace--current) ;; Create new frame (frame (with-current-buffer diff --git a/exwm-workspace.el b/exwm-workspace.el index a99186c..24a59f9 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -747,7 +747,7 @@ INDEX must not exceed the current number of workspaces." exwm--floating-frame))))) ;; Move the X window container. (set-window-buffer (get-buffer-window (current-buffer) t) - (other-buffer)) + (other-buffer nil t)) (unless (eq frame exwm-workspace--current) ;; Clear the 'exwm-selected-window' frame parameter. (set-frame-parameter frame 'exwm-selected-window nil))