From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id wFHcL1OKoGRRtwAASxT56A (envelope-from ) for ; Sat, 01 Jul 2023 22:19:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id sDQKL1OKoGR5qwAAG6o9tA (envelope-from ) for ; Sat, 01 Jul 2023 22:19:31 +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 590822A81C for ; Sat, 1 Jul 2023 22:19:31 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=P4EURScA; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688242771; 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=jfe2gljbuN/3N8duHavvZcSnEv5C/iyukKaiWOaeShA=; b=i2c59A22E8tYO2BA6kZBj4of1K42lgCm9KOg8EcQsc0V3b0QaThF2pQp3yUo9h6jUgcWBc FSgSXNxbmo3mn6qU9Y1FKbkyXmOY7aosUqoUMRrsZsS61r2vONv7xmrSJX7XEXAa/aAoai F3aucXm6CWtxxvlcjZ+My82Z8X9eqb1AaSLAi3Gl2g+DupUAHUXeDw6ajOspDTh8ExuONJ NBkrWpnh8GHfsbTfwKeWdhlkgvScIW8d1+tj4n2XBa2wPSBvst7Sr8Xy6wNwQVdZB+kRmx MQcakyNaPAJsrJQ6RzQwHdBKnox8aBKisjHdBY1GUGcs2krlcaJFlEvdjneiqQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=P4EURScA; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688242771; a=rsa-sha256; cv=none; b=eXyClwDpobDOJLVSfn462toEJDGmYVqyHtD6Ff3v8qtBPol9fuTlfN8ttHBcAbs5kHaLC5 /PXwK7YAGjBZfTakC2sygaqAciAxnburhf35wfHDQyPpAtMzIQKt/yuufmS8QQCkowpqyv vQMNMosSdMhR/UiyqOW8hASZglBIZze//7Ue1F6J/5UyMCtqdL2JkYV5SaQXh3HQd+zReh Yipo5Yfd4fGpAYj4JQr8gahmBTUPFGz1wOlxXd9+yR+SFdVqAKLkz9FH3KFmaYpapcZ76E Ds7AvpMqacnYCZZfg1qh7gqCnNJmciPVvWoRChcdew85efch5uI6yn6VlkOiSg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFh38-0003rp-7X; Sat, 01 Jul 2023 16:18:30 -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 1qFh35-0003rM-SG for emacs-orgmode@gnu.org; Sat, 01 Jul 2023 16:18:27 -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 1qFh33-0003tm-Et for emacs-orgmode@gnu.org; Sat, 01 Jul 2023 16:18:27 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 81533240029 for ; Sat, 1 Jul 2023 22:18:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1688242701; bh=BaWNBIW/NkUbA67Tg7l1d6fDrrM+SYn1weKPs8ERkpc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=P4EURScAq1SQk541IV7C2wcgNZEOjHMgOkOlZOY5QI/NehBTapIWDmnJIlLZSRSdx loYK6gQTyx0tyt+UgEcL6fojXiece4gA8bZxytpYkVbAIj600hcujPTgitphcV4bJh ClWYCycVfLfsd43n3ri5CkNtL9XPvuhqyH8tqAYDxmQWLoI4+shsA9n3/Cf1fcHoMn QObFk731+6KOmVBo9HcaKbp952cT/xTZqohWdYzRJY7oBrNkVU0KFtI9BAjeGyH5ma oeTnJ/NQe+pTPUB6gdlETB3Br0DW9Gm2+/ly3q/RxaTU0Ra1zi/iLUsq1eIwkJV8hh cKJ6rOjxmm0KQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Qtk5m2F47z6twj; Sat, 1 Jul 2023 22:18:20 +0200 (CEST) From: Ihor Radchenko To: pva-outdoor@yandex.ru Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] incorrect org-mode dynamic blocks docs [9.5.4 (release_9.5.4-3-g6dc785 @ /usr/local/share/emacs/29.0.50/lisp/org/)] In-Reply-To: <87wmzjxvoi.fsf@yandex.ru> References: <87a5wij05o.fsf@yandex.ru> <87cz1corps.fsf@localhost> <87wmzjxvoi.fsf@yandex.ru> Date: Sat, 01 Jul 2023 20:18:16 +0000 Message-ID: <874jmn5qt3.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, T_SCC_BODY_TEXT_LINE=-0.01 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-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -6.82 X-Spam-Score: -6.82 X-Migadu-Queue-Id: 590822A81C X-TUID: isqhvbE6xkzf [ Adding Org ML back to CC; Please use Reply-All or wide reply to include the mailing list in the discussion ] pva-outdoor@yandex.ru writes: > Try the following: > > 1. Create "1.org" buffer (C-x b 1.org [RET]) and make it org-mode (M-x > org-mode [RET]). > ... > I believe it is the same as if you create a function: > > ----------EXAMPLE-HERE---------- > (defun org-dblock-write:expands-some (params-map) > (insert " > ** Section 2 > > With some text > ")) > ----------END-OF-EXAMPLE---------- > > And a org-mode buffer with the content: > ... > The "#+BEGIN: expands-some" will not appear if > `org-dblock-write:expands-some` is not generating headings (i.e. lines > maching regex "^[*]+ "). > > So I think either there is a bug in dynamic blocks expansion or it's > documentation should have notice on including headings inside dynamic > blocks. It looks like you misunderstand Org syntax. Headings in Org files are context-free. It means that any appearance of a *** always starts a new heading, breaking any other syntax element. You may refer to https://orgmode.org/worg/org-syntax.html You can similarly break Org syntax structure in many other ways. For example, by putting #+END: in the block expansion. All these are side effects of plain text nature of Org. We could shield the dynamic block output from edge cases like what you observe or like I provided in my example with #+END:, but we see this behaviour as a feature. If necessary, you can wrap your dynamic block output into `org-escape-code-in-string' to ensure that surrounding Org markup is not affected. > I found this behavior while implementing a template document which fills > some sections depending on conditions (automatic documentation from > OpenAPI). Thus ability to generate subheadings with dynamic blocks > became a key feature here. That is why I recommend describing this > restriction in documentation (probably "A.6 Dynamic Blocks" section) if > this behavior is desired. This restriction is not limited to dynamic blocks. Similar restriction applies to example blocks, other blocks, drawers, etc. I guess we can add documentation describing these gotchas about Org syntax, though I am not sure if A.6 is the most suitable section. Probably, we can add a dedicated Appending and then refer to it from other places. Patches welcome! -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at