From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: excalamus--- via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Comments within Org src block move point unexpectedly Date: Fri, 9 Apr 2021 15:13:40 +0200 (CEST) Message-ID: Reply-To: excalamus@tutanota.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18356"; mail-complaints-to="usenet@ciao.gmane.io" To: Help Gnu Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 09 15:14:22 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUqxo-0004cH-Bu for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 09 Apr 2021 15:14:20 +0200 Original-Received: from localhost ([::1]:57430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUqxn-00034O-E8 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 09 Apr 2021 09:14:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUqxH-000335-4t for help-gnu-emacs@gnu.org; Fri, 09 Apr 2021 09:13:47 -0400 Original-Received: from w1.tutanota.de ([81.3.6.162]:38462) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUqxE-0004n8-Ia for help-gnu-emacs@gnu.org; Fri, 09 Apr 2021 09:13:46 -0400 Original-Received: from w3.tutanota.de (unknown [192.168.1.164]) by w1.tutanota.de (Postfix) with ESMTP id BB229FBF52E for ; Fri, 9 Apr 2021 13:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1617974020; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=035WIqE0ujPuO19r3q9Xc/s7dv3z54bZKa4QrZ38JY0=; b=G0+ZPQtf1wGjpeWVKMlb5TGKRCxcBDNIRLD7/2CY4hVPpJdR1EOGYL0Nbe08xGvt AqGxbjcmCet2sKgewdNqvOuEhUjUDehUG6O7CPpZKEpVCIRWxA/wKvk4XUT9g/1FuRh iOENhQ8AlfH5tXIk4Vkv/EOcVHEzoEvA/ctqKl3Kh06lVa/qVQ90K7bnP2ZXInqhFt7 xO8qNqJS0ajBjiIcgPiaFUqacApNKlMbsOGLCP4Eu2vaSO0r6Af/Cdlpxrp5KDnA5Hw OAjUIyl9fCY6a4FS6t/KJd6actoLW6WVfQyxELQGfATluCiBqmROiVeg5QX/278w755 zIQ1n8oBww== Received-SPF: pass client-ip=81.3.6.162; envelope-from=excalamus@tutanota.com; helo=w1.tutanota.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:128915 Archived-At: The usual behavior of comment-line is to move point to the next line.When c= ommenting code within an Org source block, however, the point will jump to = some previous line. For example, say that point is at |: #+begin_src emacs-lisp (defun hello () "Say hi." (interactive)| (= message "Hello, world!"))#+end_src When comment-line is called, the current line is commented, but point also = moves to the indent of the previous line: #+begin_src emacs-lisp (defun hello () |"Say hi." ;; (interactive) = (message "Hello, world!"))#+end_src The point will jump near the top of the block when the block contains more = code (i.e. will jump entire screen heights). Ideally, I would like point to stay put (relative to the adjacent character= s prior to (un)commenting).=C2=A0 I would at least expect comment-line to b= ehave in a source block like it does outside of one. I've tried a handful of related solutions (see links below). They all move= point similarly. It looks like comment-or-uncomment-region is the typical= entry point.=C2=A0 AFAIK, it ultimately hinges on the comment-region-funct= ion which is comment-region-default-1 by default. Stepping through, it's n= ot clear to me which part moves point to a previous line.=C2=A0 Does anyone= have some insight? https://stackoverflow.com/questions/9688748/emacs-comment-uncomment-current= -line https://stackoverflow.com/questions/20041904/eclipse-like-line-commenting-i= n-emacs/20064658#20064658