From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#12208: yes-or-no-p escapes with-current-buffer Date: Sat, 18 Aug 2012 15:15:30 +0200 Message-ID: <502F9572.3040009@gmx.at> References: <502CBF82.3080601@gmx.at> <502E3482.5060300@gmx.at> <502E60C0.4080809@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345295765 6055 80.91.229.3 (18 Aug 2012 13:16:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Aug 2012 13:16:05 +0000 (UTC) Cc: 12208@debbugs.gnu.org To: Steve Hafner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 18 15:16:05 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 1T2ism-00020K-5u for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Aug 2012 15:16:04 +0200 Original-Received: from localhost ([::1]:37963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2isk-0000rh-VX for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Aug 2012 09:16:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2isi-0000rP-Lw for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2012 09:16:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2ish-0004wG-QY for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2012 09:16:00 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2ish-0004wA-Im for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2012 09:15:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T2isj-0005I0-Gz for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2012 09:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2012 13:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12208-submit@debbugs.gnu.org id=B12208.134529574620312 (code B ref 12208); Sat, 18 Aug 2012 13:16:01 +0000 Original-Received: (at 12208) by debbugs.gnu.org; 18 Aug 2012 13:15:46 +0000 Original-Received: from localhost ([127.0.0.1]:36974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T2isT-0005HY-Gz for submit@debbugs.gnu.org; Sat, 18 Aug 2012 09:15:46 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:35664) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1T2isQ-0005HP-F1 for 12208@debbugs.gnu.org; Sat, 18 Aug 2012 09:15:43 -0400 Original-Received: (qmail invoked by alias); 18 Aug 2012 13:15:39 -0000 Original-Received: from 62-47-43-80.adsl.highway.telekom.at (EHLO [62.47.43.80]) [62.47.43.80] by mail.gmx.net (mp072) with SMTP; 18 Aug 2012 15:15:39 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19+iwQ/1it+x0UrzXbQ8ZKszVzUjKjZvtuH0zvRQN X+MSxQggmR03dk In-Reply-To: X-Y-GMX-Trusted: 0 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:63267 Archived-At: > Actually, I'm coming up with a few problems. I applied your patch to > Git sources, and evaluating from buffer1 leaves the point at position > 2. Things seem to work correctly in buffer2, though. > > And trying yes-or-no-p again, the behavior is the same as in my original post: > > > (let ((form > "(with-current-buffer \"*buffer1*\" > (goto-char (point-min)) > (yes-or-no-p \"\") > (setq x (1+ x)) > (insert (format \"%s\" x)))")) > (setq x 0) > (switch-to-buffer (get-buffer-create "*buffer1*")) > (insert form) > (split-window) > (other-window 1) > (switch-to-buffer (get-buffer-create "*buffer2*")) > (insert form) > (other-window 1)) Sorry, the patch worked only when the selected window did not change. Please try the one below. Thanks, martin === modified file 'src/window.c' --- src/window.c 2012-08-18 06:06:39 +0000 +++ src/window.c 2012-08-18 13:09:15 +0000 @@ -5889,7 +5889,13 @@ } if (!NILP (new_current_buffer)) - Fset_buffer (new_current_buffer); + { + Fset_buffer (new_current_buffer); + /* If the new current buffer doesn't appear in the selected + window, go to its old point. */ + if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) + Fgoto_char (make_number (old_point)); + } Vminibuf_scroll_window = data->minibuf_scroll_window; minibuf_selected_window = data->minibuf_selected_window;