aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@users.sourceforge.net>2018-09-21 16:30:54 -0400
committerNoam Postavsky <npostavs@users.sourceforge.net>2018-09-21 16:30:54 -0400
commitf07eb85c6090f53c6b15d8a98b4b84eb9db445ab (patch)
tree420a50000105501266dea8cee5ddd43cbbaf773b
parentd4e159f354abd2c9e29f6e526c6d23d236b28223 (diff)
magit-display-buffer: Don't reselect the same frame
Calling select-frame-set-input-focus on the current frame has unwanted side-effects, like moving the mouse if mouse-autoselect-window is non-nil.
-rw-r--r--lisp/magit-mode.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index da5d4ca..2df340e 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -619,9 +619,11 @@ and `magit-post-display-buffer-hook'."
(run-hooks 'magit-pre-display-buffer-hook))
(let ((window (funcall magit-display-buffer-function buffer)))
(unless magit-display-buffer-noselect
- (select-frame-set-input-focus
- (window-frame
- (select-window window)))))
+ (let* ((old-frame (selected-frame))
+ (new-frame (window-frame window)))
+ (select-window window)
+ (unless (eq old-frame new-frame)
+ (select-frame-set-input-focus new-frame)))))
(with-current-buffer buffer
(run-hooks 'magit-post-display-buffer-hook)))