From 437382734a53e8fb311938d5dd8a39508e60b9bf Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 10 Feb 2022 20:57:42 +0200 Subject: [PATCH] * lisp/mouse.el (context-menu-map): Select only unselected window (bug#53910) --- lisp/mouse.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/mouse.el b/lisp/mouse.el index acaf6611af5..1e205283de2 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -321,10 +321,12 @@ At the end, it's possible to modify the final menu by specifying the function `context-menu-filter-function'." (let* ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t))) (click (or click last-input-event)) + (window (posn-window (event-start click))) (fun (mouse-posn-property (event-start click) 'context-menu-function))) - (select-window (posn-window (event-start click))) + (unless (eq (selected-window) window) + (select-window window)) (if (functionp fun) (setq menu (funcall fun menu click)) -- 2.39.5