From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8F7/M9zUrGBGkAAAgWs5BA (envelope-from ) for ; Tue, 25 May 2021 12:43:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id IPC/L9zUrGArCgAAB5/wlQ (envelope-from ) for ; Tue, 25 May 2021 10:43:40 +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 2E81D102C7 for ; Tue, 25 May 2021 12:43:40 +0200 (CEST) Received: from localhost ([::1]:59378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llUXD-0006jM-0W for larch@yhetil.org; Tue, 25 May 2021 06:43:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llUWq-0006iv-VQ for emacs-orgmode@gnu.org; Tue, 25 May 2021 06:43:16 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:40867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llUWp-0002hh-8t for emacs-orgmode@gnu.org; Tue, 25 May 2021 06:43:16 -0400 Received: by mail-ed1-x530.google.com with SMTP id t3so35564033edc.7 for ; Tue, 25 May 2021 03:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:reply-to:in-reply-to :message-id:date:mime-version; bh=20NJL564FBRwPsXhf537uzGhUnHj3XpFME8SNwmja4I=; b=R3EFjLIoBSAtYeTGoumyln7pt0ooT2vxiLbt+4i2+dfjuZR0m7+sn2F94ptIfsqyjV uuTnLhwQQd3BPYVKfOoxz4q9HV2+XklAasK0/+oKSRwjW0hZ9GKdxvTGAJDJ791tdQrP 6HEuj/jikC8lUY4lKEW2sLeKTOCdqh8F/5ZSROyCHvpg1btstDkFqjiLXyVhQOFbzIOH U94AfIz7DOjbVL89BfeQkye+Ep2cHmn4PqMc92mAoJtaHa1aEvuQlOilTYOm019oYphM FAnN1W7x2DYEIffTaMRwzlNP6nCUmZkFjVZv3kxwjZm5CIvXXpOyg3xepFbALzOFBtmn KabA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :reply-to:in-reply-to:message-id:date:mime-version; bh=20NJL564FBRwPsXhf537uzGhUnHj3XpFME8SNwmja4I=; b=chOCggOrB5VpJsf/gF63X3CID1NQ95a3UzPDEXX4KKl9euxtfeNFNJExNxPppEN3+8 BJ1fYTt5SuSr8TKP4Em0e74QYEpzfrR/n4a7Gx1BoBMA9joKboaqcVoVA+DHOmjLTmK1 JX1rRShKNp934qEbG6tP1ThsRoubIYiMTURvdoXTJigHfW0cOVZQvf5QqTF8wO1saNcR UOd9L9NcsPOoyDUpXp1Mvow2MhyPDl8kMjeMiiKSDUaolvC4/thywfwkGc/WEdbMGFqu jpKNvicbJvr4YOCrc1glQ24d6sR20jUeUkbwxRQQdvDbvDHScjrOCt8SSbayES9WVG5o jB4w== X-Gm-Message-State: AOAM531kq4yHEW9fup3iuZ+R8c8Ngu/796Jz+RUTUOrb628R4FdSuURX S8jSrNElanya82B/FcShilYZBZMxTNE= X-Google-Smtp-Source: ABdhPJy6XbCwn0VXh2hfnc5n0j40f1f6msdgdOaexvjzRf0OMRsskvAHD7qJYIqhHuClSoTrCr4wUA== X-Received: by 2002:aa7:cd55:: with SMTP id v21mr31765782edw.344.1621939391642; Tue, 25 May 2021 03:43:11 -0700 (PDT) Received: from huette ([5.146.118.192]) by smtp.gmail.com with ESMTPSA id b25sm10780493edv.9.2021.05.25.03.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 03:43:11 -0700 (PDT) References: <87tumvdno3.fsf@gmail.com> <87eedw5s0c.fsf@gmail.com> User-agent: mu4e 1.4.15; emacs 27.2.50 From: Sebastian Miele To: David Masterson Subject: Re: Empty headline titles unsupported: Bug? In-reply-to: Message-ID: <87o8czksaq.fsf@gmail.com> Date: Tue, 25 May 2021 12:43:09 +0200 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=sebastian.miele@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sebastian.miele@gmail.com Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621939420; h=from:from:sender:sender:reply-to: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=20NJL564FBRwPsXhf537uzGhUnHj3XpFME8SNwmja4I=; b=lBrG5uM7FZxYncijSEXFOfip/6ijebSACmvsnJi7Fl0hBG6HmDe6h9eWown2Cj0W9RFVCm N667Kltx78VwNOjrkS/R5jWUJKburKlA7gpcff5llnOu1orGlRTVPN5dciS/A/cyaN01Oa MqGsKGbZTpXmqIw6Z5b00dySW+0RlW0v68zJQHDwk815vogozfQS0oi19pI44oCU72f9ne JdJKSSBYSo7QNFqVwuZIry5LXo/uabzSit0JJ6gbJBA7ObdEiJhPDn+j4k9dpsQELmMqYt DwljcXUaBGUqM88p79FlVkJA4mVi0VXFiB94DGrT/VRcMDCRJ1iBtsQWO1zLgg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621939420; a=rsa-sha256; cv=none; b=TXwDJtMXFhfLwm7nuZ9GUPCI4HfALJyvHJetjxbU5xxTJSDYUiHYV+N/rNj/zUoYzCTvBb Q9794hg39YR60jMAggxny3oAICaFMxzTzcEabGrsh9ZXzwd5ODarMEWpYHKL/E2Yl5eIai OMrvm+PUau7zKKeS2WkQuTFN+WHYF0ZEwE+j1k8XTot3/1pQOFErf6aNMcj76ynqKG9F6r O52tS0o0k/HGqMMvcaMcpn5T39Ou/0q0BXybDelqDld2bED+I0cm5J1Q78LmrcioK0Wk1R CsKOGJb3niIlYoFyy5Sg4BLUG9syRwyy6ceQDBTaUbQ07Vjw8JCjn7Ekxv9z/Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=R3EFjLIo; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=R3EFjLIo; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2E81D102C7 X-Spam-Score: -2.13 X-Migadu-Scanner: scn1.migadu.com X-TUID: iEmsiGBhpXmb Hi David and all, David Masterson writes: > Sebastian Miele writes: >> Currently org-syntax.org says that "TITLE can be made of any >> character but a new line. Though, it will match after every other >> part have been matched." This does not reflect the currently >> effective behavior that "* :t:" is a headline with title ":t:" and no >> tags. > > Can you describe what should happen in a parser grammar (ie. BNF)? If > not, I would tend toward rethinking the structure of the Org file so > that it can be described in a grammar. Having a good grammar for Org > files will promote it's acceptance beyond Emacs. I do not know whether it can be expressed in a context-free grammar, although it may very well be possible. However, the way I understand the above quote from org-syntax.org (which is, I think, in the end preferable) is concisely expressible in a regular expression language that can distinguish between greedy and non-greedy matching of subexpressions, including Emacs Lisp's regular expressions: #+BEGIN_SRC elisp (rx line-start (maximal-match STARS SPACE) (maximal-match (optional KEYWORD SPACE)) (maximal-match (optional PRIORITY SPACE)) (maximal-match (optional COMMENT SPACE)) (minimal-match (optional TITLE SPACE)) (maximal-match (optional TAGS)) (maximal-match (optional SPACE)) line-end) #+END_SRC SPACE is (1+ (any " \t")). TITLE is (1+ not-newline). In the following, I concentrate on differences from org-syntax.org. The above expression contains COMMENT (matching "COMMENT") not as part of the title but as separate entity. Although this is contrary to org-syntax.org, it is how it is implemented now, e.g., in org-element-headline-parser. TAGS currently effectively is (seq ":" (1+ TAG ":")). In particular, that means a TAGS specification in a headline must define at least one tag. I suggest to change that into (seq ":" (0+ TAG ":")), i.e., to also allow TAGS specifications of zero tags (just ":"). This would enable to clearly disambuate the following ambiguity between TITLEs and TAGS: #+BEGIN_SRC org ,* :t: ,* :t: : #+END_SRC The former headline would have empty TITLE and TAGS ":t:". The latter headline would have TITLE ":t:" and TAGS ":". The following toy can be used to test some cases. It is not complete, but contains the essential. #+BEGIN_SRC elisp (defun f (x) (let ((r (rx line-start (maximal-match (group (1+ "*")) (1+ (any " \t"))) (maximal-match (group (optional "TODO" (1+ (any " \t"))))) (minimal-match (optional (group (1+ not-newline)) (1+ (any " \t")))) (maximal-match (group (optional (seq ":" (0+ (any "a-z") ":"))))) (maximal-match (optional (1+ (any " \t")))) line-end))) (when (let (case-fold-search) (string-match r x)) (list :stars (match-string 1 x) :todo (match-string 2 x) :title (let ((title (match-string 3 x))) (if title title "")) :tags (match-string 4 x))))) (f "*** :t: : ") ;(:stars "***" :todo "" :title ":t:" :tags ":") (f "*** :t: ") ;(:stars "***" :todo "" :title "" :tags ":t:") #+END_SRC Best wishes Sebastian