From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id APcaG60kGWWChAEAG6o9tA:P1 (envelope-from ) for ; Sun, 01 Oct 2023 09:50:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id APcaG60kGWWChAEAG6o9tA (envelope-from ) for ; Sun, 01 Oct 2023 09:50:05 +0200 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 2BB33496FC for ; Sun, 1 Oct 2023 09:50:04 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=gU4lISrw; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696146605; 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=Q2LMggi0G/tUg4jIx72dUw+8PveUFRB7sfbegoNdHNU=; b=i59i/9zBodYARfeTCwee+EEMeaQm1mgHOsT7KCiTyWAMXO5onhsf72S9WXq6/PKeH4Y+x2 sxm+UEsbRLPPyI37HSP7p6LgVI+3jI4tUoothQU5CHVBxFgGq7YcjlC62jQvrqbzhcv3/X oG16PAsDeNA2TfnczYIVjNFm4SN1QuLqMo3KBmSFTTCmBHOgc5KVOenPIzWDhVmxLq2Lip Ha5QL5lTjNrW8i5ySXCwjw4ZyJDEwMrdL0wvyTpVfcn7R/hEkIKsVFhcPPXHzK/UnJAxg5 mN360/d7GVYBzkSdDe9WiIKOzQbbdznSjLjTyznT9GHltMnUP1nai8lVJSNypw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696146605; a=rsa-sha256; cv=none; b=aSyCCFA0/2LhK5+MKSryGi+7r8vopBvvdeUQuOaRc6DLNrl9vadEfEr8+5DEG3QiAml43n 14vOAOJnKEeMhqbQZyRN7/0sNfLMT6rxBO7bqOfEZLtsLlB+PeIFqd/XLeRNstmHolhtyN oBCTznfmDh+FOMrC4MMZYuEWtlsSy9o7ZmfvBSpd/GFwWwWSHVxx8wqA2wP60R8CarJIlP 0E33x9gDS7Y/hwTVYeh+98gtxheSQ3OOFQTLXLpU1c7JIo/HoU9hNZ7A8LwFs0xdd8peab 4c8gagdRghQtf3Z2F/bewqTaqGkjeXzf3I/Z1PNkIYqOBEA0UpOs4po6LHKcLw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=gU4lISrw; 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"; dmarc=pass (policy=none) header.from=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qmrCO-00048m-B1; Sun, 01 Oct 2023 03:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qmrCM-000487-CL for emacs-orgmode@gnu.org; Sun, 01 Oct 2023 03:49:06 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qmrCJ-0002is-8c for emacs-orgmode@gnu.org; Sun, 01 Oct 2023 03:49:06 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id AF078240028 for ; Sun, 1 Oct 2023 09:48:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1696146537; bh=ruxzWCtLoGpZHM+miCMJ0t/SvHglu5PnRsPty2czgaA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=gU4lISrw1Aql7Gl7p0tA3WHbrCfvqr7wKRODo/jxqKdO6cqVq8EFyjZMyo1RSY+Nx iKjcDsKL4gKHupBTp41wY6kR6bc4/vDSAed2ddADIeYzjt9PwHmKBj5wy2NuI7ii8x Xq+O2uCrwePB5KZ8Szxqwe9WHYN7pLDD00k3zW5HgVPlS80g8GjbTevr8UMsAo95Z1 Iy+yDmGJauYIBaV60q5dCORJu3Ib9PP1osX6geWwFb8MpeGzCYTC5lypkunn2JmdXs 8tKv45IagWoPyNr1zqAYJ2qIod0+CzY64iO0sVdOiwC8+iPnSvc09Tmy6c2R2BDSPM 4mLVXK9KqHPtA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Ryx6c3J1pz9rxD; Sun, 1 Oct 2023 09:48:56 +0200 (CEST) From: Ihor Radchenko To: Tom Alexander Cc: emacs-orgmode@gnu.org Subject: Re: Extra paragraphs incorrectly spawning when ":end:" appears. In-Reply-To: References: Date: Sun, 01 Oct 2023 07:50:05 +0000 Message-ID: <87o7hiwzma.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -6.62 X-Migadu-Spam-Score: -6.62 X-Migadu-Scanner: mx1.migadu.com X-Migadu-Queue-Id: 2BB33496FC X-TUID: VIAgHIaN+fkZ "Tom Alexander" writes: > This test document should have 1 paragraph but org-mode is parsing it as 2: > ``` > foo > :end: > baz > ``` > > which parses as: > ``` > (section > (paragraph "foo\n") > (paragraph ":end:\nbaz\n") > ) > ``` > > The paragraph documentation[1] states that: >> Empty lines and other elements end paragraphs. > > But the document contains no empty lines and we can see in the output that it only contains paragraphs. The documentation is not accurate here. The parser uses anything that _potentially_ looks like the beginning of another element to calculate paragraph boundaries (`org-element-paragraph-separate'). ":end:" is potentially a drawer and thus ends the preceding paragraph. Later, ":end:" line is parsed as a new structural element using `org-element-drawer-parser'. The drawer parser detects that there is no closing :end: line and thus falls back to paragraph parsing: (defun org-element-drawer-parser (limit affiliated) ... ;; Incomplete drawer: parse it as a paragraph. (org-element-paragraph-parser limit affiliated) The same logic applies to a number of other incomplete elements. The reason behind the current logic and not re-parsing the preceding paragraph when we encounter incomplete drawer/block/etc is that Org parser is written to do a single pass - we never re-parse already parsed parts. Doing things otherwise, while could solve certain non-intuitive behaviors, would be problematic performance-wise. So, the actual paragraph separator that should be used is `org-element-paragraph-separate' regexp. We need to fix the WORG syntax description accordingly. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at