From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Bug: `comment-line` within a SRC block moves point to beginning of block [9.2 (9.2-43-gf9a8cc-elpaplus)] Date: Tue, 29 Jan 2019 21:32:28 +0100 Message-ID: <87zhrjdx2b.fsf@nicolasgoaziou.fr> References: <1548704097.24632.1645495648.784E662C@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([209.51.188.92]:43148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goa3q-0000DE-FS for emacs-orgmode@gnu.org; Tue, 29 Jan 2019 15:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goa3p-00040q-M4 for emacs-orgmode@gnu.org; Tue, 29 Jan 2019 15:32:46 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:50859) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goa3o-0003wN-Cs for emacs-orgmode@gnu.org; Tue, 29 Jan 2019 15:32:45 -0500 In-Reply-To: <1548704097.24632.1645495648.784E662C@webmail.messagingengine.com> (Spencer Russell's message of "Mon, 28 Jan 2019 14:34:57 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Spencer Russell Cc: emacs-orgmode@gnu.org Hello, Spencer Russell writes: > I've been trying to troubleshoot an issue where running `comment-line` > within a SRC block moves point to the beginning of the block, rather > than after the commented line. > I've boiled it down to a reproduction that duplicates the root cause. > Open an org document, put point in a SRC block on some line besides the > first, and run the following: > ``` > (save-excursion > (org-babel-do-in-edit-buffer > (insert "FOO"))) > ``` > > This duplicates what happens in `org-comment-or-uncomment-region` > in `org.el`. > This will add "FOO" to point, as expected, but point jumps to the > beginning of the block (at least on my setup). According to the docs of > `org-edit-src-code`, which is used by `org-babel-do-in-edit-buffer`, it > removes the original code and replaces it with the edited code. That > seems like the source of the problem, because the marker saved by `save- > excursion` is lost. FWIW, I cannot reproduce it. Regards, -- Nicolas Goaziou