Avoid updating input focus when renaming buffers

* exwm-workspace.el (exwm-workspace-switch-to-buffer)
(exwm-workspace-rename-buffer): Do not update input focus.
This commit is contained in:
Chris Feng 2016-10-06 13:04:30 +08:00
parent 089afdc8cc
commit 09b4f09158

View file

@ -636,6 +636,7 @@ INDEX must not exceed the current number of workspaces."
:window id :window id
:data (exwm-workspace--position exwm--frame))))) :data (exwm-workspace--position exwm--frame)))))
(declare-function exwm-input--on-buffer-list-update "exwm-input.el" ())
(declare-function exwm-layout--show "exwm-layout.el" (id &optional window)) (declare-function exwm-layout--show "exwm-layout.el" (id &optional window))
(declare-function exwm-layout--hide "exwm-layout.el" (id)) (declare-function exwm-layout--hide "exwm-layout.el" (id))
(declare-function exwm-layout--refresh "exwm-layout.el") (declare-function exwm-layout--refresh "exwm-layout.el")
@ -780,7 +781,10 @@ INDEX must not exceed the current number of workspaces."
(dolist (pair exwm--id-buffer-alist) (dolist (pair exwm--id-buffer-alist)
(with-current-buffer (cdr pair) (with-current-buffer (cdr pair)
(when (= ?\s (aref (buffer-name) 0)) (when (= ?\s (aref (buffer-name) 0))
(rename-buffer (substring (buffer-name) 1)))))) (let ((buffer-list-update-hook
(remq #'exwm-input--on-buffer-list-update
buffer-list-update-hook)))
(rename-buffer (substring (buffer-name) 1)))))))
(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: "))))
@ -790,7 +794,10 @@ INDEX must not exceed the current number of workspaces."
(with-current-buffer (cdr pair) (with-current-buffer (cdr pair)
(unless (or (eq exwm--frame exwm-workspace--current) (unless (or (eq exwm--frame exwm-workspace--current)
(= ?\s (aref (buffer-name) 0))) (= ?\s (aref (buffer-name) 0)))
(rename-buffer (concat " " (buffer-name)))))))))) (let ((buffer-list-update-hook
(remq #'exwm-input--on-buffer-list-update
buffer-list-update-hook)))
(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 (eq major-mode 'exwm-mode)
@ -820,7 +827,10 @@ INDEX must not exceed the current number of workspaces."
(get-buffer (concat " " newname)))) (get-buffer (concat " " newname))))
(not (eq tmp (current-buffer)))) (not (eq tmp (current-buffer))))
(setq newname (format "%s<%d>" basename (cl-incf counter)))) (setq newname (format "%s<%d>" basename (cl-incf counter))))
(rename-buffer (concat (and hidden " ") newname)))) (let ((buffer-list-update-hook
(remq #'exwm-input--on-buffer-list-update
buffer-list-update-hook)))
(rename-buffer (concat (and hidden " ") newname)))))
(defun exwm-workspace--x-create-frame (orig-fun params) (defun exwm-workspace--x-create-frame (orig-fun params)
"Set override-redirect on the frame created by `x-create-frame'." "Set override-redirect on the frame created by `x-create-frame'."