emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Lukas C. Bossert" <mail@lukascbossert.de>
To: emacs-orgmode@gnu.org
Subject: How to get the right link using org-capture from the second level
Date: Tue, 25 Jun 2024 20:31:22 +0200	[thread overview]
Message-ID: <35eaf49a-19a3-494c-a5df-0fefc4201d41@lukascbossert.de> (raw)

Dear list,

In my org-roam setup, I want to document information about individuals. 
To do this, I created an org file named `20230501233516-persons.org`, 
which contains two top-level headings: `* Overview` and `* Persons`.

Under the `* Persons` heading, I intend to list all individuals. I've 
created a template that allows me to add people from any other file 
using e.g. `C-c n r i`. This template also facilitates the creation of 
new person entries on the fly, and ideally, it should add a link to the 
person entry in the file I am currently working in.

While the template functions as expected in creating new person entries, 
the link generated points to the ID of the `20230501233516-persons.org` 
file rather than the newly created person entry. How can I adjust my 
template so that it correctly links to the new person's entry instead of 
the ID of the `20230501233516-persons.org` file?

Here is my template:
```
   (setq org-roam-capture-templates
         '(("p" "person" entry
            "** %^{Name|${title}}
:PROPERTIES:
  :ID:          %(org-id-uuid)
  :AFFILIATION: %^{AFFILIATION}
  :ROLE:        %^{ROLE}
  :PROJECT:     %^{PROJECT}
  :CAPTURED:    %U
:END:\n%?"
            :target (file+olp "20230501233516-persons.org" ("Persons"))
            :unnarrowed 1
            )
           ))
```

My system:

```
system     MacOS 14.5 Darwin 23.5.0 arm64 mac
emacs      29.1 EMACSDIR=~/.config/emacs/
 
EMACS=/opt/homebrew/Cellar/emacs-mac/emacs-29.1-mac-10.0/Emacs.app/Contents/MacOS/Emacs
doom       3.0.0-pre PROFILE=_@0 HEAD -> master a99c6b90 2024-06-23 
17:15:51 -0400
            ~/.config/doom/

Org mode version 9.8 (9.8-??-39272e216
```

Thanks, Lukas

(Note: I also asked this question on 
https://emacs.stackexchange.com/questions/81591/how-to-get-the-right-link-using-org-capture-from-the-second-level)


             reply	other threads:[~2024-06-26 11:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 18:31 Lukas C. Bossert [this message]
2024-06-26 13:51 ` How to get the right link using org-capture from the second level Ihor Radchenko
2024-06-26 14:26   ` Lukas C. Bossert
2024-06-26 14:35     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35eaf49a-19a3-494c-a5df-0fefc4201d41@lukascbossert.de \
    --to=mail@lukascbossert.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).