From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: How to know the buffer I will return to from the minibuffer? Date: Thu, 14 Feb 2019 09:39:24 +0100 Message-ID: <20190214083924.GC26522@tuxteam.de> References: <87r2caonep.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hYooF8G/hrfVAmum" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="65841"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 14 09:40:01 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 1guCYq-000GyS-Fx for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Feb 2019 09:40:00 +0100 Original-Received: from localhost ([127.0.0.1]:43111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guCYn-0004Mb-5n for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Feb 2019 03:39:57 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guCYP-0004L0-A3 for help-gnu-emacs@gnu.org; Thu, 14 Feb 2019 03:39:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guCYN-0008Iy-E0 for help-gnu-emacs@gnu.org; Thu, 14 Feb 2019 03:39:32 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:34250) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1guCYJ-0008Fd-U3 for help-gnu-emacs@gnu.org; Thu, 14 Feb 2019 03:39:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=2W1+kaC9adwy0WO62u5nz9hu0Cg7A+chx33KYCvQbHc=; b=Obl3FCVvGDzD5cak1rAFZwni/9H4O4iVPWpPzoxINOzyax0jT5gAGAZ6T15vpjQkkPisfzmHeidXZVblAOw7S/ZKQScOxqRvxgXlCMhGxpMaGoxx1Gn+86xewWs/60aUNhTD7xi9BkIyhjOEnSNadQw8K/shfVMrzpXBw77W1GV1I3nvRfPEV1yDh7kcXM6Mp3N3fKd6xaD043kw46Y/sJte2EXGmIJlL7fJOBXOChk2SWnX9wWvwzzEf102EeXadPDpGXmJza0q3mB04nuqFP8PtkowPDxahBoNMQ+DRZZ86AvWwtAJkubHC4nYHQZQt1QOIwwCyI9776M3mVr7Pw==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1guCYG-00076e-NY for help-gnu-emacs@gnu.org; Thu, 14 Feb 2019 09:39:24 +0100 Content-Disposition: inline In-Reply-To: <87r2caonep.fsf@mbork.pl> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.199.139.25 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:119397 Archived-At: --hYooF8G/hrfVAmum Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 co= de=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 --hYooF8G/hrfVAmum Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlxlKTwACgkQBcgs9XrR2kaezACeJAgfJ6SRnTaO+4VCYDj4HTw6 nI4AnRcqsfBj0RXCn23rAfZ+dsHnwvEi =eM/9 -----END PGP SIGNATURE----- --hYooF8G/hrfVAmum--