unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: tomas@tuxteam.de
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to know the buffer I will return to from the minibuffer?
Date: Sun, 17 Feb 2019 07:00:05 +0100	[thread overview]
Message-ID: <8736onq7iy.fsf@mbork.pl> (raw)
In-Reply-To: <20190214083924.GC26522@tuxteam.de>


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	other threads:[~2019-02-17  6:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14  7:10 How to know the buffer I will return to from the minibuffer? Marcin Borkowski
2019-02-14  8:39 ` tomas
2019-02-17  6:00   ` Marcin Borkowski [this message]
2019-02-14 15:38 ` Drew Adams
2019-02-17  5:59   ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736onq7iy.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tomas@tuxteam.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).