GNU bug report logs - #78026
31.0.50; browse-url-interactive-arg does not handle nil (this-command-keys)

Previous Next

Package: emacs;

Reported by: StrawberryTea <look <at> strawberrytea.xyz>

Date: Thu, 24 Apr 2025 02:48:01 UTC

Severity: normal

Found in version 31.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 78026 <at> debbugs.gnu.org (full text, mbox):

From: StrawberryTea <look <at> strawberrytea.xyz>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 78026 <at> debbugs.gnu.org
Subject: Re: bug#78026: 31.0.50; browse-url-interactive-arg does not handle
 nil (this-command-keys)
Date: Sun, 04 May 2025 20:28:01 -0400
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
Hello. I am back! So what is happening is that in some cases
(this-command-keys) will be the empty string and that causes the error.
For example,
(run-at-time 0.01 nil
             (lambda () (message "this-command-keys: %s %s %s"
                                 (this-command-keys)
                                 (length (this-command-keys))
                                 (stringp (this-command-keys)))))
The original embark bug involved calling browse-url through embark-act
on a minibuffer candidate and though I can reproduce the original issue
I have not come up with a minimal example. This patch Stefan made does
fix the issue though.
> Eli Zaretskii [2025-05-03 11:46:12] wrote:
>
>>> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
>>> Cc: StrawberryTea <look <at> strawberrytea.xyz>,  78026 <at> debbugs.gnu.org
>>> 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




This bug report was last modified 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.