From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id o+0lAsz/NmIChgEAgWs5BA (envelope-from ) for ; Sun, 20 Mar 2022 11:19:56 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id CJoPOsv/NmJyRAAA9RJhRA (envelope-from ) for ; Sun, 20 Mar 2022 11:19:55 +0100 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 9E66C36B8F for ; Sun, 20 Mar 2022 11:19:55 +0100 (CET) Received: from localhost ([::1]:39530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVsfC-0002nW-69 for larch@yhetil.org; Sun, 20 Mar 2022 06:19:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVseU-0002nH-Gk for emacs-orgmode@gnu.org; Sun, 20 Mar 2022 06:19:10 -0400 Received: from [2607:f8b0:4864:20::102d] (port=43879 helo=mail-pj1-x102d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVseT-0000Xi-2O for emacs-orgmode@gnu.org; Sun, 20 Mar 2022 06:19:10 -0400 Received: by mail-pj1-x102d.google.com with SMTP id n7-20020a17090aab8700b001c6aa871860so5962045pjq.2 for ; Sun, 20 Mar 2022 03:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=OZl1lGsV2FWrseZoRY93RSd4h9+JDKkrBwZ7u85zGKQ=; b=gVcXr5O8iBdpsNq/ZyiPDR1jJW2aAXn2rKgR5JxuF0uHh4hqv2ZbpPR4dHh0ALaQrN hbPDNPusAUbkEDZTO77DWBbCjyulNfz1CftawfuVPbSEKQUXASXVQLXebwCsq/VEZvhq mC2/rSiqjyUiEAYbQMruUEzTwOOv+B8s4pUIEqt7xV7QRzdQPUT5E1QF94RnoJQD4pQH 5pPgerCoOclYv5sIfuCgNYTQOXscsEIuma3Gy3yPnQ3OvMRCYU+SQWe2JidenzHB4uYj k1DtGT4tV2dvNYKOqvKfIQKX+iwJoAt7m8fgXKqqs0LgAn56B3KPOWu5AqatEWpqZsTC I1Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=OZl1lGsV2FWrseZoRY93RSd4h9+JDKkrBwZ7u85zGKQ=; b=HLApXOMh26elLBWtS719WjjlpWctZLZi5LX4SmxTD3UC/yzKYxeC8e1aT2bbgMV4YX YtwbPQiw2uE4o86fLg1Ez9ablzI+W8q7imiwPqy7zLb2Q1opQagKujesVM0S0bhAlEdY MBU0ujfdFDNA4kfzN+jjoPqgX51WFOqTLQQz5v8i21TlBFJTqpoH3aqozjcja3QBq7Dh v3r+sTSFmzJvAjP+tHzJgRxmWT1D/R/FxgCRJlZLtoWSFQbfLwYU5xSbtiVu4nYdQ6vm KCtBTIe4ZOuc5BBHbg4WTb+3NMRjVzh/OUmtdsdAsDA9LQStNLmNec+x/4iVEOSDUNFG oLTQ== X-Gm-Message-State: AOAM5307TDYpUERPG8g1moCnnyeRmt1M699JnhbvhLeJv08+u0tQjFE1 UEwewVmW0mDftUdi4Yka8cg= X-Google-Smtp-Source: ABdhPJzPUfcrSd8e2Y16c7rlLRDqKieqTVqTWWipAsuhPBjPYJ1qhC5rlmoAzLzpEgtY2mSDSaDCAg== X-Received: by 2002:a17:903:186:b0:154:3606:7a73 with SMTP id z6-20020a170903018600b0015436067a73mr5124582plg.89.1647771547192; Sun, 20 Mar 2022 03:19:07 -0700 (PDT) Received: from localhost ([45.128.72.3]) by smtp.gmail.com with ESMTPSA id t7-20020a056a0021c700b004f7916d44bcsm15275622pfj.220.2022.03.20.03.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Mar 2022 03:19:06 -0700 (PDT) From: Ihor Radchenko To: No Wayman Subject: Re: [RFC] DOCT: Declarative Org Capture Templates (easier template syntax) In-Reply-To: <87d07wkbkz.fsf@gmail.com> References: <87wo66t8i7.fsf@gmail.com> <87y2qlgq33.fsf@nicolasgoaziou.fr> <87d07wkbkz.fsf@gmail.com> Date: Sun, 20 Mar 2022 18:19:33 +0800 Message-ID: <87czihdiyy.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102d (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102d.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: emacs-orgmode@gnu.org, Nicolas Goaziou 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=1647771595; 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=OZl1lGsV2FWrseZoRY93RSd4h9+JDKkrBwZ7u85zGKQ=; b=WjFS55PhjRO3/LmB/tBie0su+QJWXtzcUZgD0EZQUxpqgu0yorxnB9rkFRFiXZCroEQzSW wD2QwJGRYrGWOtaJvkZXY2RxGxV24EnXaCfbca0vqu1MUdlQZyHPlvTs26wJyy2g1aPX9M kHIAtiyckPm36z84SUzQDMF8y/YFt27oh4r9DWRGkJsPV6nZnlLhwlrQWjTECNk9iMja3h ywDtd/FPu29U068xSDWp940ETgTCGu6gqd4XJaTiJQkIcX/D8AwxCxWEt6Kap64PuuJqgC Pe9SL+q5qdWY8G+w0lGYaO5czBanF3mf+3e4txhlJKEdigQZ9hBxUSQCPuTw+A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647771595; a=rsa-sha256; cv=none; b=cn9N9D2D12DwplSlgwEfSneqCVM7oDZd+5TwQw1LYhV/VJzXkCbtZdNMNwH9V37zDHsM0A DjtAB9W1sFIGVN/j63jJpJiI1tsgmyKl1iG94gOu6q1+LVpszyeycy5thBIly/0pa4eYs+ 3E3c/+J19eX7PHhBqDISxYPPUqfuakdOR9NI2ee28PGhsXfJmWbg4KC6oO4M0ZPmqweRY3 U2W5UIow88MtoyjZBdKlgZKdzKAnBp7zEKVNdsI3QmYC3RTajc5m/IBzQw3Zvnyj7g+Nqh P5qEc0J4IW/Mwb/XPQulxvdUFndWHV/TuFc3T4H2gsNuXVOnxRNn0zyqIX5K+A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=gVcXr5O8; 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: 6.57 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=gVcXr5O8; 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: 9E66C36B8F X-Spam-Score: 6.57 X-Migadu-Scanner: scn1.migadu.com X-TUID: TS0szDuLwfnh I am pinging this thread again because I believe that doct syntax is much easier to write compared to current defaults. It should be added to Org core. Also, if anyone agrees with my arguments below, do not stay silent and drop a "+1" email below. Otherwise, this whole thing will be stalled. There is no point discussing technical aspects, if there is no interest. Citing again an example illustrating the difference between a slightly non-trivial capture template using current vs. doct syntax: No Wayman writes: > Without DOCT: > > ;;rest of template configured elsewhere... > ;;make sure you update this if you ever change the key for this > template! > (defun my-org-template-hook () > (when (string= (org-capture-get :key t) "t") > (message "Template \"t\" selected."))) > > (add-hook 'org-capture-mode-hook 'my-org-template-hook) > > With DOCT: > > (doct `("Example" :keys "t" :file "" > :hook (lambda () (message "Template %s selected." > (doct-get :keys))))) > > DOCT ensures that function is only run for that template without > having the user manually filter against `org-capture-plist's :key. > It also allows the user to do this inline with the rest of the > declaration vs spreading it out. I believe that the right way to introduce this syntax is creating an easy-to-use macro like (org-declare-capture-template ...), which takes care about fiddling with org-capture-templates variable and its format. The current format of a number of Org customisations is cumbersome. For example, org-capture-templates and org-agenda-custom-commands often become long list of lists with each element that must have a very specific position. Every single time I need to write a new template, I have to carefully consult the docstring; and every single time I an reviewing my templates, I have to consult the docstring again simply to understand the meaning of the first, second, ..., nth element of the template. Having CL-style :keyword value plists is much more readable. More generally, it would be useful to provide a doct-like functionality for org-agenda-custom-commands and similar variables (like org-agenda-custom-commands, or say, also org-latex-classes). Best, Ihor