Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(only roam-ref?) capture bugs when inserting into existing file #2429

Open
evertedsphere opened this issue Apr 16, 2024 · 2 comments
Open

(only roam-ref?) capture bugs when inserting into existing file #2429

evertedsphere opened this issue Apr 16, 2024 · 2 comments

Comments

@evertedsphere
Copy link

evertedsphere commented Apr 16, 2024

Description

With a template in org-roam-capture-ref-templates that contains

  1. :target (file+head+olp .. ("h1"))—i.e. an OLP of length 1:
    the capture buffer is created, is empty, and is not opened in the foreground
  2. :target (file+head+olp .. ("h1" "h2"))—i.e. an OLP of length >1—or `:target (file+head ..)—i.e. no OLP:
  • initial creation happens correctly, with the content inserted at the right outline path if any
  • when adding to an existing ref note, content is inserted right before the first heading in the file, ignoring the OLP

The misplaced content bug is triggered even when not using the OLP target: when using e.g. #+title: ${title}\n\n* foo as the heading and ${body}\n as the template, the actual content of the buffer ends up being #+title: ${title}\n\n${body}\n* foo.

Steps to reproduce

Working template:

(setq org-roam-capture-ref-templates
        '(("r" "ref" plain "\n#+begin_quote\n${body}\n#+end_quote\n"
           :target (file+head "%<%Y%m%d%H%M%S>.org" "#+title: ${title}\n"))))

Reproducer for (1):

(setq org-roam-capture-ref-templates
        '(("r" "ref" plain "\n#+begin_quote\n${body}\n#+end_quote\n"
           :target (file+head+olp "%<%Y%m%d%H%M%S>.org" "#+title: ${title}\n" ("Quotes")))))

Reproducers for (2), mostly from memory unfortunately:

(setq org-roam-capture-ref-templates
        '(("r" "ref" plain "\n#+begin_quote\n${body}\n#+end_quote\n"
           :target (file+head+olp "%<%Y%m%d%H%M%S>.org" "#+title: ${title}\n" ("Quotes" "Test")))))

A dynamic OLP:

(setq org-roam-capture-ref-templates
        '(("r" "ref" plain "\n#+begin_quote\n${body}\n#+end_quote\n"
           :target (file+head+olp "%<%Y%m%d%H%M%S>.org" "#+title: ${title}\n" ("Quotes" "%<%Y-%m-%d %H:%M:%S>")))))

"Manual" headings:

(setq org-roam-capture-ref-templates
        '(("r" "ref" plain "\n** Test\n#+begin_quote\n${body}\n#+end_quote\n"
           :target (file+head+olp "%<%Y%m%d%H%M%S>.org" "#+title: ${title}\n* Quotes"))))
(setq org-roam-capture-ref-templates
        '(("r" "ref" plain "\n*** Test2\n#+begin_quote\n${body}\n#+end_quote\n"
           :target (file+head+olp "%<%Y%m%d%H%M%S>.org" "#+title: ${title}\n" ("Quotes" "Test")))))

Switching these to entry also did not have any effect as far as I could tell.

Environment

  • Emacs: GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw3d scroll bars)
  • Framework: Doom
  • Org: Org mode version 9.7 (9.7-??-e9c288dfa @ /home/s/.config/emacs/.local/straight/build-29.3/org/)
  • Org-roam: 8667e44
  • sqlite-connector: sqlite-builtin
@evertedsphere
Copy link
Author

(2) is likely the same bug as reported in #2199

@CD11b
Copy link

CD11b commented Apr 16, 2024

Happening to me as well after upgrading Org to 9.6.24 today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants