From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Using `save-window-excursion' instead of `save-excursion' for `comment-region'? Date: Thu, 05 Dec 2013 12:46:12 +0100 Message-ID: <52A06784.9040806@gmx.at> References: <87y53zk3dx.fsf@bzg.ath.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1386244004 20598 80.91.229.3 (5 Dec 2013 11:46:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Dec 2013 11:46:44 +0000 (UTC) Cc: emacs-devel@gnu.org To: Bastien Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 05 12:46:48 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 1VoXOD-0002Ad-Uv for ged-emacs-devel@m.gmane.org; Thu, 05 Dec 2013 12:46:42 +0100 Original-Received: from localhost ([::1]:53004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoXOD-0006XP-DS for ged-emacs-devel@m.gmane.org; Thu, 05 Dec 2013 06:46:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoXO3-0006XH-SK for emacs-devel@gnu.org; Thu, 05 Dec 2013 06:46:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoXNw-00008m-JA for emacs-devel@gnu.org; Thu, 05 Dec 2013 06:46:31 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:63153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoXNw-00008d-9V for emacs-devel@gnu.org; Thu, 05 Dec 2013 06:46:24 -0500 Original-Received: from [62.47.38.73] ([62.47.38.73]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0LfkJC-1VDofN0OxG-00pIK1 for ; Thu, 05 Dec 2013 12:46:23 +0100 In-Reply-To: <87y53zk3dx.fsf@bzg.ath.cx> X-Provags-ID: V03:K0:IHDx0GzN5dunnHBPhI613UPriehkDiffLjsrnCc5uCXikouVbbi jn7UsjPa6DgCHxBVPYc4jN2+POMyRGM2C8S4XHr578Uwj97PT00fSu6eoigo738VGNTeKzs 9TIxArySLzg5hxQk0lhbu1agGk8jeKrWEpcbXiBR14iFdoHICR429Kb7wqOHC/GzKkAVSwx DZtjNvNbpuAZMWYptrfbw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.15.15 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:166113 Archived-At: > In Org buffer, you can comment code within source blocks. This opens > a new buffer, insert the code there, comment it, and insert the buffer > contents back into Org's buffer. > > With the current `comment-region' function, point is lost when Org > goes back to the org buffer. Using `save-window-excursion' instead > of `save-excursion' fixes the problem. > > Are you aware of problems that this change may trigger? > > I cannot think of any, but I'm always a bit cautious when using > `save-window-excursion'. Please be. `save-window-excursion' should be used iff you really change the window configuration as, for example, by resizing, deleting or creating windows, or showing a different buffer in some window. WOW everything covered by `window-configuration-change-hook'. In the case you describe above you do not show the buffer used for inserting the code, commenting it, ... in a window IIUC so that requirement is not satisfied. Can you explain why `save-excursion' fails? martin