help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to know the buffer I will return to from the minibuffer?


From: Marcin Borkowski
Subject: Re: How to know the buffer I will return to from the minibuffer?
Date: Sun, 17 Feb 2019 07:00:05 +0100
User-agent: mu4e 1.1.0; emacs 27.0.50

On 2019-02-14, at 09:39, tomas@tuxteam.de wrote:

> On Thu, Feb 14, 2019 at 08:10:54AM +0100, Marcin Borkowski wrote:
>> Hi all,
>> 
>> I am writing an interactive command to be used while in the minibuffer.
>> I need to know the buffer I was in when I issued the command that put me
>> in the minibuffer (like M-: or M-!).  I tried (other-buffer
>> (current-buffer)) and (last-buffer (current-buffer)), but to no avail.
>> Then I re-read the docs for `other-buffer' and used this: (other-buffer
>> (current-buffer) t), and it seemed to work.  The question is, how
>> reliable it is.  Am I doing this correctly?
>
> There's also minibuffer-selected-window (Emacs 27.0.50 here):
>
>   minibuffer-selected-window is a built-in function in ‘C source code’.
>
>   (minibuffer-selected-window)
>
>   Return window selected just before minibuffer window was selected.
>   Return nil if the selected window is not a minibuffer window.
>   This function does not change global state, including the match data.
>
> HTH
> -- tomás

Yes, that seems to help a lot - thanks!

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]