From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sO+IOxYyp2G2OgAAgWs5BA (envelope-from ) for ; Wed, 01 Dec 2021 09:28:06 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id UP1NNxYyp2EqHwAA1q6Kng (envelope-from ) for ; Wed, 01 Dec 2021 08:28:06 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 763981E0A8 for ; Wed, 1 Dec 2021 09:28:06 +0100 (CET) Received: from localhost ([::1]:59244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msKyD-0007tw-Bi for larch@yhetil.org; Wed, 01 Dec 2021 03:28:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msKnX-0006GR-Hf for emacs-orgmode@gnu.org; Wed, 01 Dec 2021 03:17:07 -0500 Received: from [2001:7c0:300c:3105::8602:5d5] (port=56346 helo=mx03.uni-tuebingen.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msKnU-00085w-MJ for emacs-orgmode@gnu.org; Wed, 01 Dec 2021 03:17:03 -0500 Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com [66.111.4.228]) by mx03.uni-tuebingen.de (Postfix) with ESMTPSA id 776E620CA7C8; Wed, 1 Dec 2021 09:16:55 +0100 (CET) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id BDD4D27C0054; Wed, 1 Dec 2021 03:16:52 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 01 Dec 2021 03:16:52 -0500 X-ME-Sender: X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddriedvgdduudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhffkfggtgesthdttddttddttdenucfhrhhomheptfhitghhrghr ugcunfgrfihrvghntggvuceorhhitghhrghrugdrlhgrfihrvghntggvsehunhhiqdhtuh gvsghinhhgvghnrdguvgeqnecuggftrfgrthhtvghrnhepgefhueduteehjefgffevvefh vefgvdffgeehgfduhedvleduuddutddvheejhfetnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprhiflhdomhgvshhmthhprghuthhhphgvrhhs ohhnrghlihhthidquddujeekgeehuddvkedqudeltddvjeelgeegqdhrihgthhgrrhgurd hlrgifrhgvnhgtvgeppehunhhiqdhtuhgvsghinhhgvghnrdguvgesfhgrshhtmhgrihhl rdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Dec 2021 03:16:52 -0500 (EST) Received: from rwl by aquinas with local (Exim 4.92) (envelope-from ) id 1msKnJ-0002uP-E4; Wed, 01 Dec 2021 09:16:49 +0100 From: Richard Lawrence To: Tim Cross , Kaushal Modi Subject: Re: [PATCH] Fix org-comment-line-break-function In-Reply-To: <87lf14j0t4.fsf@gmail.com> References: <87lf18fue9.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> <87v90cpcdx.fsf@yandex.com> <87ilwcf31l.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> <87pmqjkai3.fsf@gmail.com> <87fsrffknl.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> <87czmijtrp.fsf@gmail.com> <87o861o9sh.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> <87h7btpfbt.fsf@gmail.com> <87zgpli5nc.fsf@gmail.com> <87lf14j0t4.fsf@gmail.com> Date: Wed, 01 Dec 2021 09:16:49 +0100 Message-ID: <874k7s91u6.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:7c0:300c:3105::8602:5d5 (failed) Received-SPF: pass client-ip=2001:7c0:300c:3105::8602:5d5; envelope-from=richard.lawrence@uni-tuebingen.de; helo=mx03.uni-tuebingen.de X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marco Wahl , emacs-org list , Nicolas Goaziou Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638347286; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=vLOiCz89S6ZzFtZoSC6ki8Yh74pGo93DRvBFVm3eVbc=; b=J9JxkLlSx5fxXXVwUgP+Pu/Pkxij3S6Guf9rV23Is1rh7l0kx5/VGjyG8RqBhLweuyM7qS 3aJgAtw+jsafSvHJVi9VQpR8PNRy+DRYfbUTdAyLG4SCvtBGLkJTmieFac2v/P+i+PbvlM A4zs98bi3SdoKhvBjw/y2qvH++dg1v+XiT/0eesMkApzJMwQT0yspjzoeB++Qmh1O4E6TQ JLMLhlAvkW0Pp8CJZiESJmmFd1PwVUrAqTKrGRoJDzL7NNnvj+HbcP3eqeET13CIe6eY39 YD2OnzeEzdaKvF0s4zfQNrz+D+KOIZXfCadCzptmBAXiDH71WfGbaNga/9l2XQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638347286; a=rsa-sha256; cv=none; b=BGqOScLWqR1yUw8cA4FqyIwEnKw5TUII8IdTVLbs9Efoxrs1aq0An1vsS1OSSFuPgPGhzF /CO8iDtfgQL2nzcekCc1xqjdLu7kziYpcPLftZbUDJ8u4BLYVik5eMag1uo+rK6XTXWcwM 9AzsGBMOz0fwqT5l1hgJfSRbFcz0y6E+OLcmQEV/cNQT+11ru5N8U9VjJo5qXfJMkIJ5dk zIJQDpBHUmwBHTyQOpED6901ktpRF7zJVmT2mr9GDUzxC4+DnI06fInci+YyL4vBuMUobu 1t0a9gl/LzQYo53fB0xE/FHd4IIGNTlZKu9vOdLDeYCIkYTihEiTyropC1ryNg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.51 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 763981E0A8 X-Spam-Score: -1.51 X-Migadu-Scanner: scn0.migadu.com X-TUID: PCrjNEqMJKZA Tim Cross writes: > Well, that is the big question - why was > org-comment-line-break-function added instead of just using the > default comment-indent-new-line? Looking back at commit d58d40f0c864ae3a6d7c66df34769619ad2486c1, I see this comment was added by Nicolas (still in org.el): ;; `org-auto-fill-function' takes care of auto-filling. It calls ;; `do-auto-fill' only on valid areas with `fill-prefix' shadowed with ;; `org-adaptive-fill-function' value. Internally, ;; `org-comment-line-break-function' breaks the line. which at least suggests ("Internally, ...") that org-comment-line-break-function was never intended to be called to break a comment via a user command like M-j, and was only intended to be called during filling, in a context where fill-prefix would be set correctly. In that case, the problem might be that org-setup-filling sets comment-line-break-function to 'org-comment-line-break-function (overriding the default value of 'comment-indent-new-line) "globally" in Org buffers, causing it to be called even when fill-prefix is not set correctly. The documentation for (the variable) comment-line-break-function is a bit confusing: "Mode-specific function that line breaks and continues a comment. This function is called during auto-filling when a comment syntax is defined." which also suggests that this function will only be called during filling. But that is clearly not true (even if it once was), since default-indent-new-line calls it directly. So maybe org-comment-line-break-function was written under assumptions that no longer hold? It might also be worth pointing out here that org-comment-line-break-function is *almost* a line-for-line copy of part of default-indent-new-line, except the latter is more careful about checking that fill-prefix is not nil before calling insert-* on it. > Until this is determined, I think the only 'safe' approach would be to > just advise those who are impacted by the M-j issue to set > comment-line-break-function to comment-indent-new-line and then wait > to see if someone who has more historical context to comment. This is a bit trickier than it sounds, because in Org buffers, org-setup-filling calls (setq-local comment-line-break-function 'org-comment-line-break-function) which will override any global value for comment-line-break-function (e.g. in your init file). So you'd have to reset it in Org buffers locally, via a hook that runs after org-setup-filling. -- Best, Richard