* lisp/mouse.el (context-menu-map): Select only unselected window (bug#53910)

This commit is contained in:
Juri Linkov 2022-02-10 20:57:42 +02:00
parent a6df8f9f99
commit 437382734a

View file

@ -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))