From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bastien Newsgroups: gmane.emacs.devel Subject: Re: Using `save-window-excursion' instead of `save-excursion' for `comment-region'? Date: Fri, 06 Dec 2013 10:49:17 +0100 Message-ID: <8738m6z4v6.fsf@bzg.ath.cx> References: <87y53zk3dx.fsf@bzg.ath.cx> <87ob4vuoi8.fsf@bzg.ath.cx> <87fvq7dsou.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1386323370 28794 80.91.229.3 (6 Dec 2013 09:49:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Dec 2013 09:49:30 +0000 (UTC) Cc: Aaron Ecay , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 06 10:49:35 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vos2R-0005pR-O6 for ged-emacs-devel@m.gmane.org; Fri, 06 Dec 2013 10:49:35 +0100 Original-Received: from localhost ([::1]:58074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vos2R-0006kN-Cx for ged-emacs-devel@m.gmane.org; Fri, 06 Dec 2013 04:49:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vos2K-0006bR-0Q for emacs-devel@gnu.org; Fri, 06 Dec 2013 04:49:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vos2F-0002Cc-1J for emacs-devel@gnu.org; Fri, 06 Dec 2013 04:49:27 -0500 Original-Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:43394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vos2E-0002Be-Le for emacs-devel@gnu.org; Fri, 06 Dec 2013 04:49:22 -0500 Original-Received: by mail-wi0-f177.google.com with SMTP id cc10so546625wib.10 for ; Fri, 06 Dec 2013 01:49:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=6BFuFepmKoePtaFAE7HHX+wtFz61hBVI5CE4PILH88Q=; b=gAiFKsfNl3qhaIimRQcOaN0ffTVIKeFOGfK5Ue1+P4/S2c71dY1jNRFSA4yU9MoTjt GLACBNAq5XTB2hGSlurfJA64Y/oznJhrnaXRpw309KGBKP/epFWtYZLpD349zFa34pMU VjzKYOQaHxMZb25jrPXhz3J3ukKYf4dGCaJAmA3iQzF29PiwPmSlcILBifipnIHyl7sL vmrJR5747CeAo77uyDLHTzO/Fq5/A4vgKtz+XrDR563DqAIDp6WIvb6E2lvZ1chBImVe PtH3PVRQ3NtBNA3z7lDyXTDgZIHgKeVYoSbOGqjVnl0DTqyz4nUsObbtGQuI4Pahuw0m BCiw== X-Received: by 10.194.93.105 with SMTP id ct9mr2179625wjb.6.1386323361796; Fri, 06 Dec 2013 01:49:21 -0800 (PST) Original-Received: from bzg.localdomain (mar75-2-81-56-68-112.fbx.proxad.net. [81.56.68.112]) by mx.google.com with ESMTPSA id pi6sm4613796wic.3.2013.12.06.01.49.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Dec 2013 01:49:19 -0800 (PST) Original-Received: by bzg.localdomain (Postfix, from userid 1000) id A24881C208D0; Fri, 6 Dec 2013 10:49:17 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Thu, 05 Dec 2013 14:45:29 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:166160 Archived-At: Stefan Monnier writes: > I think your analysis is exactly right, and the reason why > save-window-excursion doesn't exhibit the problem is because > save-window-excursion does not save-excursion in the current buffer. > I.e. paradoxically it's because it "preserves less" rather than because > it "preserves more". Replacing the save-excursion with > save-current-buffer would probably work as well. I see, thanks. I've fixed the problem in Org by creating `org-comment-dwim', which use comment-dwim when outside a source block, and `org-babel-do-in-edit-buffer' (directly, not wrapped into comment-region) when the point is within a buffer. Aaron, thanks for your input and for testing this heavily. -- Bastien