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: `save-excursion' defeated by `set-buffer' Date: Mon, 04 Jan 2010 13:33:08 -0500 Message-ID: References: <87aaxdqwqv.fsf@regnitz.physics.niu.edu> <47994.130.55.118.19.1262624933.squirrel@webmail.lanl.gov> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262630065 18414 80.91.229.12 (4 Jan 2010 18:34:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Jan 2010 18:34:25 +0000 (UTC) Cc: emacs-devel@gnu.org, Roland Winkler To: herring@lanl.gov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 04 19:34:17 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 1NRrku-0004i4-KI for ged-emacs-devel@m.gmane.org; Mon, 04 Jan 2010 19:34:16 +0100 Original-Received: from localhost ([127.0.0.1]:44742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRrkv-0003Xi-4j for ged-emacs-devel@m.gmane.org; Mon, 04 Jan 2010 13:34:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRrjv-0002TP-9B for emacs-devel@gnu.org; Mon, 04 Jan 2010 13:33:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRrjq-0002Ki-Dy for emacs-devel@gnu.org; Mon, 04 Jan 2010 13:33:14 -0500 Original-Received: from [199.232.76.173] (port=36343 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRrjp-0002KI-VC for emacs-devel@gnu.org; Mon, 04 Jan 2010 13:33:09 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:40457 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NRrjp-00067C-LJ for emacs-devel@gnu.org; Mon, 04 Jan 2010 13:33:09 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArMEAO/CQUvO+KPG/2dsb2JhbACBRdQuhDAEiik X-IronPort-AV: E=Sophos;i="4.47,499,1257138000"; d="scan'208";a="52912376" Original-Received: from 206-248-163-198.dsl.teksavvy.com (HELO pastel.home) ([206.248.163.198]) by ironport2-out.pppoe.ca with ESMTP; 04 Jan 2010 13:33:09 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id EF2778FD6; Mon, 4 Jan 2010 13:33:08 -0500 (EST) In-Reply-To: <47994.130.55.118.19.1262624933.squirrel@webmail.lanl.gov> (Davis Herring's message of "Mon, 4 Jan 2010 09:08:53 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:119389 Archived-At: > If we know that (eq foo (current-buffer)), we should drop the > `set-buffer'. If we know that not to be the case, we should use > `with-current-buffer' (or perhaps `save-current-buffer'). But what if it > could but needn't be? Let's try it this way: If we know that (eq foo 0), we should drop the increment. If we know that not to be the case, we should just use (incf bar foo). But what if it could but needn't be? I.e. just use with-current-buffer and stop worrying about the case where it may end up doing nothing. Stefan