From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2PgoKccVrmGavAAAgWs5BA (envelope-from ) for ; Mon, 06 Dec 2021 14:53:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id LVnWJMcVrmE2ZQAAB5/wlQ (envelope-from ) for ; Mon, 06 Dec 2021 13:53:11 +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 3514A13927 for ; Mon, 6 Dec 2021 14:53:11 +0100 (CET) Received: from localhost ([::1]:39478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muEQY-0002QS-79 for larch@yhetil.org; Mon, 06 Dec 2021 08:53:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muEPO-0002Nz-Gc for emacs-orgmode@gnu.org; Mon, 06 Dec 2021 08:52:02 -0500 Received: from [2a00:1450:4864:20::42f] (port=36672 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1muEPM-0008Th-0N for emacs-orgmode@gnu.org; Mon, 06 Dec 2021 08:51:58 -0500 Received: by mail-wr1-x42f.google.com with SMTP id u17so15239491wrt.3 for ; Mon, 06 Dec 2021 05:51:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TRjRG5XDZj+Ss0hcx7rWlXGp6C69VcGw5/OjdI1eGFY=; b=HvS4TDnGKePIFMOvucNRz+d7EwMVIxKBdnBgtHFJoo6TRHFUgmiKCifu17eu7O+oud zvT59T6n4Mr8GgBhgZvD/u5bLQXrITrAmrUWyFXvdiixI+h7QYulyfrde46hsqGL7gTS KJ22oW/kc768RgH6Dw2id2UuRlhPdUJ/hOvVZ1VUY+MT4r205Hhv+5BJCM6TkH5uJnL9 QYROuJdep7ug+gz0lPZV22n4GXFDd1N8wmlLT/haKZv2N9SgZPYzoRw+jiU4TLROjIKG 3pTDR8wKARxFjlLk88YZddgV1K3sho+Sn+zX1TDy2TbEd6mg8U8Ow9BCAH38wJvemMaF d/QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TRjRG5XDZj+Ss0hcx7rWlXGp6C69VcGw5/OjdI1eGFY=; b=dNc+5tItNDg+xOHAVGl0ZFK8BvdVQMfMfr+jdAyI0vhsS5wxVjYWz2mhywlA6pLnOp kjYmSf+LfBgTOuTS+u0NGh1Su2VbU7fn/i+73IlcBJ362GiB4+8nfXR69g2FMaQKRjUk 59/LIT8TwDZ184xN8GdDkJ89sUTQZQoUWQPnsHdlkxhP9KQw4DgnNIIX70xgTrJSmH8R SCe6Ejv38v781rBFPZf6WC/EokoVoBzyStMy5sc1JeClhiGFvOJZ5CSApXtYpHelpJJP JAB5seqzBhaeP0XF0e+P0iHZmPLQoML7D9OGfxWfeHk0ZkH5WuPemStoqH94ITQMOJvI UblQ== X-Gm-Message-State: AOAM531P62wfrQnsP/nI9tpHjJkmXmQWBLb2v4WkGTbaqeQxIviW5Yh0 IzeYZcUzGA93YXlbqMoMlIy5iDCR+YCmXedGpDP+T+6ise4= X-Google-Smtp-Source: ABdhPJwNU7B6+7Ire91IvFdxYisB7vEGfFbd2FmOjFI82C9QiW6xD3kMWyWxkC7txOoLgVS9sfCw6dw0u2tYjVXbrFE= X-Received: by 2002:a5d:614f:: with SMTP id y15mr43386249wrt.587.1638798714053; Mon, 06 Dec 2021 05:51:54 -0800 (PST) MIME-Version: 1.0 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> <871r2suhw2.fsf@gmail.com> <87v901oost.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> In-Reply-To: <87v901oost.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> From: Kaushal Modi Date: Mon, 6 Dec 2021 08:51:22 -0500 Message-ID: Subject: Re: [PATCH] Fix org-comment-line-break-function To: Richard Lawrence Content-Type: multipart/alternative; boundary="00000000000035a68e05d27a8fe9" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=kaushal.modi@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 , Tim Cross , 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=1638798791; 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:dkim-signature; bh=TRjRG5XDZj+Ss0hcx7rWlXGp6C69VcGw5/OjdI1eGFY=; b=F87PX8xtxRT2+ycCpBAzqCtrC/Pqimf4TwXvCf42LetIvpNwiMYgrGtFzdcFEcCudMr+xf LK4wYbMYDRCUzcy7KQujml12MKe1I9VXgKvbBw6DgZDjtxoHtv9/ZUtBOr6IAkA/s0QEDQ RuTuU4wA61J9ZG0DaKjjO9q20y0hD7wwJECj/Kbj8eved9FL2CC7TX8ckaYpOUQyEiPRV/ NB+j8cwv3zygRWxCCzs7blwB0bT4Ry+poumfJo8eYIPG74HIYGRlHyZ2R2uwsgP8pt15s2 ++xIJGFFunMF1dPY4dYmELP93dAB3CbDTbZ1hdUxVFg4TZabAi+f6dqmWhVI/g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638798791; a=rsa-sha256; cv=none; b=icpItY10NtXSnJvMI72LqE6PJNUaOBquJxYHCxTZiLHWMPRAcT6+ggzcPtM2B6/mJupRsl gHJ2kOFt2RjJ1ce/a8CchhYRDgjnx1saHF+xRGikGfOZQd/imr/MBWyWiXLOZGNjC+si7q oRR/J2O4EyomTkJylqGPPshA1UNcVBqDg2LIQtjeniJoXGzJx9H73i4YmhXvJW+04+s9xQ GysYKCW95WKvTbGXuZnli0aDamLjen8wDQulDwIt+gRybF6AM2vUhM4E+5cIquqLx8yJiT vvjnp4ns0UVHT5LwEv0HnzckpyoqgfDM4fujv1LghqIg6kAhjWLaR5Tp+lynmQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=HvS4TDnG; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: -0.34 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=HvS4TDnG; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: 3514A13927 X-Spam-Score: -0.34 X-Migadu-Scanner: scn0.migadu.com X-TUID: BIcUHUicektX --00000000000035a68e05d27a8fe9 Content-Type: text/plain; charset="UTF-8" Hi Nicolas, I have added few tests in the updated patch pasted in this email. I have made the tests for (call-interactive #'default-indent-new-line) because that the interactive function M-j is bound to by default. Can you please review and commit it? The machine I am on right now does not allow external ssh access. >From de607dff518eaa91149ff1aa8c255f67fb6ee887 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Tue, 30 Nov 2021 20:37:10 -0500 Subject: [PATCH] org: Remove `org-comment-line-break-function' * lisp/org.el: Remove `org-comment-line-break-function' and let `comment-line-break-function' be the default value. * testing/lisp/test-org.el (test-org/default-indent-new-line): Add tests for M-j behavior when point is inside or outside an Org comment. This fixes the `M-j' binding issue reported by Richard Lawrence in . --- lisp/org.el | 17 ++--------------- testing/lisp/test-org.el | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index ec59ddf44..ee8ca1f03 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19624,8 +19624,7 @@ assumed to be significant there." ;; `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. +;; `org-adaptive-fill-function' value. ;; `org-setup-filling' installs filling and auto-filling related ;; variables during `org-mode' initialization. @@ -19647,8 +19646,7 @@ assumed to be significant there." (setq-local fill-paragraph-function 'org-fill-paragraph) (setq-local auto-fill-inhibit-regexp nil) (setq-local adaptive-fill-function 'org-adaptive-fill-function) - (setq-local normal-auto-fill-function 'org-auto-fill-function) - (setq-local comment-line-break-function 'org-comment-line-break-function)) + (setq-local normal-auto-fill-function 'org-auto-fill-function)) (defun org-fill-line-break-nobreak-p () "Non-nil when a new line at point would create an Org line break." @@ -19903,17 +19901,6 @@ filling the current element." (adaptive-fill-mode (not (equal fill-prefix "")))) (when fill-prefix (do-auto-fill)))))) -(defun org-comment-line-break-function (&optional soft) - "Break line at point and indent, continuing comment if within one. -The inserted newline is marked hard if variable -`use-hard-newlines' is true, unless optional argument SOFT is -non-nil." - (if soft (insert-and-inherit ?\n) (newline 1)) - (save-excursion (forward-char -1) (delete-horizontal-space)) - (delete-horizontal-space) - (indent-to-left-margin) - (insert-before-markers-and-inherit fill-prefix)) - ;;; Fixed Width Areas diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 056ea7d87..de4ac7ea9 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -1200,6 +1200,25 @@ (org-indent-region (point-min) (point-max)) (buffer-string))))) +(ert-deftest test-org/default-indent-new-line () + "Test behavior of default binding `M-j'." + ;; Calling `M-j' when point is not in an Org comment: + (should + (equal "* Some heading\n" + (org-test-with-temp-text "* Some heading" + (call-interactively #'default-indent-new-line) + (buffer-string)))) + ;; Calling `M-j' when point is in an Org comment: + (should + (equal "# Some Org comment\n# " + (org-test-with-temp-text "# Some Org comment" + (call-interactively #'default-indent-new-line) + (buffer-string)))) + (should + (equal "# Some Org\n# comment" + (org-test-with-temp-text "# Some Org comment" + (call-interactively #'default-indent-new-line) + (buffer-string))))) ;;; Editing -- 2.34.0 -- Kaushal Modi On Mon, Dec 6, 2021 at 8:17 AM Richard Lawrence < richard.lawrence@uni-tuebingen.de> wrote: > Kaushal Modi writes: > > > On Sat, Dec 4, 2021, 5:25 PM Tim Cross wrote: > > > >> Given that Nicholas cannot remember the reason for the original function > >> and suspects it was meant to be an internal only function, I think this > >> patch is probably the best way forward and should be applied. > > > > Thanks. Nicolas asked me to add tests for this patch. But I need to look > > into how to add tests for behavior of bindings. Need to add tests for M-j > > binding behavior when cursor is within a comment or outside. > > FWIW I have been running the equivalent of Kaushal's patch (I just > removed the local binding of comment-line-break-function to > 'org-comment-line-break-function without deleting the function) and have > also set > > (debug-on-entry 'org-comment-line-break-function) > > I've been running this for at least a week with no issues, and have > never been dropped into the debugger. So at least the testing through my > normal work indicates there are no problems with the patch. > > -- > Best, > Richard > --00000000000035a68e05d27a8fe9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Nicolas,

I have added few= tests in the updated patch pasted in this email.
I have made the= tests for (call-interactive #'default-indent-new-line) because that th= e interactive function M-j is bound to by default.

=
Can you please review and commit it? The machine I am on right now doe= s not allow external ssh access.


From de607dff518eaa91149ff1aa8c255f67fb6ee887 Mon Sep 17 00:00= :00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Tue, 30 Nov 2021 20:37:10 -0500Subject: [PATCH] org: Remove `org-comment-line-break-function'
* lisp/org.el: Remove `org-comment-line-break-function' and let
`co= mment-line-break-function' be the default value.
* testing/lisp/test= -org.el (test-org/default-indent-new-line): Add
tests for M-j behavior w= hen point is inside or outside an Org comment.

This fixes the `M-j&#= 39; binding issue reported by Richard Lawrence in
<https://lists.gnu.org= /r/emacs-orgmode/2021-11/msg00639.html>.
---
=C2=A0lisp/org.el= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 17 ++---------------
= =C2=A0testing/lisp/test-org.el | 19 +++++++++++++++++++
=C2=A02 files ch= anged, 21 insertions(+), 15 deletions(-)

diff --git a/lisp/org.el b/= lisp/org.el
index ec59ddf44..ee8ca1f03 100644
--- a/lisp/org.el
++= + b/lisp/org.el
@@ -19624,8 +19624,7 @@ assumed to be significant there.= "
=C2=A0
=C2=A0;; `org-auto-fill-function' takes care of aut= o-filling.=C2=A0 It calls
=C2=A0;; `do-auto-fill' only on valid area= s with `fill-prefix' shadowed with
-;; `org-adaptive-fill-function&#= 39; value.=C2=A0 Internally,
-;; `org-comment-line-break-function' b= reaks the line.
+;; `org-adaptive-fill-function' value. =C2=A0
= =C2=A0
=C2=A0;; `org-setup-filling' installs filling and auto-fillin= g related
=C2=A0;; variables during `org-mode' initialization.
@@= -19647,8 +19646,7 @@ assumed to be significant there."
=C2=A0 =C2= =A0(setq-local fill-paragraph-function 'org-fill-paragraph)
=C2=A0 = =C2=A0(setq-local auto-fill-inhibit-regexp nil)
=C2=A0 =C2=A0(setq-local= adaptive-fill-function 'org-adaptive-fill-function)
- =C2=A0(setq-l= ocal normal-auto-fill-function 'org-auto-fill-function)
- =C2=A0(set= q-local comment-line-break-function 'org-comment-line-break-function))<= br>+ =C2=A0(setq-local normal-auto-fill-function 'org-auto-fill-functio= n))
=C2=A0
=C2=A0(defun org-fill-line-break-nobreak-p ()
=C2=A0 = =C2=A0"Non-nil when a new line at point would create an Org line break= ."
@@ -19903,17 +19901,6 @@ filling the current element."
= =C2=A0 =C2=A0 =C2=A0 (adaptive-fill-mode (not (equal fill-prefix "&qu= ot;))))
=C2=A0 (when fill-prefix (do-auto-fill))))))
=C2=A0
-(defu= n org-comment-line-break-function (&optional soft)
- =C2=A0"Bre= ak line at point and indent, continuing comment if within one.
-The inse= rted newline is marked hard if variable
-`use-hard-newlines' is true= , unless optional argument SOFT is
-non-nil."
- =C2=A0(if soft (= insert-and-inherit ?\n) (newline 1))
- =C2=A0(save-excursion (forward-ch= ar -1) (delete-horizontal-space))
- =C2=A0(delete-horizontal-space)
-= =C2=A0(indent-to-left-margin)
- =C2=A0(insert-before-markers-and-inheri= t fill-prefix))
-
=C2=A0
=C2=A0;;; Fixed Width Areas
=C2=A0
= diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 0= 56ea7d87..de4ac7ea9 100644
--- a/testing/lisp/test-org.el
+++ b/testi= ng/lisp/test-org.el
@@ -1200,6 +1200,25 @@
=C2=A0 =C2=A0 =C2=A0(org-= indent-region (point-min) (point-max))
=C2=A0 =C2=A0 =C2=A0(buffer-stri= ng)))))
=C2=A0
+(ert-deftest test-org/default-indent-new-line ()
+= =C2=A0"Test behavior of default binding `M-j'."
+ =C2=A0;= ; Calling `M-j' when point is not in an Org comment:
+ =C2=A0(should=
+ =C2=A0 (equal "* Some heading\n"
+ =C2=A0(org-test-with= -temp-text "* Some heading<point>"
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= call-interactively #'default-indent-new-line)
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= buffer-string))))
+ =C2=A0;; Calling `M-j' when point is in an Org c= omment:
+ =C2=A0(should
+ =C2=A0 (equal "# Some Org comment\n# &= quot;
+ =C2=A0(org-test-with-temp-text "# Some Org comment<poin= t>"
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (call-interactively #'default-indent= -new-line)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buffer-string))))
+ =C2=A0(should+ =C2=A0 (equal "# Some Org\n# comment"
+ =C2=A0(org-test-wi= th-temp-text "# Some Org <point>comment"
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (call-interactively #'default-indent-new-line)
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (buffer-string)))))
=C2=A0
=C2=A0=0C
=C2=A0;;; Editing
-= -
2.34.0




<= div dir=3D"ltr">

--
Kaushal Modi
=


On Mon, Dec 6, 2021 at 8:17 AM Richard Lawrence <richard.lawrence@uni-tuebingen.de> wrote:
Ka= ushal Modi <= kaushal.modi@gmail.com> writes:

> On Sat, Dec 4, 2021, 5:25 PM Tim Cross <theophilusx@gmail.com> wrote:
>
>> Given that Nicholas cannot remember the reason for the original fu= nction
>> and suspects it was meant to be an internal only function, I think= this
>> patch is probably the best way forward and should be applied.
>
> Thanks. Nicolas asked me to add tests for this patch. But I need to lo= ok
> into how to add tests for behavior of bindings. Need to add tests for = M-j
> binding behavior when cursor is within a comment or outside.

FWIW I have been running the equivalent of Kaushal's patch (I just
removed the local binding of comment-line-break-function to
'org-comment-line-break-function without deleting the function) and hav= e
also set

(debug-on-entry 'org-comment-line-break-function)

I've been running this for at least a week with no issues, and have
never been dropped into the debugger. So at least the testing through my normal work indicates there are no problems with the patch.

--
Best,
Richard
--00000000000035a68e05d27a8fe9--