unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53249: Context menu in other window
@ 2022-01-14  8:42 Juri Linkov
  2022-01-14  9:00 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2022-01-14  8:42 UTC (permalink / raw)
  To: 53249

When clicking the right mouse button in another window,
some context-menu functions break the window configuration.
For example, when two windows show different parts of the same buffer,
this code in `prog-context-menu':

  (let ((identifier (save-excursion
                      (mouse-set-point click)
                      (xref-backend-identifier-at-point
                       (xref-find-backend)))))

moves window point of another window to the same position of the
selected window.

So the safest thing to do here is to select the window where
the context menu is invoked:

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 0d8d7d6175..45b7d51da7 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -320,6 +320,8 @@ context-menu-map
          (fun (mouse-posn-property (event-start click)
                                    'context-menu-function)))
 
+    (select-window (posn-window (event-start click)))
+
     (if (functionp fun)
         (setq menu (funcall fun menu click))
       (run-hook-wrapped 'context-menu-functions
-- 





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#53249: Context menu in other window
  2022-01-14  8:42 bug#53249: Context menu in other window Juri Linkov
@ 2022-01-14  9:00 ` Lars Ingebrigtsen
  2022-01-15 18:38   ` Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-14  9:00 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 53249

Juri Linkov <juri@linkov.net> writes:

> So the safest thing to do here is to select the window where
> the context menu is invoked:

Makes sense to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#53249: Context menu in other window
  2022-01-14  9:00 ` Lars Ingebrigtsen
@ 2022-01-15 18:38   ` Juri Linkov
  0 siblings, 0 replies; 3+ messages in thread
From: Juri Linkov @ 2022-01-15 18:38 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53249-done

>> So the safest thing to do here is to select the window where
>> the context menu is invoked:
>
> Makes sense to me.

So pushed to master and closed.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-15 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14  8:42 bug#53249: Context menu in other window Juri Linkov
2022-01-14  9:00 ` Lars Ingebrigtsen
2022-01-15 18:38   ` Juri Linkov

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).