make exwm-workspace-switch-to-buffer switch workspaces

This commit is contained in:
Felix Lange 2016-10-02 01:44:29 +02:00
parent 575162b6b6
commit 093aea8e9c

View file

@ -772,10 +772,10 @@ INDEX must not exceed the current number of workspaces."
;;;###autoload ;;;###autoload
(defun exwm-workspace-switch-to-buffer (buffer-or-name) (defun exwm-workspace-switch-to-buffer (buffer-or-name)
"Make the current Emacs window display another buffer." "Switch to a workspace displaying the given buffer."
(interactive (interactive
(let ((inhibit-quit t)) (let ((inhibit-quit t))
;; Show all buffers ;; Show all buffers temporarily.
(unless exwm-workspace-show-all-buffers (unless exwm-workspace-show-all-buffers
(dolist (pair exwm--id-buffer-alist) (dolist (pair exwm--id-buffer-alist)
(with-current-buffer (cdr pair) (with-current-buffer (cdr pair)
@ -784,7 +784,7 @@ INDEX must not exceed the current number of workspaces."
(prog1 (prog1
(with-local-quit (with-local-quit
(list (get-buffer (read-buffer-to-switch "Switch to buffer: ")))) (list (get-buffer (read-buffer-to-switch "Switch to buffer: "))))
;; Hide buffers on other workspaces ;; Hide buffers on other workspaces again.
(unless exwm-workspace-show-all-buffers (unless exwm-workspace-show-all-buffers
(dolist (pair exwm--id-buffer-alist) (dolist (pair exwm--id-buffer-alist)
(with-current-buffer (cdr pair) (with-current-buffer (cdr pair)
@ -793,20 +793,20 @@ INDEX must not exceed the current number of workspaces."
(rename-buffer (concat " " (buffer-name)))))))))) (rename-buffer (concat " " (buffer-name))))))))))
(when buffer-or-name (when buffer-or-name
(with-current-buffer buffer-or-name (with-current-buffer buffer-or-name
(if (eq major-mode 'exwm-mode) (if (not (eq major-mode 'exwm-mode))
;; EXWM buffer. ;; Ordinary buffer.
(if (eq exwm--frame exwm-workspace--current) (let ((window (get-buffer-window buffer-or-name t)))
;; On the current workspace. (if window
(if (not exwm--floating-frame) (select-window window)
(switch-to-buffer buffer-or-name) (switch-to-buffer buffer-or-name)))
;; Select the floating frame. ;; EXWM buffer.
(select-frame-set-input-focus exwm--floating-frame) (unless (eq exwm--frame exwm-workspace--current)
(select-window (frame-root-window exwm--floating-frame))) (exwm-workspace-switch exwm--frame))
;; On another workspace. (if (not exwm--floating-frame)
(exwm-workspace-move-window exwm-workspace--current (switch-to-buffer buffer-or-name)
exwm--id)) ;; Select the floating frame.
;; Ordinary buffer. (select-frame-set-input-focus exwm--floating-frame)
(switch-to-buffer buffer-or-name))))) (select-window (frame-root-window exwm--floating-frame)))))))
(defun exwm-workspace-rename-buffer (newname) (defun exwm-workspace-rename-buffer (newname)
"Rename a buffer." "Rename a buffer."