From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 gEQPJ8PpXGT5AAAASxT56A (envelope-from ) for ; Thu, 11 May 2023 15:12:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sOryJsPpXGR0JQAAauVa8A (envelope-from ) for ; Thu, 11 May 2023 15:12: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 423879368 for ; Thu, 11 May 2023 15:12:35 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px653-00028D-CP; Thu, 11 May 2023 09:11:37 -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 1px64z-00025s-Gb for emacs-orgmode@gnu.org; Thu, 11 May 2023 09:11:35 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1px64p-0008J5-LK for emacs-orgmode@gnu.org; Thu, 11 May 2023 09:11:31 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ada1927e20so5661011fa.0 for ; Thu, 11 May 2023 06:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683810680; x=1686402680; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=W08Bt1XS+G4NADQF+G0odS7m/G5OSqUpb9R/24eAzQI=; b=W17eUDr/2PxzD4WWQStIqyj2+I1QZhzYkl7yB9drI7K+k9OHecKEpwOrjATyJ5I6CC 3V0Hoyu24DwzlWpye8InJ7rE59a/qDqGQ42VeM7+VM6mgOtT8IVc+NgTGxPNGLgQiKbg aEw9W+kKDmDYPK5+sDkpqVTs913CEiQN7Qj22aK4L52LGbdJfMf1xffseHwE6944oTTR gjeeUew2qdwp/CdKT0ZBhcOxcsfCWn4YF9JN2duDN/KYZb6vjEp2ytvFITUtgCwE4HbE WZUE29hWbE1Lm29xOh4hwQ+qzD6ynNA1Q1ozyCGP7nWBoPlXK/G8iKpA3qH2b5C3+lWe d6Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683810680; x=1686402680; h=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=W08Bt1XS+G4NADQF+G0odS7m/G5OSqUpb9R/24eAzQI=; b=eU0rVtYBSt9IwYNdiKwh0TH0CWgvMBf43eNyGrxygpHzMn/Xlhq+xpaD1LOpMc2/v3 xl7tGqgdBDepW2JvEv4C4jO40mun5EZkw6El1CCye6j1ffMwMI1ejJKtcf3qI+dQeIsn BISgMGgBvyUeXoR7DdtWSbMOrp0yERlYV/EJvaVJQz8XvA8LQJOQ3v4gFhVtvukGG7S6 68X9us2c51LnV87+sotCa6h7ROcvvd04R52rC7k7JEjcSlLUlIm2ihPZ/SJBwjp6vhcq SMKuQO7XV5V5NmOX9hvf5T7964pxLFFBIwiiwUz9EVuvucMCS0NJgtAqYobIxJNU7+/m /WWw== X-Gm-Message-State: AC+VfDy2yLKXll2B7WDcy0V80naa8eJQJ4TTaMZQifbZBEkofpRiwJ5C OsP69h1MN8AbnsuFIcQLaaET8IKK5YW+BzJOY6whYYpuxEzIYw== X-Google-Smtp-Source: ACHHUZ6r1/EtWy+i+DBWRLgE9TqQgnD5nOvlZXoY5ASax1Scp84Mzg4o/nhmhf/iZmv89/Lhn5hXQLusvbVmY0cquQ4= X-Received: by 2002:a2e:1f11:0:b0:2ac:90f2:97af with SMTP id f17-20020a2e1f11000000b002ac90f297afmr5512443ljf.0.1683810679889; Thu, 11 May 2023 06:11:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Tim Visher Date: Thu, 11 May 2023 09:10:42 -0400 Message-ID: Subject: Re: Can `org-capture` templates be made to result in a sub-heading of the current heading? To: Emacs Org Mode mailing list Content-Type: multipart/alternative; boundary="00000000000071a56605fb6ab922" Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=tim.visher@gmail.com; helo=mail-lj1-x22f.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, 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-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683810755; a=rsa-sha256; cv=none; b=Xquuo43mqYF1TnBlcjXfDYyWdEkbkyEHey3jk8i9HkZ0mxZBZSQqkPzuHwqy3KDRSRXjqu Vbtr+8cEr4HeRzWlAPFZaFyqkrrmwjvGcm+Ihe1BvFXTcyGa9uuBQzT0+1++Ii5+ON6mGn AGdpJZe+Hi9/Squ5UWSdXLOK5aQLOQk3yHEO93K6Gq73eOEtx+khK8ab2w1/3yeY8rgz/x 8m6tCVpKSXaQXYTyE1cmjTo8uloFII5W5ccm6vx2PT+wJhtjd3r1qiWrSy3h4WMXClESjK epniPFcaWghgu+O6ksnxvGcBV0MgLRS+yG0Y80k8XHqV6h/GbZ0J4GKdejbZUA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="W17eUDr/"; 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=1683810755; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=W08Bt1XS+G4NADQF+G0odS7m/G5OSqUpb9R/24eAzQI=; b=XsnoEm+CYLI8qbMc0xOhN9hOT3CZw8R8jnECRdNq2U2vyVezgReG3yeH4kAjVxkfi0RRxC gPKNl29lGbJeyoxZgYM4S/VreHjnNLPxy5bGxTMIB1MX1gaWUA7VqKCvZD+npproEr73Ry 5b5qnWlqLHJ8CnfwXiriDV6z0ht9V6E4c+KyBb/7/588SlYBDVi5RjCbY1uSMZYlYse9rj iKxZlmn+nqd/6g4oLyfAOL1sNF7539b9IYD2EWBteiZKyK7m2LRHjP7eRdQ7Scc1FvUbFb LkN+Vqj+iKpWe8w+peFs37NbpsRCYWdXlH9TowPi0JPMs9uOYwTnYqrts5ARfQ== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="W17eUDr/"; 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: -3.87 X-Spam-Score: -3.87 X-Migadu-Queue-Id: 423879368 X-TUID: iJcqcqPHTN8a --00000000000071a56605fb6ab922 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 11, 2023 at 9:05=E2=80=AFAM Tim Visher w= rote: > On Thu, May 11, 2023 at 8:42=E2=80=AFAM Tim Visher = wrote: > >> On Wed, May 10, 2023 at 5:04=E2=80=AFPM Tim Visher wrote: >> >>> Can `org-capture` templates be made to result in a sub-heading of the >>> current heading? >>> >>> So >>> >>> ``` >>> * This Week >>> ** TODO A TODO Item >>> >>> [2023-05-05 Fri 10:47] >>> >>> A description >>> ``` >>> >>> and I whack my capture keychord and get >>> >>> ``` >>> * This Week >>> ** TODO A TODO Item >>> >>> [2023-05-05 Fri 10:47] >>> >>> A description >>> *** [2023-05-10 Wed 17:02] >>> >>> [2023-05-10 Wed 17:02] >>> >>> >>> ``` >>> >> >> It's worth noting that with a capture template like >> >> ``` >> ("twj" "TODO Work TODO Journal" entry >> (file+headline "~/Documents/todo.org" "Inbox") >> "* %U >> >> %U >> >> %?") >> ``` >> >> If I do the usual `M-0 M-x org-capture` with point in the original spot >> it behaves exactly as I want it to. My goal is to get it to behave that = way >> just by invoking the capture template. >> > > OK after poking around in `org-capture-set-target-location` I think I hav= e > this sorted. Please let me know if I'm doing something obviously silly. := ) > > ``` > (defun timvisher--org-capture-sub-heading-insertion-point > () > (insert "\n") > (forward-char) > (org-capture-put :exact-position (point) :insert-here t)) > > ;; Embedded in the capture templates list > ("twj" "TODO Work TODO Journal" entry > (function timvisher--org-capture-sub-heading-insertion-point) > "* %U > > %U > > %?") > ``` > Minor correction. I need to both insert a newline _and *leave*_ point where it was or I don't get a sub-heading at the proper level (the current level of the previous journal entry). If I don't insert the newline then cancelling the entry also pulls the next heading up into the text of the current heading. ``` (defun timvisher--org-capture-sub-heading-insertion-point () (insert "\n") (org-capture-put :exact-position (point) :insert-here t)) =E2=80=A6 ``` -- Tim Visher --00000000000071a56605fb6ab922 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, May 11, 2023 at 9:05=E2=80=AF= AM Tim Visher <tim.visher@gmail.= com> wrote:
On Thu, May 11, 2023 at 8:42=E2=80=AFA= M Tim Visher <= tim.visher@gmail.com> wrote:
On Wed, May 10, 2023 at 5:04=E2=80=AFPM Tim Visher <tim.visher@gmail.com> wr= ote:
Can `org-capture` templates be made t= o result in a sub-heading of the current heading?

<= div>So

```
* Th= is Week
** TODO A TODO Item

=C2=A0 =C2=A0[2023-05-05 Fri 10:47]

=C2=A0 =C2=A0A d= escription <point's here>
```

and I whack my capture keychord and get

```=
* This Week
** TODO A TODO Item

=C2=A0 =C2=A0[2023-05= -05 Fri 10:47]

<= div>=C2=A0 =C2=A0A description
<= div>***=C2=A0[2023-05-10 Wed 17:02]

= =C2=A0 =C2=A0=C2=A0[2023-05-10 Wed 17:02]

=C2=A0 =C2=A0 <p= oint's here>
```

<= /div>
It's worth noting that with a capture template like

```
("twj" &qu= ot;TODO Work TODO Journal" entry
=C2=A0(file+headline "~/Docum= ents/todo.org" "= ;Inbox")
=C2=A0"* %U

=C2=A0 =C2=A0%U

=C2=A0 =C2= =A0%?")

```=C2=A0

If I d= o the usual `M-0 M-x org-capture` with point in the original spot it behave= s exactly as I want it to. My goal is to get it to behave that way just by = invoking the capture template.

OK after poking around in `org-capture-set-target-location` I think I= have this sorted. Please let me know if I'm doing something obviously = silly. :)

```
(= defun timvisher--org-capture-sub-heading-insertion-point
=C2=A0 =C2=A0 (= )
=C2=A0 (insert "\n")
=C2=A0 (forward-char)
=C2=A0 (org= -capture-put :exact-position (point) :insert-here t))

;; Embedded in= the capture templates list
("twj" "TODO Work TODO Journa= l" entry
=C2=A0(function timvisher--org-capture-sub-heading-inserti= on-point)
=C2=A0"* %U

=C2=A0 %U

=C2=A0 %?")
```

Mino= r correction. I need to both insert a newline _and *leave*_ point where it = was or I don't get a sub-heading at the proper level (the current level= of the previous journal entry). If I don't insert the newline then can= celling the entry also pulls the next heading up into the text of the curre= nt heading.

```
(defun timvisher--org-capture-sub-heading-insertion-point
=C2=A0 =C2=A0= ()
=C2=A0 (insert "\n")
=C2=A0 (org-capture-put :exact-pos= ition (point) :insert-here t))
=E2=80=A6
```=C2=A0

--=C2=A0Tim= Visher
--00000000000071a56605fb6ab922--