Subject: bug#45177: 27.1; Access to invoking top level command in minibuffer

From: [email-masked]
Date: Sun, 13 Dec 2020 12:40:18 +0100

>> But wouldn't this still have the problem that multiple minibuffer
>> invocations in the same command would change real-this-command as in my
>> initial example?
> 
> This is not a problem because multiple minibuffer invocations
> create separate buffers with different names
> 
>    #<buffer  *Minibuf-1*>
>    #<buffer  *Minibuf-2*>
>    #<buffer  *Minibuf-3*>
>   ...

I meant sequential invocation the local variables are gone when you exit 
a session (a nice feature that we also rely on in Selectrum):

```elisp
(defvar saved-command nil)

(defun save-command ()
   (message "Before: %s" saved-command)
   (setq-local saved-command real-this-command)
   (message "After: %s" saved-command))

(defun example-command ()
   (interactive)
   (read-string "Example1 : ")
   (read-string "Example2 : "))
```

Calling example-command above gives :

     Before: nil
     After: example-command

     Before: nil
     After: exit-minibuffer