From 09b4f0915828222942d8ac3ae7f970e8d3d8468a Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Thu, 6 Oct 2016 13:04:30 +0800 Subject: Avoid updating input focus when renaming buffers * exwm-workspace.el (exwm-workspace-switch-to-buffer) (exwm-workspace-rename-buffer): Do not update input focus. --- exwm-workspace.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'exwm-workspace.el') 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'." -- cgit 1.4.1