From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: with-current-buffer Date: Sun, 11 Sep 2005 17:15:53 -0400 Message-ID: <87psrfs40c.fsf-monnier+emacs@gnu.org> References: <877jdntumk.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1126475143 21500 80.91.229.2 (11 Sep 2005 21:45:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 11 Sep 2005 21:45:43 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 11 23:45:40 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EEZdl-0001eJ-U3 for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2005 23:45:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEZdl-0007Pf-97 for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2005 17:45:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EEZXF-0003h0-89 for emacs-devel@gnu.org; Sun, 11 Sep 2005 17:38:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EEZSG-0001xq-9P for emacs-devel@gnu.org; Sun, 11 Sep 2005 17:33:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEZSD-0001my-1S for emacs-devel@gnu.org; Sun, 11 Sep 2005 17:33:37 -0400 Original-Received: from [209.226.175.34] (helo=tomts13-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EEZBX-0001O6-Rs for emacs-devel@gnu.org; Sun, 11 Sep 2005 17:16:24 -0400 Original-Received: from alfajor ([70.49.81.204]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050911211553.PMQL25800.tomts13-srv.bellnexxia.net@alfajor>; Sun, 11 Sep 2005 17:15:53 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id 738E8D7361; Sun, 11 Sep 2005 17:15:53 -0400 (EDT) Original-To: Emilio Lopes In-Reply-To: (Emilio Lopes's message of "Sun, 11 Sep 2005 21:23:03 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:42829 Archived-At: >>> In both cases the insertion is done at the right spot, but in case >>> 1 point in buffer "FOO" is restored after the code is executed. >>> Is that intended behavior? >>> I expected point to be moved permanently in both cases. >> Which point? > The point in buffer "FOO", of course. If foo is displayed in a window, it has 2 points: its own and the one of the window. > I expected the point to stay at point max after `with-current-buffer' exits. It does stay there. Try (progn (with-current-buffer "FOO" (goto-char (point-max)) (insert "bar")) (with-current-buffer "FOO" (point))) > In the case 1 explained in the original message the code behaves as if it > were wrapped with `save-excursion'. No, it's just that the window's point gets copied to the buffer's point, probably during redisplay. > Can you reproduce it? Of course, Stefan