Subject: Re: bug#45392: 28.0.50; read-from-minibuffer sets `this-command` variable to `exit-minibuffer`

From: Daniel Martín <[email-masked]>
Date: Fri, 08 Jan 2021 00:35:13 +0100

dalanicolai <[email-masked]> writes:

>  Load the following code block:
>
>     (defun test ()
>       (interactive)
>       (print this-command)
>       (read-from-minibuffer "test")
>       (print this-command))
>
> Now run M-x test.
>
> The first print prints correctly "test" while the second print prints
> "exit-minibuffer"
> The docstring of the `this-command` variable says: "The command now
> being executed." I would think the command "exit-minibuffer" should have
> been completed here, so the current command being executed for the
> second print, i.e. the value of the `this-command` variable,  should again
> be "test".
>

Thanks for your bug report.  I think it is expected that 'this-command'
is 'exit-minibuffer' in this case, because 'this-command' is usually set
only once *at the beginning* of the execution of a command.  It keeps
its value until a *new* command is executed by Emacs.  This is not
explicitly said in the docstring, but it is mentioned in the Elisp Info
manual.

I don't know if the docstring could be expressed more clearly; I prefer
to leave those command loop details to the Info manuals.