From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: `save-excursion' defeated by `set-buffer' Date: Sun, 10 Jan 2010 10:06:41 -0800 Message-ID: References: <87ocl8gvcn.fsf@lola.goethe.zz><558DC61A9B3E4FF89CC53FF9DF7F7709@us.oracle.com> <20100110.105820.347261995.hanche@math.ntnu.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1263146854 3157 80.91.229.12 (10 Jan 2010 18:07:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Jan 2010 18:07:34 +0000 (UTC) To: "'Harald Hanche-Olsen'" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 10 19:07:27 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NU2CD-0006jJ-IS for ged-emacs-devel@m.gmane.org; Sun, 10 Jan 2010 19:07:25 +0100 Original-Received: from localhost ([127.0.0.1]:38665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NU2CE-0005qQ-8Y for ged-emacs-devel@m.gmane.org; Sun, 10 Jan 2010 13:07:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NU2Bf-0005LU-FG for emacs-devel@gnu.org; Sun, 10 Jan 2010 13:06:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NU2Ba-0005Jk-Pp for emacs-devel@gnu.org; Sun, 10 Jan 2010 13:06:51 -0500 Original-Received: from [199.232.76.173] (port=35720 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NU2Ba-0005Je-IU for emacs-devel@gnu.org; Sun, 10 Jan 2010 13:06:46 -0500 Original-Received: from acsinet11.oracle.com ([141.146.126.233]:62002) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NU2Ba-00075t-0T for emacs-devel@gnu.org; Sun, 10 Jan 2010 13:06:46 -0500 Original-Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by acsinet11.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o0AI6abw026148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 10 Jan 2010 18:06:38 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o0AI6YTP010116; Sun, 10 Jan 2010 18:06:35 GMT Original-Received: from abhmt002.oracle.com by acsmt355.oracle.com with ESMTP id 1310050601263146791; Sun, 10 Jan 2010 10:06:31 -0800 Original-Received: from dradamslap1 (/24.5.185.59) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 10 Jan 2010 10:06:31 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <20100110.105820.347261995.hanche@math.ntnu.no> Thread-Index: AcqSDgG/ghzW3b0VRfWcl14VmCJ6GQAEDFJQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: acsmt357.oracle.com [141.146.40.157] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090203.4B4A172C.0038:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:119789 Archived-At: > A is inserted four places after point, but point does not move: > (with-current-buffer "*scratch*" (forward-char 4) (insert "A")) Actually, I think that `point' does move. What doesn't move is `window-point'. Which is the correct behavior. Try `M-x foo' (a) with *scratch* displayed and (b) without *scratch* displayed: (defun foo () (interactive) (with-current-buffer "*scratch*" (bar) (forward-char 4) (bar) (insert "A") (bar))) (defun bar () (message "%S, %S, %S" (current-buffer) (point) (and (get-buffer-window "*scratch*" 0) (window-point (get-buffer-window "*scratch*" 0))))) Starting with point at 1, you see this: (a) *scratch* displayed #, 1, 1 #, 5, 1 #, 6, 1 (b) *scratch* not displayed #, 1, nil #, 5, nil #, 6, nil