From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id gBsSOWZMXmTjOwAASxT56A (envelope-from ) for ; Fri, 12 May 2023 16:25:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id GMnqOGZMXmTkYwEA9RJhRA (envelope-from ) for ; Fri, 12 May 2023 16:25:42 +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 996DC2B339 for ; Fri, 12 May 2023 16:25:42 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxTha-00060w-Q1; Fri, 12 May 2023 10:24:58 -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 1pxThY-00060l-TB for emacs-orgmode@gnu.org; Fri, 12 May 2023 10:24:56 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxThU-0000Ub-UY for emacs-orgmode@gnu.org; Fri, 12 May 2023 10:24:56 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4f18dfe3016so1317099e87.0 for ; Fri, 12 May 2023 07:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683901490; x=1686493490; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=f7X4qa61djDzkUE07DQFEJc1ZAiFq0tIa34L1uTRjzs=; b=OkqQGMuqnBtTNEnSYvzQCgtQa38UY4lkDY3Uay96Ul6qL20nabLOBVgTogJxSXNLOn Z/TdLUA4hUxX3PIhu8I+TsuBdtJDeokPQq35TVvN8oxb5IVIGTL90s9FuTUGfaOQ2zJm ik9NPhHa5azC3tJoixM3cWw4XDM9pp40Ab4Q3ryjcgx/zBLdhNDMkSsHC4yZNdThmtFV w5tlzzA/tAA+4m5VwT0y28VwbFwJfcbx9gcJk42a6FWEYaMtISdKVg0RBxTTKPo81FZb SjgXwKd9raO9HgIIE1t2EppY7j3owW91s2hhpmz/pkOEpeQgXEvaOphveS+yPm9Y97vl IcOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683901490; x=1686493490; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f7X4qa61djDzkUE07DQFEJc1ZAiFq0tIa34L1uTRjzs=; b=iINC7sFt25C0rrBPucaerYMv5TfuAeQSfQOXDLLJfMXii3mrZQX+n8tMJHJ30J/gbx +rK47tY+BsBnUCPDmiatGwvBxLSRgJ8wkeT2rgNtj2yObaQaKzg70yHoIn7mRPzTT5du k+t9UpCCU5JjM+CVZsg5eumXBNQIKGjh5jAIwAlx4xNRub1YpQ3kST4EoDC14Hl1vHYO /0VZ/Jsw1Ci6h2r1/I8fV8NFutis/RANlS8x3eisdBc4cXdU1bFEbBmUhCaOuuLM4xoJ siUjmPCqh7u04AcaJ+mvsVsoPTj+T9JtYTUExuh20lduIgP4NXXBhmw7xEVdNsDhIqr0 zLKQ== X-Gm-Message-State: AC+VfDxZIMz27WR9M57w9n8uFsdnXf1yWxI10rpyYY9bo5h//xLzLNzp uOWrc52t5E4kDQ0UUPYC7lDlsJWG9YgZjC8GdZw= X-Google-Smtp-Source: ACHHUZ4gx9OLqkJxomeNZwgNspJNmq5Voo2YCWtWEgc7xfMZ/gfNNhVfsSWPyKbn0OJGNGEoDsan89+H4aF03l8O4aU= X-Received: by 2002:a19:ad45:0:b0:4e8:586c:f13 with SMTP id s5-20020a19ad45000000b004e8586c0f13mr6181366lfd.6.1683901489772; Fri, 12 May 2023 07:24:49 -0700 (PDT) MIME-Version: 1.0 References: <87o7mpwy4g.fsf@localhost> In-Reply-To: <87o7mpwy4g.fsf@localhost> From: Tim Visher Date: Fri, 12 May 2023 10:24:12 -0400 Message-ID: Subject: Re: Can `org-capture` templates be made to result in a sub-heading of the current heading? To: Ihor Radchenko Cc: Emacs Org Mode mailing list Content-Type: multipart/alternative; boundary="000000000000227e9605fb7fde2d" Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=tim.visher@gmail.com; helo=mail-lf1-x12b.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, HTML_MESSAGE=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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683901542; a=rsa-sha256; cv=none; b=OB7W/Nt4rFzSoSDQD8r/JaeJEdhFviOep7iuEIjOglAb5g+JGU7F/q/j4aAHcFoL1aQUKw ciT30n1FFpf4hkRteHpwvelPf/VgB6nd1fkTHMZ1eRvO3mBVC3PZ1xud9OA8dmMLBLNWFf E7QOtFojZy7BPHcGwdf2dDYmL0aBTp5553SpyNHU/Cjs6em4FX/CDqU0W5GsMyYrO9erN/ ZcVFtcwn6evWRf4TmluVyFHV1w7li44f0CGjRFSX18KA8Zrzqq3F6t2cXR1e92stoOC3bU /GGQ9FZb4R5SyYOgf5OeUgLTwyuJGNBmID5ES9yAD+r0WjRaMCCmh+IzNMBc+w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OkqQGMuq; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683901542; 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=f7X4qa61djDzkUE07DQFEJc1ZAiFq0tIa34L1uTRjzs=; b=HcUjrB57Mn6nLJ6z/zQpJLelq6bb9syR046Ino2tRKUgxpR77IHyAmjlQiY9qYIxPsCx0r 1UPkeeTk7wonDsB5hO9lA2VW/HupVIJlQmcrhgGb7J0+3Qcs0AzNI4k5G30+TAeZFtc040 U4p+hDq/P46/JLir1GDnb+67IiLUIoXwCUUAE09xn+Acnw0PMJutbr3OgZAZehamVI5dAg qIvTcRCeMIBHvAdZtgQC/vw8XZDe0u4wX1DoTpTU7c19jBrsDCwqBUwl9MctE85qp8Kg+Q ww+IbUsyNkSB4G7jCvPyWlw2XvUUYZNTxHVjzXKz1l47zNcDUlmOSfJw5wTHTg== X-Migadu-Spam-Score: -8.40 X-Spam-Score: -8.40 X-Migadu-Queue-Id: 996DC2B339 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OkqQGMuq; 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-TUID: ZA9jow5kzvqy --000000000000227e9605fb7fde2d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 12, 2023 at 8:05=E2=80=AFAM Ihor Radchenko wrote: > Tim Visher writes: > > Can `org-capture` templates be made to result in a sub-heading of the > > current heading? > > Just use target `here' (as symbol). > Thanks for the suggestion, Ihor. Do you have an example of this actually working? I'm on `Org mode version 9.6.5` which looks to be the latest available from GNU ELPA and there seems to be a dispute between `org-capture-set-target-location` which understands that the result of `(org-capture-get :target)` can return a symbol rather than a list vs. `org-capture` itself which assumes that target will _always_ be a list. My testing code: ``` (timvisher--comment ;; Context (defmacro timvisher--comment (&rest _) nil) (defmacro wcb (buffer &rest body) `(with-current-buffer ,buffer ,@body)) ;; Demo code (setq org-capture-templates '(("1" "1" entry here "* 1") ("2" "2" entry (here) "* 2"))) ;; Fails with `Capture template =E2=80=981=E2=80=99: Wrong type argument: = listp, here` ;; because of `=E2=80=A6 (car (org-capture-get :target)) =E2=80=A6` (wcb "todo.org" (org-capture nil "1")) ;; Fails with `Invalid capture target specification: (here)` because ;; `(pcase (or target (org-capture-get :target)) =E2=80=A6)` doesn't have = a case ;; for `(here)` (wcb "todo.org" (org-capture nil "2")) ) ``` --000000000000227e9605fb7fde2d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, May 12, 2023 at 8:05=E2=80=AFAM Ihor = Radchenko <yantar92@posteo.net> wrote:
Tim= Visher <tim.v= isher@gmail.com> writes:
> Can `org-capture` templates be made= to result in a sub-heading of the
> current heading?

Just use target `here' (as symbol).

Thanks for the suggestion, Ihor.

Do you have an e= xample of this actually working? I'm on `Org mode version 9.6.5` which = looks to be the latest available from GNU ELPA and there seems to be a disp= ute between `org-capture-set-target-location` which understands that the result = of `(org-capture-get :target)` can return a symbol rather than a list vs. `= org-capture` itself which assumes that target will _always_ be a list.

My testing code:

```
(timvisher--comment
=C2=A0;; Context
=C2=A0(def= macro timvisher--comment
=C2=A0 =C2=A0 =C2=A0(&rest _)
=C2=A0 =C2= =A0nil)

=C2=A0(defmacro wcb (buffer &rest body)
=C2=A0 =C2=A0= `(with-current-buffer ,buffer
=C2=A0 =C2=A0 =C2=A0 ,@body))

=C2= =A0;; Demo code
=C2=A0(setq org-capture-templates
=C2=A0 =C2=A0 =C2= =A0 =C2=A0'(("1" "1" entry here "* 1")=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("2" "2" entry (here= ) "* 2")))

=C2=A0;; Fails with `Capture template =E2=80=98= 1=E2=80=99: Wrong type argument: listp, here`
=C2=A0;; because of `=E2= =80=A6 (car (org-capture-get :target)) =E2=80=A6`
=C2=A0(wcb "todo.org"
=C2=A0 =C2=A0 =C2=A0 (org-capt= ure nil "1"))

=C2=A0;; Fails with `Invalid capture target = specification: (here)` because
=C2=A0;; `(pcase (or target (org-capture-= get :target)) =E2=80=A6)` doesn't have a case
=C2=A0;; for `(here)`<= br>=C2=A0(wcb "todo.org"
=C2= =A0 =C2=A0 =C2=A0 (org-capture nil "2"))
=C2=A0)
```
--000000000000227e9605fb7fde2d--