From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: with-current-buffer Date: Sun, 11 Sep 2005 15:23:11 -0500 (CDT) Message-ID: <200509112023.j8BKNB300964@raven.dms.auburn.edu> References: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1126470944 11736 80.91.229.2 (11 Sep 2005 20:35:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 11 Sep 2005 20:35:44 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 11 22:35:39 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EEYWX-00020p-AO for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2005 22:34:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEYWW-00021e-NU for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2005 16:34:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EEYUw-0001Mz-7l for emacs-devel@gnu.org; Sun, 11 Sep 2005 16:32:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EEYUi-0001FB-U9 for emacs-devel@gnu.org; Sun, 11 Sep 2005 16:32:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEYUi-0000zy-3M for emacs-devel@gnu.org; Sun, 11 Sep 2005 16:32:08 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EEYNI-0005Yx-AA for emacs-devel@gnu.org; Sun, 11 Sep 2005 16:24:28 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id j8BKNs42011721; Sun, 11 Sep 2005 15:23:54 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j8BKNB300964; Sun, 11 Sep 2005 15:23:11 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: eclig@gmx.net In-reply-to: (message from Emilio Lopes on Sun, 11 Sep 2005 17:00:53 +0200) 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:42827 Archived-At: Emilio Lopes wrote: Display a buffer, let's say "FOO", with some content. Move point to its beginning. Insert the following code in the "*scratch*" buffer: (with-current-buffer "FOO" (goto-char (point-max)) (insert "bar")) Now execute the code above in these two different situations: 1- The buffer "FOO" is visible along with the "*scratch*" buffer. 2- The buffer "FOO" is not visible. 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. Point in the buffer is not restored in either case. Just execute: (with-current-buffer "FOO" (point)) immediately afterwards. You will see that point _in the buffer_ really is where you expect it to be. But each window that displays the buffer has its own value of point. That value would not be restored either, if you would change it. But your code never changes it. You should use set-window-point, if that is what you want to do, Is that intended behavior? I definitely believe that it is intended. Sincerely, Luc.