From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: How to know the buffer I will return to from the minibuffer? Date: Sun, 17 Feb 2019 07:00:05 +0100 Message-ID: <8736onq7iy.fsf@mbork.pl> References: <87r2caonep.fsf@mbork.pl> <20190214083924.GC26522@tuxteam.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="199150"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.1.0; emacs 27.0.50 Cc: help-gnu-emacs@gnu.org To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 17 07:01:18 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvFVu-000peD-GY for geh-help-gnu-emacs@m.gmane.org; Sun, 17 Feb 2019 07:01:18 +0100 Original-Received: from localhost ([127.0.0.1]:36995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvFVt-0001aL-JE for geh-help-gnu-emacs@m.gmane.org; Sun, 17 Feb 2019 01:01:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvFVi-0001Zc-IF for help-gnu-emacs@gnu.org; Sun, 17 Feb 2019 01:01:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvFVh-0003Rj-IM for help-gnu-emacs@gnu.org; Sun, 17 Feb 2019 01:01:06 -0500 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:55252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvFVh-0003KE-9F for help-gnu-emacs@gnu.org; Sun, 17 Feb 2019 01:01:05 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 4B620E68C5; Sun, 17 Feb 2019 07:01:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aVmahdN-qLAd; Sun, 17 Feb 2019 07:00:55 +0100 (CET) Original-Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id F0248E66A3; Sun, 17 Feb 2019 07:00:54 +0100 (CET) In-reply-to: <20190214083924.GC26522@tuxteam.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.110.48.8 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119436 Archived-At: 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, >>=20 >> 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 =E2=80=98C source = code=E2=80=99. > > (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=C3=A1s Yes, that seems to help a lot - thanks! --=20 Marcin Borkowski http://mbork.pl