org-roam / org-roam

Rudimentary Roam replica with Org-mode
https://www.orgroam.com
GNU General Public License v3.0
5.38k stars 470 forks source link

`org-roam-dailies-capture` make OLP incorrectly when captured again #2335

Open hwiorn opened 1 year ago

hwiorn commented 1 year ago

Description

When I make capture task by code, org-roam generates OLP heading again sometimes.

Steps to Reproduce

Run this code and check org/roam/daily/test.org Then run the code again.

(let ((org-roam-directory (expand-file-name org-roam-dailies-directory org-roam-directory))
      (org-roam-dailies-directory "./")
      (org-roam-dailies-capture-templates
       `(("t" "Tasks" entry "* %?"
          :if-new (file+head+olp "test.org" ;; "%<%Y-%m-%d>.org"
                                 "* Notes\n\n* Tasks\n\n* Journal"
                                 ("Tasks" "[2023-03-28 Tue]"))))))
  (save-window-excursion
    (org-roam-dailies--capture (current-time) t)))

Backtrace

There is no error for this.

Expected Results

* Notes

* Tasks

** [2023-03-28 Tue]

* Journal

Actual Results

'("Tasks" "[2023-03-28 Tue]") OLP is generated again.

* Notes

* Tasks

** [2023-03-28 Tue]

* Journal

* Tasks

** [2023-03-28 Tue]

Environment

- Emacs: GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2023-03-20
- Framework: Doom
- Org: Org mode version 9.6.1 (9.6.1-??-fe92a3c @ /home/gglee/.config/emacs/.local/straight/build-30.0.50/org/)
- Org-roam: 5c06471-dirty
- sqlite-connector: sqlite-builtin
hwiorn commented 1 year ago

This issue is caused from (org-roam-capture-find-or-create-olp OLP).

hwiorn commented 1 year ago

I've met this issue in the below hacks.

https://systemcrafters.net/build-a-second-brain-in-emacs/5-org-roam-hacks/#automatically-copy-or-move-completed-tasks-to-dailies