From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GAlOBP/5EWP2WAAAbAwnHQ (envelope-from ) for ; Fri, 02 Sep 2022 14:41:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 6KcgBP/5EWMttgAAauVa8A (envelope-from ) for ; Fri, 02 Sep 2022 14:41:35 +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 8D88215BB6 for ; Fri, 2 Sep 2022 14:41:34 +0200 (CEST) Received: from localhost ([::1]:59034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oU5zJ-0003KE-NK for larch@yhetil.org; Fri, 02 Sep 2022 08:41:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU5yo-0003Gd-Bl for emacs-orgmode@gnu.org; Fri, 02 Sep 2022 08:41:02 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:33470) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oU5ym-0007A6-E8 for emacs-orgmode@gnu.org; Fri, 02 Sep 2022 08:41:02 -0400 Received: by mail-pj1-x102e.google.com with SMTP id i7-20020a17090adc0700b001fd7ccbec3cso7815664pjv.0 for ; Fri, 02 Sep 2022 05:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date; bh=Xm1qaCwvlwHHqJE+YazPrclY2G/ZRY6zn+TvgFpE+uE=; b=Zrm35eZOgGg1zCNTDGKR33YHkp0ogfrzrCdSAIw+K4J/+KowxA3jcBfzMqVqtfxbDw Bxr2d8saIV2fLmQy0Bs/EOuw2O9zpaJFh6JmwTsHw617oDo2ixSeJpd5Z14OyT47B/yZ yQPItCRGAdn7wPN98oYZ+fmQ90rNHkw/QisJ8RIpjNx0KstufNX5c7jJFsWa9+1bz8Zy qyF0ekeO57nKeWkIv3pg1ExIpchHRDl5zN9RHdT9kBlSnUFty+/9b7k8kRIhR7pfVjFd k9/ZlZlsbnh2tlS9F5FZSFUZTT7aHDKiySyi/9zc7W+b2QNfqI7M98U1Rk4jeHHwpQxr CsAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=Xm1qaCwvlwHHqJE+YazPrclY2G/ZRY6zn+TvgFpE+uE=; b=PlFe4ljSN3zRKd6D9Gd/i//5OTOjpPWpTngBYFa38ZKGmz1SZGPaJpjES+biQdDYZC FXe+U95ywN89vvfthcg/J9LlKDr7NJ6Ul3nAC1Tg7paY5WzKo7fNbmVmtd2hnl2HTkGW VXkBOs9nxUnj4174ALReLwtiwDIBClNK058ocexUAteMY5MLD8vo/kE7nR95gAEW9E3c fH6DDMzPkWC4RqHcbK9FkWm9HSRE8+P7eH4U2tbtzJLZDv6oXYlsJd0z6g9y3PfILKvJ +Klkj/drbG2vhfmDruCjHp6VIj0y6TchKCLM4Y7DB2rF+Yo/FVxNNbz7mViDEWC2eo03 S/zg== X-Gm-Message-State: ACgBeo32RIPJmcVFNiUFOiG/jsMupI0gF9WtEOrow06VyFxe1GYpvR1C ochLc9CdZB9uBThlUVmFTLc= X-Google-Smtp-Source: AA6agR5mMKq6iBNZONqplntEkcHUYpYhDOZunjjqxhPUH7jo5aYt4uS0MpRyRDOzmjRtDLeFFWW9WQ== X-Received: by 2002:a17:903:2601:b0:174:3e42:6bb1 with SMTP id jd1-20020a170903260100b001743e426bb1mr34242153plb.90.1662122458828; Fri, 02 Sep 2022 05:40:58 -0700 (PDT) Received: from localhost ([2409:8a70:2b2:5800:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id e1-20020a17090ac20100b001fb371c01bfsm1375956pjt.37.2022.09.02.05.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 05:40:58 -0700 (PDT) From: Ihor Radchenko To: Alain.Cochard@unistra.fr Cc: Org Mode List Subject: Syntax of footnote-definition: can we allow double empty lines inside? (was: Suspected bug: example block in a footnote doesn't fold if starts with 2 blank lines) In-Reply-To: <25359.21186.842934.778547@gargle.gargle.HOWL> References: <25357.49721.706791.137935@gargle.gargle.HOWL> <87zgflp443.fsf@localhost> <25359.21186.842934.778547@gargle.gargle.HOWL> Date: Fri, 02 Sep 2022 20:41:57 +0800 Message-ID: <87mtbilzhm.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1662122494; 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=Xm1qaCwvlwHHqJE+YazPrclY2G/ZRY6zn+TvgFpE+uE=; b=TdV++km8Nz5+C+TrmMIPfNwxvKh/3QE5tndrGgoW6n2wIaWJj02p9b0TNZTjy9F8iQtPCN b8Tc97y7obYBdnBizTOGaqTwyMGr0Ik2ZaftD1zYuHKv7xBkqp/xW9B69Sv1ZPEcjM+gHz Ncf6LVw6ITMObjRNHF59uUCR7m356d9l3765hHFWn7h+OQRGM9eULcFMgo8rhOk4OdRJ+Q IMC2Ez7zU4pTVEPstin9I3+o57rRnrumsjuH3B795GhqQu3LD3rwisZhAwt5ZST9xZ1fof NSfnCjurZMauksmwkUSuPoBMOvRnOP9F0thKqIaIwqrtzoPUhyIvE+7bzisrVg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662122494; a=rsa-sha256; cv=none; b=XpjtSuDVzBCKmr+gEble7fy/eXoNiqroQ8iV/g6b5Wpo0spdV02JKMqQRT0WCGiN1VgQBD xEGkoFAq+Vl5UkYo2Yxcg5TvdX1i6acC+O1jg4IebNo+77adMsBjU0SbAXKLOkj0B1zGFe FcOWbUCFbngRMAcK3CVg2/YI3km1TclH70UZLdFOxPtHiIZmWBplQGH6MqHHmH06kKfXCK jydWUTlOk9VHPum5owY7OIBNqR3tyWyg1pghtp/D2cPKjU8CZ60A+kamCXaiNdsOdBFAQY HYMHdNuqXQxIM+x6x76V6Ix21dwz+q6uncqNOPtvXJRhcLdRnrnj53YPJf4UFw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Zrm35eZO; dmarc=pass (policy=none) header.from=gmail.com; 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.77 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Zrm35eZO; dmarc=pass (policy=none) header.from=gmail.com; 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: 8D88215BB6 X-Spam-Score: -1.77 X-Migadu-Scanner: scn1.migadu.com X-TUID: Cpxk2YNJcir3 Alain.Cochard@unistra.fr writes: > Ihor Radchenko writes on Wed 31 Aug 2022 09:57: > > > This is not a bug. Just unintuitive syntax: > > [...] > > The important part is: It ends at the next footnote definition, > > headline, or after two consecutive empty lines. > > > > So, your example is > > > > foo[fn:1] > > > > [fn:1] bar > > #+begin_example ;; <- this is not considered an example block because no > > major org elements can be inside a footnote definition. > > > > > > > > x > > #+end_example > > > > Thanks a lot for answering. > > Is there an official definition for "major org element" ? (I could not > find anything relevant in the manual.) Sorry, I actually confused things in attempt to make things more clear. The official Org syntax defines 2 types of syntax structures: elements and objects. Elements can be: (1) headings, (2) sections, (3) greater elements, (4) lesser elements. Each Org document is a sequence of elements with no gaps in-between. Objects (e.g. markup) may be separated by plain text and must always be inside an existing element. Headings, sections, and greater elements can contain other elements inside, while lesser elements cannot. By "major element" I was actually referring to lesser element (non-object). Not only I was wrong (footnote-definition is a greater element), but also used a confusing terminology. You can refer to https://orgmode.org/worg/dev/org-syntax.html for more detailed info. > I guess a headline would qualify (and it would not have occurred to me > to use a headline within a footnote; the manual is clear in that > respect anyway). > > But then a list item would probably qualify as well? But, as far as I > can see, lists and footnotes work perfectly well together... (because > 2 consecutive empty lines also mark the end of a list item?) > > Furthermore, as long as there is not more than one empty line in a > row, blocks also appear to me to work just fine within footnotes, > including upon latex export, and I use things like the following all > the time: > > #+LATEX_HEADER: \usepackage{fancyvrb} > #+LATEX_HEADER: \VerbatimFootnotes > foot[fn:1] > > [fn:1] note > #+begin_src fortran > print*,"foo" > #+end_src > > I simply never had to use 2 consecutive empty lines in blocks up to > now... > > So I guess I'll turn my "suspected bug" into a feature request: that > #+BEGIN ... #+END blocks behave the same way whether they are within a > footnote or not. You are right, there is currently no way to have double blank lines _inside_ footnote definition. This is because Org syntax prohibits elements inside a greater element to influence the parent boundaries. Once Org parser encounters ^[fn:...] right after previously parsed element, it immediately looks forward for (1) next footnote definition ^[fn:...]; (2) headline ^\*+ ; (3) double blank lines; and sets the footnote definition boundaries accordingly. Unconditionally. No backtracking is allowed for the performance reasons. The consequence is inability to have source blocks containing double blank lines inside a footnote definition. This is not an easy problem because we need to ensure backwards compatibility and avoid doing major changes to Org syntax. The best I can think of is allowing to escape blank lines like #+ and * lines inside the code blocks with ",". See 12.6 Literal Examples section of the manual, for example: #+BEGIN_EXAMPLE ,* I am no real headline #+END_EXAMPLE We may add the same for double blank lines #+BEGIN_EXAMPLE ,* I am no real headline , #+END_EXAMPLE The downside is overly verbose ordinary code blocks. Double blank lines may not be uncommon in the wild; sprinkling commas around many source blocks will be ugly. Alternative ideas are welcome. -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92