about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-10-06T05·04+0800
committerChris Feng <chris.w.feng@gmail.com>2016-10-06T05·04+0800
commit09b4f0915828222942d8ac3ae7f970e8d3d8468a (patch)
tree16f54597aa96d49564b1925b31c0d71977a71879
parent089afdc8ccbd37647f3b9d3b6181db5bcf3e43e9 (diff)
Avoid updating input focus when renaming buffers
* exwm-workspace.el (exwm-workspace-switch-to-buffer)
(exwm-workspace-rename-buffer): Do not update input focus.
-rw-r--r--exwm-workspace.el16
1 files changed, 13 insertions, 3 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 12f0be7748af..617ad3820877 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -636,6 +636,7 @@ INDEX must not exceed the current number of workspaces."
                        :window id
                        :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--hide "exwm-layout.el" (id))
 (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)
          (with-current-buffer (cdr pair)
            (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
          (with-local-quit
            (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)
              (unless (or (eq exwm--frame exwm-workspace--current)
                          (= ?\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
     (with-current-buffer buffer-or-name
       (if (eq major-mode 'exwm-mode)
@@ -820,7 +827,10 @@ INDEX must not exceed the current number of workspaces."
                               (get-buffer (concat " " newname))))
                 (not (eq tmp (current-buffer))))
       (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)
   "Set override-redirect on the frame created by `x-create-frame'."