From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#12766: read-from-minibuffer does not preserve current-buffer Date: Tue, 30 Oct 2012 09:51:18 -0400 Message-ID: References: <508FABAE.4050104@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1351605111 27291 80.91.229.3 (30 Oct 2012 13:51:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2012 13:51:51 +0000 (UTC) Cc: 12766@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 30 14:51:58 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TTCEW-0000NP-8m for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2012 14:51:56 +0100 Original-Received: from localhost ([::1]:59349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTCEN-0005Xq-Kg for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2012 09:51:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTCEG-0005Ve-L4 for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2012 09:51:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTCE6-0001sc-TS for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2012 09:51:40 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTCE6-0001sY-QS for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2012 09:51:30 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TTCGX-0000Vv-N6 for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2012 09:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Oct 2012 13:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12766 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12766-submit@debbugs.gnu.org id=B12766.13516052391967 (code B ref 12766); Tue, 30 Oct 2012 13:54:01 +0000 Original-Received: (at 12766) by debbugs.gnu.org; 30 Oct 2012 13:53:59 +0000 Original-Received: from localhost ([127.0.0.1]:39214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TTCGU-0000Vf-U7 for submit@debbugs.gnu.org; Tue, 30 Oct 2012 09:53:59 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:59597) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TTCGS-0000VX-PK for 12766@debbugs.gnu.org; Tue, 30 Oct 2012 09:53:57 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu0/O+LET/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="203143590" Original-Received: from 206-248-177-19.dsl.teksavvy.com (HELO pastel.home) ([206.248.177.19]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 30 Oct 2012 09:51:24 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id D305059419; Tue, 30 Oct 2012 09:51:18 -0400 (EDT) In-Reply-To: <508FABAE.4050104@gmx.at> (martin rudalics's message of "Tue, 30 Oct 2012 11:27:58 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66238 Archived-At: >> % src/emacs -Q --eval "(setq initial-frame-alist '((minibuffer . nil)))" >> M-: (with-temp-buffer (list (read-string "toto: ") (current-buffer))) RET > Two changes I made could be involved: > (1) `select-window' now always makes the window's buffer current. > (2) read_minibuf now calls set_window_buffer instead of > Fset_window_buffer. I think (1) is more likely to be the problem. Could you check read_minibuf to see which unwind is supposed to reset the current buffer? Maybe that code worked by accident (.e.g relying on the fact that select-window didn't set current-buffer in that corner case) and the right fix is simply to explicitly save&restore current buffer. > Also, is this related to the comment > ;; FIXME: kill-buffer can change current-buffer in some odd cases. > in `with-temp-buffer'? No, (current-buffer) is evaluated before the buffer gets killed, and the bug shows up with with-temp-buffer (the recipe is just shorter with with-temp-buffer, but you can try it with (with-current-buffer (get-buffer-create " *sm-test*") ...) to convince yourself). Stefan