From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: How to know the buffer I will return to from the minibuffer?
Date: Thu, 14 Feb 2019 09:39:24 +0100 [thread overview]
Message-ID: <20190214083924.GC26522@tuxteam.de> (raw)
In-Reply-To: <87r2caonep.fsf@mbork.pl>
[-- Attachment #1: Type: text/plain, Size: 967 bytes --]
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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2019-02-14 8:39 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 [this message]
2019-02-17 6:00 ` Marcin Borkowski
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=20190214083924.GC26522@tuxteam.de \
--to=tomas@tuxteam.de \
--cc=help-gnu-emacs@gnu.org \
/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).