Subject: Re: bug#78026: 31.0.50; browse-url-interactive-arg does not handle nil (this-command-keys)

From: Stefan Monnier <[email-masked]>
Date: Sat, 03 May 2025 09:18:12 -0400

Eli Zaretskii [2025-05-03 11:46:12] wrote:

>> From: Stefan Monnier <[email-masked]>
>> Cc: StrawberryTea <[email-masked]>,  [email-masked]
>> Date: Sun, 27 Apr 2025 09:54:26 -0400
>> 
>> >> Hello. So when fixing https://github.com/oantolin/embark/pull/750, I
>> >> realized that browse-url-interactive-arg does not handle
>> >> (this-command-keys) being the empty vector and that causes
>> >> browse-url-interactive-arg to emit an error when called programmatically
>> >> in embark.el. We should make it so that if (this-command-keys) returns
>> >> an empty vector, then mouse-set-point is not called.
>> 
>> You mean like in the patch below?
>
> ENOPATCH

Hmm... I remember hesitating between a few different options, but
I think I meant to send this one:

    diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
    index 3b2d3983002..96b4baaa615 100644
    --- a/lisp/net/browse-url.el
    +++ b/lisp/net/browse-url.el
    @@ -713,8 +713,7 @@ browse-url-interactive-arg
     `interactive'.  NEW-WINDOW-FLAG is the prefix arg; if
     `browse-url-new-window-flag' is non-nil, invert the prefix arg
     instead."
    -  (let ((event (elt (this-command-keys) 0)))
    -    (mouse-set-point event))
    +  (mouse-set-point last-nonmenu-event)
       (list (read-string prompt (or (and transient-mark-mode mark-active
                                         ;; rfc2396 Appendix E.
                                         (replace-regexp-in-string

- Stefan