From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6FtVID+0pmHIwgAAgWs5BA (envelope-from ) for ; Wed, 01 Dec 2021 00:31:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id eMLbGz+0pmEaLAAAbx9fmQ (envelope-from ) for ; Tue, 30 Nov 2021 23:31: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 C529E2EDA0 for ; Wed, 1 Dec 2021 00:31:10 +0100 (CET) Received: from localhost ([::1]:60232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msCab-0001JQ-VL for larch@yhetil.org; Tue, 30 Nov 2021 18:31:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msCZK-0000tD-JA for emacs-orgmode@gnu.org; Tue, 30 Nov 2021 18:29:50 -0500 Received: from [2607:f8b0:4864:20::1031] (port=34488 helo=mail-pj1-x1031.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1msCZI-0003u8-Vj for emacs-orgmode@gnu.org; Tue, 30 Nov 2021 18:29:50 -0500 Received: by mail-pj1-x1031.google.com with SMTP id j5-20020a17090a318500b001a6c749e697so14755307pjb.1 for ; Tue, 30 Nov 2021 15:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=Wcy1wi3ew2v2AIE6qTch52lsDTBt8+egpTyzKXu8Wt8=; b=VveSsCfyRBZh2LzivM3WA84kv/1YDqppb+B/0KyQm9f3i6t7H4yTbjksPP0+ztRoKi w3uVyAlEu8GfYKLDIjjp5It06Lc1OANhZMV8fbUze9CVV8ADRd7EX8JhaY7Z1Q0gzqPe Vzb8/t5t4H5fVVckeO0YZmaehaMzpMVKOxLP+7SM0ppRIPVDl8NWUzwIpj+p5DfVjmQg f29nioQebBC2hftRqxgqbBajPs9B9JPQOG4UADjRLufELFDe8eDwkYXkGGjR9Y9cBDrb RiFvXeo9Uu5hD5511wVXMlyydFA/grqhnI1tzU4yCGucVYwbGZYBgHNwgNAH5tQUHn+e 84AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version:content-transfer-encoding; bh=Wcy1wi3ew2v2AIE6qTch52lsDTBt8+egpTyzKXu8Wt8=; b=WtwHi6uzO3UhezaPu47WKcdoii1t8HC7KIV1VUcb4gSYviN5uYgzoFtCKggvQI0OmV iAY0QiwF4YNrXYpL4MZLCiZvoEfTLpaxCGcGXI6QTDBOai1yT6DVIS07wlaEadAP0x27 05wZ5ZJ7Ig7gzAzt7OKLiXlDyr2OuRiuTsI28YTf2yyOR7y1o/ncNNNJ4daLp4RyNVil vBTh28ZrvXq16In29FNVzBLXF49tnoMrIVL59D2v6mwuCalZRH2rO1FbfGn7Cca7h96G 1k1WGXwyqkOTec3ItVBu5myoFIrerHEORDqM6UByVl3SpugffKofaAF/RiJVWE09eRhq gDgw== X-Gm-Message-State: AOAM533NrsOLDxFziwrXo5ughi6SxNwK2PXfmmi8o0msgQwo7QsGdart 1BtDrCNynBDDi5mBIW8/U3jKu27iKCw= X-Google-Smtp-Source: ABdhPJytdkb318atLaXmcA7lb84PC5oesNPrZbx0GCzW6SF5QEhaklFbR1QLNtO2IJIY79zMYncLPQ== X-Received: by 2002:a17:903:2348:b0:141:d60b:ee90 with SMTP id c8-20020a170903234800b00141d60bee90mr2906672plh.15.1638314987293; Tue, 30 Nov 2021 15:29:47 -0800 (PST) Received: from dingbat (2001-44b8-31f2-bb00-e8ca-8918-9bbb-dabb.static.ipv6.internode.on.net. [2001:44b8:31f2:bb00:e8ca:8918:9bbb:dabb]) by smtp.gmail.com with ESMTPSA id p20sm22268569pfw.96.2021.11.30.15.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 15:29:47 -0800 (PST) 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> User-agent: mu4e 1.7.5; emacs 28.0.60 From: Tim Cross To: Kaushal Modi Subject: Re: [PATCH] Fix org-comment-line-break-function Date: Wed, 01 Dec 2021 10:15:07 +1100 In-reply-to: Message-ID: <87zgpli5nc.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1031 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=theophilusx@gmail.com; helo=mail-pj1-x1031.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, 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=1638315070; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Wcy1wi3ew2v2AIE6qTch52lsDTBt8+egpTyzKXu8Wt8=; b=XF3Ci/Iz6w37OTnSF1efngfITmKil1dNf+nVxoEmm4eu7vzeq44esSrMVle6ZJUCvaYCUY Td9Rs5odYFoU5dxrA8J4XAgK5aYJ30KowuCh74snqCeJR33/fZ5rXoCMTVjwtfSr/vVspY 1oqTiTqmqaE8uYli/Cws96qxPkCD2F76GUbJtKVo6W3XhrEuj003VfrJWEQzzVu12052qE j2qIiiBfUtgLhtfx2lDE7jMcBI3h+kt1yfZG67RUPBCpdiHrnaOVt9HRke5Tdyi6eH1vJk QD3UpONAdrvf8di/NHCXps8DAzqqDGa7AJGuXWVkiziCgcFtldF6OzVAJG3iMA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638315070; a=rsa-sha256; cv=none; b=bQ/VV9khNKtgHfTEgd2WR6iTNGkcsBBlYGMuhm+YVXl6Eg9W6n3kFqZ4XGC0d/psP/LAtJ hNM0VWrL0EcuR49u0TD+oOBbIeQWIB9nAGWrp6XrMfQ94X1Doi6qeGS+ApS3+fN27bFlpQ oDJqCsDDqt8xqj5aVzyDvXKqbSGjgDyLb/RHGOIrvy1VB0NGJHhEE80dTnXzqroUne5L9T 013pDtJegQT+E5z+AG3D8kR7miNEy1NUmA0L1idmhQwqnGLkWNxItz+zt8mtSHVyzwXIXe AonKSeKjsh+4dvLdPrv9WJQoowuqK9epDnyvTwQlEs8HWp1BEZU5XU9+Re5EwQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=VveSsCfy; 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.31 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=VveSsCfy; 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: C529E2EDA0 X-Spam-Score: -0.31 X-Migadu-Scanner: scn0.migadu.com X-TUID: FJ8+oNQQUKRy Kaushal Modi writes: > On Tue, Nov 30, 2021 at 3:20 PM Marco Wahl wrot= e: > > diff --git a/lisp/org.el b/lisp/org.el > index 1a1375461..fdeec0d67 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -19695,7 +19695,8 @@ non-nil." > (save-excursion (forward-char -1) (delete-horizontal-space)) > (delete-horizontal-space) > (indent-to-left-margin) > - (insert-before-markers-and-inherit fill-prefix)) > + (when fill-prefix > + (insert-before-markers-and-inherit fill-prefix))) > > I don't have anything better. I think this is a good patch. It makes > M-j work again. > > Possible refinements and improvements can follow. > > +1 for applying of your patch. > > I am able to reproduce that M-j issue (using Emacs version: GNU Emacs 28.= 0.60 (build 9, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, > cairo version 1.15.12) > of 2021-11-29, built using commit c4daff9cf844ec85930bdcd2064787c92c2608= 61, and Org mode version 9.5 > (release_9.5-292-g5e35de)). > > And this patch fixes that for me as well. > > +1 for applying this patch. > > =3D=3D=3D=3D=3D > > Before this patch, M-j gave this backtrace with debug enabled: > > Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil) > insert-before-markers-and-inherit(nil) > org-comment-line-break-function(nil) > default-indent-new-line(nil t) > funcall-interactively(default-indent-new-line nil t) > call-interactively(default-indent-new-line nil nil) > command-execute(default-indent-new-line) > > Output of C-h k M-j: > > M-j runs the command default-indent-new-line (found in global-map), > which is an interactive compiled Lisp function in =E2=80=98simple.el=E2= =80=99. > > It is bound to C-M-j, M-j. > > (default-indent-new-line &optional SOFT FORCE) > > Break line at point and indent. > If a comment syntax is defined, call =E2=80=98comment-line-break-function= =E2=80=99. > > The inserted newline is marked hard if variable =E2=80=98use-hard-newline= s=E2=80=99 is true, > unless optional argument SOFT is non-nil. I'm not sure this is the right patch to apply. While it does fix the immediate error, it really does so by just avoiding the call to insert-before-markers-and-inherit when fill-prefix is nil. It does not address the question of what that function is supposed to do or whether the correct fix is either to call the function without the fill-prefix argument (which also works in that it avoids the error) or if instead, the patch should be (if fill-prefix (insert-before-markers-and-inherit fill-prefix) (insert-before-markers-and-inherit)) I note also that with or without the patch, the function does not appear to work correctly anyway. If you hit M-j while in a comment, the new line should be indented appropriately and have the comment character prefix i.e. start a new comment line. It does not do that. This is supposed to be the key difference between C-j and M-j. Regardless, I think that unless we understand the purpose of insert-before-markers-and-inherit, we should make the patch such that it still calls that function. Even if fill-prefix is nil there is probably a good reason why the markers and properties need to be modified for some situations.=20 It would be good to get Nicholas' input here as I think he wrote the original function back in 2012.=20