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 ms0.migadu.com with LMTPS id APCUNPNBOGLdFAEAgWs5BA (envelope-from ) for ; Mon, 21 Mar 2022 10:14:27 +0100 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 kFAuLfNBOGLAEAAAG6o9tA (envelope-from ) for ; Mon, 21 Mar 2022 10:14:27 +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 2937B2E231 for ; Mon, 21 Mar 2022 10:14:27 +0100 (CET) Received: from localhost ([::1]:60128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWE7N-000361-Ge for larch@yhetil.org; Mon, 21 Mar 2022 05:14:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWE6l-00033x-Ru for emacs-orgmode@gnu.org; Mon, 21 Mar 2022 05:13:47 -0400 Received: from [2607:f8b0:4864:20::1034] (port=43784 helo=mail-pj1-x1034.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWE6k-0003uE-21 for emacs-orgmode@gnu.org; Mon, 21 Mar 2022 05:13:47 -0400 Received: by mail-pj1-x1034.google.com with SMTP id n7-20020a17090aab8700b001c6aa871860so7735758pjq.2 for ; Mon, 21 Mar 2022 02:13:45 -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=uX5yJsKdkpLuxRwMlhmligSKdWhynr1Hm67MVzuRgDI=; b=SmlwIujfd0QNCZ295yJOtTA9ZNoNAzaVZfdJ9T9Nf8mSsMDaeIMV2MhLeZ0ePxk+xW iXYMefrl7tIK21bxBh4btIyXpW0xJ0p4iFy1prg6jq7Q6WusPTwe+3X0SBvZhSXx8WpC g9SeSHST/RislM0Zr/JfCQI9LOavYpc5AZOxsXetvVtVuQs8hmEXuAybMxC7d5ProhDD qClpYt5Lh66XCzGHiCvLtb/lXd0LJP8IwzFofNWHD9kRIVdKsV6CjD++7YRtphUvUbtU WQQD6P0nezppPE00fHN5eTBbYOOh/CEgDfLEPaAyfQBiWTdD39wn0aJikdo+vwhPnBrL lrhA== 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=uX5yJsKdkpLuxRwMlhmligSKdWhynr1Hm67MVzuRgDI=; b=NRM3mAJqlVLfpIitm/bdGek4YiOPPhAgy2h42wZWManfuvTJ8d48sv4UaHm0xiD1Il Kh8WXpb3MyyogWFuzGx112ps8zbnYhEJ5C4BZsGC+XU9ANZ+4SRPyvwjAXYrr7cuW4Sk 3nEARDWI1pisvYyKwElrgsfFxzcjyKfmSYJRs009b/jdZgXd/cKc2ymGMXws4XR82RCt xsOPLY3XR4xWGhRXnqvCJcdKDGm3BiUIMb7ZrnfuDvDgWj87O0VJmjhgzvRj15JN6sN8 a+zIebC4iu9tIQXq6aIdeSQaaZT4UV08J5Awkc6TAzDhj/AV0JuTYAEt65ccWISzx6Gb Seqw== X-Gm-Message-State: AOAM53221jEoROk7QacCf65zOE/3QtjxScwzj03hih45L++V1quvfAwM eSYNkh3Xq6YNVS7kuvGN5w4= X-Google-Smtp-Source: ABdhPJxNfuPMVuut1pgFA+YKYrMV7ujGyaFccaAENHMyzHZuXryHEBIpHZ0PWSQWBPjQ+s3GuoARlg== X-Received: by 2002:a17:903:20c:b0:154:b58:d424 with SMTP id r12-20020a170903020c00b001540b58d424mr11569598plh.45.1647854024702; Mon, 21 Mar 2022 02:13:44 -0700 (PDT) Received: from localhost ([45.80.128.9]) by smtp.gmail.com with ESMTPSA id v8-20020a056a00148800b004fa9bd7ddc9sm4191688pfu.113.2022.03.21.02.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 02:13:44 -0700 (PDT) From: Ihor Radchenko To: Nicolas Goaziou Subject: Re: [RFC] DOCT: Declarative Org Capture Templates (easier template syntax) In-Reply-To: <875yo8u5kj.fsf@nicolasgoaziou.fr> References: <87wo66t8i7.fsf@gmail.com> <87y2qlgq33.fsf@nicolasgoaziou.fr> <87d07wkbkz.fsf@gmail.com> <87czihdiyy.fsf@localhost> <875yo8u5kj.fsf@nicolasgoaziou.fr> Date: Mon, 21 Mar 2022 17:14:11 +0800 Message-ID: <87bkxzd5wc.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1034 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1034.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, No Wayman 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=1647854067; 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=uX5yJsKdkpLuxRwMlhmligSKdWhynr1Hm67MVzuRgDI=; b=QMLNp2sQJYu1OpnJtgOt/4zwVh6QbFG/Gx/TnOYBejZs9fToVqZzxCIRV7cDaQdEPngSd0 Q2C3xigmkjDqn2oJ9eKcPbFiC7NpXT3jg52R0HO0WMlvCs+/8HyewjB+4hSDuAw7trSjSO kx8Pke276RYznByugpMlNiQe15g/PmsWnt7Wd+GVdUXtvmcxlGBz3leZLn98su1WFOqqeT R8HPvg9w8lWJvdJ6Q6AyFyTlRu16DEYE/7qUrlSvCMNEfbYmk8kjaAqKOGqKlt1Mup3nMd y27jExfle+9/9Tf1I7mZ6BRmwkmcQsYSWpTToxCq0CAh48PL9ueWtFlpjFgamg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647854067; a=rsa-sha256; cv=none; b=hzZ7ka8P4vzDwRTwOpI0c5tCW2j1REekBEvK2MOTet+V0t6hhm2RqnEWyxOy22w/5iugTY 2Wd8CGl0A9P7Gj/S8MEj8kxqTIBgPcnziY23jDjfO+msyfl2iZFpkZmIV/ggn8Ntm4RYM4 8/uQJhpoiceDPDuwE+x34OFl2D4EnlKt1Zzmbo/KDaDTRIp6xsMNuMvkvs5YaWMVbC61SB kws20BV/C7vd+SrUSzv+iQ9gCVQHzvBYxwyUGDyGFlv1lNEyoKf6VL2XrPivoA3IbukHnt 1VEgwDvDQ4IWPIQJQ5vo3GwlKvhNmkGa/94eKpzCZ6FDCNQ63EU8z3Dgp+qJFg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=SmlwIujf; 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.58 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=SmlwIujf; 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: 2937B2E231 X-Spam-Score: 6.58 X-Migadu-Scanner: scn0.migadu.com X-TUID: MbJVnx4h9LzT Nicolas Goaziou writes: > I think there should be a direct mapping between Customize interface and > values. Adding this macro as a band-aid to simply configuration is not, > IMO, a solution. I think that current customize interface for org-capture-template is perfectly fine. doct aids users who set org-capture-templates programatically. doct also does not break the mapping between customize and the values - it converts the doct syntax into the default org-capture-template format + adds a number of shorthands for capture-related hooks + to capture contexts + provides easier definition of similar templates (via inheritance). For example the below doct definition provides two similar templates without a need to duplicate them: (defcustom org-capture-ref-capture-template `( :group "org-capture-ref template" :type entry ,@org-capture-ref-capture-target :fetch-bibtex (lambda () (org-capture-ref-process-capture)) ; this must run first :link-type (lambda () (org-capture-ref-get-bibtex-field :type)) :extra (lambda () (if (org-capture-ref-get-bibtex-field :journal) (s-join "\n" '("- [ ] [[elisp:(browse-url (url-encode-url (format \"https://sci-hub.se/%s\" (org-entry-get nil \"DOI\"))))][downlaod and attach pdf]]" "- [ ] [[elisp:org-attach-open][read paper capturing interesting references]]" "- [ ] [[elisp:(browse-url (url-encode-url (format \"https://www.semanticscholar.org/search?q=%s\" (org-entry-get nil \"TITLE\"))))][check citing articles]]" "- [ ] [[elisp:(browse-url (url-encode-url (format \"https://www.connectedpapers.com/search?q=%s\" (org-entry-get nil \"TITLE\"))))][check related articles]]" "- [ ] check if bibtex entry has missing fields" "- [ ] Consider subscribing to new citations")) "")) :org-entry (lambda () (org-capture-ref-get-org-entry)) :template ("%{fetch-bibtex}* TODO %?%{space}%{org-entry}" "%{extra}") :children (("Interactive org-capture-ref template" :keys ,(car org-capture-ref-capture-keys) :space " ") ("Silent org-capture-ref template" :keys ,(cadr org-capture-ref-capture-keys) :space "" :immediate-finish t))) "Default capture template. The template is a template defined using `doct' syntax. See docstring of `doct' for details." :type 'list :group 'org-capture-ref) > If capture templates values are too complicated, what about simplifying > them, and possibly use this macro as a temporary solution to help > transition? Could you elaborate what you are referring to? doct is a simplification of otherwise more complex templates. Without doct, users may need to write addition Elisp to define complex templates. With doct, a number of things can be done in a more compact form. A bright example is defining a capture hook that will only be activated for a specific template. doct allows to do it seamlessly, while vanilla syntax will require user to set the hook manually and check the current active template via elisp in a non-obvious ways that require knowing org-capture internals. Best, Ihor