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 uOnZKfjTpmG3DgEAgWs5BA (envelope-from ) for ; Wed, 01 Dec 2021 02:46:32 +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 sPSjJfjTpmGOYQAA1q6Kng (envelope-from ) for ; Wed, 01 Dec 2021 01:46:32 +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 C3CEF176A0 for ; Wed, 1 Dec 2021 02:46:31 +0100 (CET) Received: from localhost ([::1]:50072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msEhZ-0004EL-5h for larch@yhetil.org; Tue, 30 Nov 2021 20:46:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msEgO-0004Dj-Kc for emacs-orgmode@gnu.org; Tue, 30 Nov 2021 20:45:16 -0500 Received: from [2a00:1450:4864:20::42c] (port=35541 helo=mail-wr1-x42c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1msEgM-0002ze-5X for emacs-orgmode@gnu.org; Tue, 30 Nov 2021 20:45:16 -0500 Received: by mail-wr1-x42c.google.com with SMTP id i5so48508764wrb.2 for ; Tue, 30 Nov 2021 17:45:13 -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=eHGVh347jwOETvpER6iUdcyKxMXEoEQ++TUCGC9ISNg=; b=CerKYSqWY1t1eoyc1tSM+nWo8MGEGFiShy0pA/VzjErGUm3NF4gqOdF1TEAdYKkOU8 /h5kYly0FGynf7wgEm0Xc0P9M/9vhzPulm9XICwawYoX3U5lmP3u0+R0cPf54QKo2dy1 +bu/HAIt32LR1OLHzZKJRaJfXWFzYGhzeJHbABDY3IHVhl6ct3G/NdJm3N01uAU33pJ9 rowAH/X9eZKwjOtJRgHJEbnE4iHzKRQ35K4N+8jGu2OywIkMJMfsFgb2f3l0KXk7Dhzs q5nfQDCMt/JkMOeVe9O1JRZdpAwQwKc2G+gLuVd91xEk909/ZqnWGxZajZ5g7Aq4gjGb DH3A== 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=eHGVh347jwOETvpER6iUdcyKxMXEoEQ++TUCGC9ISNg=; b=2eFMnC3UFQdraa6sJy+HAGDfkmZ7+LbS7IEB1eQXQ51AtePrlPoLWE4L2lRmKk5/3G GxWlRbIn+yzL0DyLnbFBgu+Qynz7b6VJIp8EKWhIZJarH8Ww/ibNd1xYwmRJ/Ck8NYDg KMRhPcx4njXmZ6ewnNk9lrgPG6X5kQUhUHIKdcl87hfXfVruDQfFurFhiLWzpNDH8s+B GhCCaXKbkqtclORQGFO/vA1aVScmHGAYKHNCgLun8pKEnKRJUbS+O9SBn7YXEsYlwrPl /i+Ujoyn29Zq8jb1IzH78NA7pkuDrD0DtZAsosRSN/L+q0033BXLwD1ZUsCOlhRJHywl 8dMQ== X-Gm-Message-State: AOAM533eCFK/c2HNzNwgJdRhP+J4H5+FyaeEceHjm09WO+Rl0Z7EwIsX znCx5JIE1cNOjjsml5GWBdJLj82gvOfBEiV0CLs= X-Google-Smtp-Source: ABdhPJzcDc/3f3C2Hsm2HZPsTGXS/mgpEvquXq8v983qIcEREuXKN1aKxxnUXMXGBAyMZCfE1c1J+INulFararUigrI= X-Received: by 2002:adf:cd89:: with SMTP id q9mr3013013wrj.205.1638323112532; Tue, 30 Nov 2021 17:45:12 -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> In-Reply-To: <87zgpli5nc.fsf@gmail.com> From: Kaushal Modi Date: Tue, 30 Nov 2021 20:44:36 -0500 Message-ID: Subject: Re: [PATCH] Fix org-comment-line-break-function To: Tim Cross , Nicolas Goaziou Content-Type: multipart/alternative; boundary="000000000000265f6f05d20bd3ba" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42c (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=kaushal.modi@gmail.com; helo=mail-wr1-x42c.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: Richard Lawrence , Marco Wahl , emacs-org list 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=1638323191; 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=eHGVh347jwOETvpER6iUdcyKxMXEoEQ++TUCGC9ISNg=; b=jJULnWrEGqBL2+LExC7u0VGQ3qFW/Wv3gV12uWJN//DTvDIZoocet1OIKkXBOc/nSJJAZh iRSzKLqMfZ0YP/sZrjxhNo9tB3zsono7wJaQawPXKg4J6C24U/5tG2wwPc0DZ/ZDRvvv5d 3icdsCtDoGdts7raH9MQIf2qLgpFOWcB8YtJLjYigmzdD8l2S9Jq/hHKKvF4sMC0WE17Cu fDeDoiEfxQFDb22ruRmVgbbbXh7kDASufZu67dBQVohALq7apcToYNEZWi/ky70PDNHhsV NRrs5FQVCYbkntPPJ/RRthIFJzOIjdM5nHVbgRNA6XoafmoPefqlTw8X75nk9g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638323191; a=rsa-sha256; cv=none; b=IrBop5o+nmnB1lJo6ZOGK9R52hH/jVAB0YXaGuHWTIBGm8ySF1Yhop8H0TR6jasaLxYZZU cmCRn9fXlZjhxlX/4EqM1caz0jdI9egXcpzSt65mbz+rAEGKSv/Ri+u8deRYLitmVrMxT+ vTzVquXHrygSIX7JM0Yd3kIN9wKzHFK37ImoG+ioKjIRs3vrVgudVXIDRRVww2Q++5z8bj FFyx+yuyFGhcaUo/zMZs9KFWOp5cIJFuDCaqYdssYQu2GsRpVGRmH404XalfkZz6PTfwvG 9uVvgJUOburHPFsEB8JgoIP8qh5TJ5l4Fijq5Xe6QC1yoSsEhUwPd11fffUzyw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=CerKYSqW; 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: -1.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=CerKYSqW; 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: C3CEF176A0 X-Spam-Score: -1.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: ssx0iAmxnnmg --000000000000265f6f05d20bd3ba Content-Type: text/plain; charset="UTF-8" On Tue, Nov 30, 2021 at 6:29 PM Tim Cross wrote: > > It would be good to get Nicholas' input here as I think he wrote the > original function back in 2012. > Just to see what happens, I tried this: M-: (setq-local comment-line-break-function #'comment-indent-new-line) .. and then M-j started working perfectly! It worked fine both: in Org comment lines and out of comment lines. I see that comment-indent-new-line was added to emacs in newcomment.el back in 2000. So I don't know why org-comment-line-break-function was added. May be Nicolas can comment more on that. So would this patch work? ===== >From 1a9187b82ed8d4e8d54ddd369a44d34295281fc3 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. This fixes the `M-j' binding issue reported by Richard Lawrence in . --- lisp/org.el | 17 ++--------------- 1 file changed, 2 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 -- 2.34.0 ===== --000000000000265f6f05d20bd3ba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Tue, Nov 30, 2021 at 6:29 PM Tim Cross= <theophilusx= @gmail.com> wrote:

It would be good to get Nicholas' input here as I think he wrote the original function back in 2012.

Just t= o see what happens, I tried this:

M-: (setq-lo= cal comment-line-break-function #'comment-indent-new-line)
.. and then M-j started working perfectly! It worked fine both= : in Org comment lines and out of comment lines.

I see that comment-indent-new-line was added to emacs in newcomment.el b= ack in 2000. So I don't know why org-comment-line-break-function was ad= ded. May be Nicolas can comment more on that.

= So would this patch work?

=3D=3D=3D=3D=3D

From 1a9187b82ed8d4e8d54ddd369a44d34295281fc3 Mon Sep 17 0= 0:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Tue, 30 Nov 2021 20:37:10 -05= 00
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.

This fixes = the `M-j' binding issue reported by Richard Lawrence in
<https://li= sts.gnu.org/r/emacs-orgmode/2021-11/msg00639.html>.
---
=C2=A0= lisp/org.el | 17 ++---------------
=C2=A01 file changed, 2 insertions(+)= , 15 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ec= 59ddf44..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 auto-filling.=C2=A0 It cal= ls
=C2=A0;; `do-auto-fill' only on valid areas with `fill-prefix'= ; shadowed with
-;; `org-adaptive-fill-function' value.=C2=A0 Intern= ally,
-;; `org-comment-line-break-function' breaks the line.
+;; = `org-adaptive-fill-function' value. =C2=A0
=C2=A0
=C2=A0;; `org-s= etup-filling' installs filling and auto-filling related
=C2=A0;; var= iables during `org-mode' initialization.
@@ -19647,8 +19646,7 @@ ass= umed to be significant there."
=C2=A0 =C2=A0(setq-local fill-paragr= aph-function 'org-fill-paragraph)
=C2=A0 =C2=A0(setq-local auto-fill= -inhibit-regexp nil)
=C2=A0 =C2=A0(setq-local adaptive-fill-function = 9;org-adaptive-fill-function)
- =C2=A0(setq-local normal-auto-fill-funct= ion 'org-auto-fill-function)
- =C2=A0(setq-local comment-line-break-= function 'org-comment-line-break-function))
+ =C2=A0(setq-local norm= al-auto-fill-function 'org-auto-fill-function))
=C2=A0
=C2=A0(def= un org-fill-line-break-nobreak-p ()
=C2=A0 =C2=A0"Non-nil when a ne= w line at point would create an Org line break."
@@ -19903,17 +1990= 1,6 @@ filling the current element."
=C2=A0 =C2=A0 =C2=A0 (adaptiv= e-fill-mode (not (equal fill-prefix ""))))
=C2=A0 (when fill-p= refix (do-auto-fill))))))
=C2=A0
-(defun org-comment-line-break-funct= ion (&optional soft)
- =C2=A0"Break line at point and indent, c= ontinuing comment if within one.
-The inserted newline is marked hard if= variable
-`use-hard-newlines' is true, unless optional argument SOF= T is
-non-nil."
- =C2=A0(if soft (insert-and-inherit ?\n) (newli= ne 1))
- =C2=A0(save-excursion (forward-char -1) (delete-horizontal-spac= e))
- =C2=A0(delete-horizontal-space)
- =C2=A0(indent-to-left-margin)=
- =C2=A0(insert-before-markers-and-inherit fill-prefix))
-
=C2=A0=
=C2=A0;;; Fixed Width Areas
=C2=A0
--
2.34.0

=3D=3D=3D=3D=3D



<= /div> --000000000000265f6f05d20bd3ba--