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: Mon, 4 Jan 2010 01:09:53 -0800 Message-ID: <1DA372296B5F41A1A3317F557D27355D@us.oracle.com> References: <87aaxdqwqv.fsf@regnitz.physics.niu.edu><876380nvnt.fsf@lola.goethe.zz><87hbrijbyg.fsf@lola.goethe.zz><87skb0iw04.fsf@lola.goethe.zz> 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 1262596220 1098 80.91.229.12 (4 Jan 2010 09:10:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Jan 2010 09:10:20 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'Stefan Monnier'" , "'David Kastrup'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 04 10:10:13 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 1NRix1-0000L7-De for ged-emacs-devel@m.gmane.org; Mon, 04 Jan 2010 10:10:11 +0100 Original-Received: from localhost ([127.0.0.1]:42040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRix1-0003qh-Uc for ged-emacs-devel@m.gmane.org; Mon, 04 Jan 2010 04:10:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRiwv-0003qU-RV for emacs-devel@gnu.org; Mon, 04 Jan 2010 04:10:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRiwr-0003q5-RR for emacs-devel@gnu.org; Mon, 04 Jan 2010 04:10:05 -0500 Original-Received: from [199.232.76.173] (port=49510 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRiwr-0003py-F8 for emacs-devel@gnu.org; Mon, 04 Jan 2010 04:10:01 -0500 Original-Received: from rcsinet12.oracle.com ([148.87.113.124]:55387) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NRiwn-00015T-P5; Mon, 04 Jan 2010 04:09:58 -0500 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet12.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o0499smM024947 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Jan 2010 09:09:56 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o0499q2O027896; Mon, 4 Jan 2010 09:09:53 GMT Original-Received: from abhmt017.oracle.com by acsmt358.oracle.com with ESMTP id 1274978231262596175; Mon, 04 Jan 2010 03:09:35 -0600 Original-Received: from dradamslap1 (/24.5.185.59) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Jan 2010 01:09:34 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AcqJUH2Jy1c7mbcLTfyWuPOc/Rew9wDxAJHw X-Source-IP: acsmt354.oracle.com [141.146.40.154] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090208.4B41B062.005F: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:119346 Archived-At: So this thread seems to have petered out. I was hoping for some better understanding. I would like to see a clear, logical presentation of what your position is, Stefan. It's not obvious to me what this is all about. What David said in the thread made sense to me. I'm willing to learn that you have a good point, Stefan, but so far I don't understand it. The Elisp manual still (23.1.91) says, e.g., "you should normally use `set-buffer' within a `save-current-buffer' or `save-excursion'". And it has model examples that use (save-excursion... (set-buffer...)...), including where we explain about changing the current buffer. See nodes `Cleanups', `Creating Buffer-Local', `Current Buffer', and `Clickable Text'. And there are other nodes that use `switch-to-buffer' within a `save-excursion' (which would seem to be a similar issue). Node `Excursions', which provides the doc for `save-excursion', has no example using `set-buffer', but neither does it say anything that contradicts the use of `set-buffer' with `save-excursion'. The explanation in that node is just what I've always understood wrt `save-excursion'. It makes it clear that only point and mark of the current buffer are saved and restored, along with the identity of the current buffer. So I really don't see what the problem is. `set-buffer' changes only the buffer. `save-excursion' saves and restores only the identity of the current buffer and its point and mark - nothing more. What else is there to know about their use together? What is the real issue? How does `set-buffer' "defeat" `save-excursion' _in general_? (This is a general warning.) Sure, if someone doesn't understand what `save-excursion' does, and mistakenly thinks, e.g., that it restores point and mark in more than just the original buffer, then the programmer's intention is likely to be defeated. But that's not a general problem of using the two together; that's just misunderstanding what they do. If that's the only "problem" we are warning programmers about, then I think the warning is misguided. If that's not what this warning is about, then what is? If your way of looking at this (which is not yet clear to me) is somehow better, then how about a clear argument? I, for one, am willing to learn, but so far this warning and your defense of it have at best only confused me instead of enlightening me. And if the warning is truly useful, then it should say more clearly what the problem is that it is warning about. If you can't say that in a message, then have the message point to an explanation in the manual.