unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* browse-url-interactive-arg calls `mouse-set-point' too eagerly
       [not found] <87r1bbqqzm.fsf.ref@yahoo.com>
@ 2021-11-20  6:29 ` Po Lu
  2021-11-20  7:31   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Po Lu @ 2021-11-20  6:29 UTC (permalink / raw)
  To: emacs-devel

Selecting "Browse URL" from the xwidget-webkit menu bar results in the
following error:

  signal(error ("Position not in text area of window"))
  error("Position not in text area of window")
  posn-set-point(nil)
  mouse-set-point((menu-bar))
  browse-url-interactive-arg("xwidget-webkit URL: ")
  byte-code("\300\301!\210\302\303!\207" [require browse-url browse-url-interactive-arg "xwidget-webkit URL: "] 2)
  call-interactively(xwidget-webkit-browse-url nil nil)
  command-execute(xwidget-webkit-browse-url)

The doc string of browse-url-interactive-arg says:

  If invoked with a mouse button, it moves point to the position clicked
  before acting.

But the code treats any event that is a list as a mouse event, which
fails horribly with menu bar events.

So why not replace the faulty code with something like:

  (let ((event (elt (this-command-keys) 0)))
    (when (mouse-event-p event)
      (mouse-set-point event)))

WDYT?



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

* Re: browse-url-interactive-arg calls `mouse-set-point' too eagerly
  2021-11-20  6:29 ` browse-url-interactive-arg calls `mouse-set-point' too eagerly Po Lu
@ 2021-11-20  7:31   ` Eli Zaretskii
  2021-11-20  7:59     ` Po Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2021-11-20  7:31 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Date: Sat, 20 Nov 2021 14:29:49 +0800
> 
> The doc string of browse-url-interactive-arg says:
> 
>   If invoked with a mouse button, it moves point to the position clicked
>   before acting.
> 
> But the code treats any event that is a list as a mouse event, which
> fails horribly with menu bar events.
> 
> So why not replace the faulty code with something like:
> 
>   (let ((event (elt (this-command-keys) 0)))
>     (when (mouse-event-p event)
>       (mouse-set-point event)))
> 
> WDYT?

SGTM, thanks.  Please do this on the emacs-28 branch, as I believe the
same problem exists there.




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

* Re: browse-url-interactive-arg calls `mouse-set-point' too eagerly
  2021-11-20  7:31   ` Eli Zaretskii
@ 2021-11-20  7:59     ` Po Lu
  2021-11-20  8:34       ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Po Lu @ 2021-11-20  7:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> SGTM, thanks.  Please do this on the emacs-28 branch, as I believe the
> same problem exists there.

Done.  I don't have to install it separately on master, as it'll arrive
there the next time someone merges emacs-28 to master, correct?

Thanks.



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

* Re: browse-url-interactive-arg calls `mouse-set-point' too eagerly
  2021-11-20  7:59     ` Po Lu
@ 2021-11-20  8:34       ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-11-20  8:34 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sat, 20 Nov 2021 15:59:10 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > SGTM, thanks.  Please do this on the emacs-28 branch, as I believe the
> > same problem exists there.
> 
> Done.  I don't have to install it separately on master, as it'll arrive
> there the next time someone merges emacs-28 to master, correct?

Yes, correct.



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

end of thread, other threads:[~2021-11-20  8:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87r1bbqqzm.fsf.ref@yahoo.com>
2021-11-20  6:29 ` browse-url-interactive-arg calls `mouse-set-point' too eagerly Po Lu
2021-11-20  7:31   ` Eli Zaretskii
2021-11-20  7:59     ` Po Lu
2021-11-20  8:34       ` Eli Zaretskii

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