unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 2d15641: * lisp/mouse.el (context-menu-map): Fix when menu is a command (bug#50851)
       [not found] ` <20210928190056.D8A02207F5@vcs0.savannah.gnu.org>
@ 2021-09-28 19:29   ` Stefan Monnier
  2021-09-29  7:04     ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2021-09-28 19:29 UTC (permalink / raw)
  To: emacs-devel; +Cc: Juri Linkov

> -	 (defn (key-binding key t)))
> +	 (defn (save-excursion (mouse-set-point event) (key-binding key t))))

Could you add a comment explaining why it is safe to do that even though
it can mess with the selected window(&frame)?

[ IIRC you used a similar chunk of code recently in that vicinity, so
  I guess my question applies to that as well.  ]


        Stefan




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

* Re: master 2d15641: * lisp/mouse.el (context-menu-map): Fix when menu is a command (bug#50851)
  2021-09-28 19:29   ` master 2d15641: * lisp/mouse.el (context-menu-map): Fix when menu is a command (bug#50851) Stefan Monnier
@ 2021-09-29  7:04     ` Juri Linkov
  0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2021-09-29  7:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

>> -	 (defn (key-binding key t)))
>> +	 (defn (save-excursion (mouse-set-point event) (key-binding key t))))
>
> Could you add a comment explaining why it is safe to do that even though
> it can mess with the selected window(&frame)?

Before pushing this change, I've tested whether it works
when a context menu item is clicked in a non-selected window
after 'C-h k', and everything was fine.  But probably
I don't understand what problem it might cause.

> [ IIRC you used a similar chunk of code recently in that vicinity, so
>   I guess my question applies to that as well.  ]

Maybe a similar change was using window-point in event-end?
But then window-point in event-end will help to use the right
buffer's point in the above change with (mouse-set-point event).



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

end of thread, other threads:[~2021-09-29  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210928190055.3772.68409@vcs0.savannah.gnu.org>
     [not found] ` <20210928190056.D8A02207F5@vcs0.savannah.gnu.org>
2021-09-28 19:29   ` master 2d15641: * lisp/mouse.el (context-menu-map): Fix when menu is a command (bug#50851) Stefan Monnier
2021-09-29  7:04     ` Juri Linkov

Code repositories for project(s) associated with this public 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).