From: Juri Linkov Date: Thu, 10 Feb 2022 18:57:42 +0000 (+0200) Subject: * lisp/mouse.el (context-menu-map): Select only unselected window (bug#53910) X-Git-Tag: emacs-29.0.90~2382 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=437382734a53e8fb311938d5dd8a39508e60b9bf;p=emacs.git * lisp/mouse.el (context-menu-map): Select only unselected window (bug#53910) --- 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))