Closed prashantnag93 closed 3 years ago
You haven't given enough context for me to help you. Please show the value of org-capture-templates
and all code which is being used to set them. Be specific about what you expected to happen and what is actually happening.
This is my config:
(setq org-capture-templates
(doct `(("Personal todo" :keys "t"
:icon ("checklist" :set "octicon" :color "green")
:file +org-capture-todo-file
:prepend t
:headline "Inbox"
:type entry
:template ("* TODO %?"
"%i %a")
)
("Personal note" :keys "n"
:icon ("sticky-note-o" :set "faicon" :color "green")
:file +org-capture-todo-file
:prepend t
:headline "Inbox"
:type entry
:template ("* %?"
"%i %a"))
("Email" :keys "e"
:icon ("envelope" :set "faicon" :color "blue")
:file +org-capture-todo-file
:prepend t
:headline "Inbox"
:type entry
:template ("* TODO %^{type|reply to|contact} %\\3 %? :email:"
"Send an email %^{urgancy|soon|ASAP|anon|at some point|eventually} to %^{recipiant}"
"about %^{topic}"
"%U %i %a"))
("Interesting" :keys "i"
:icon ("eye" :set "faicon" :color "lcyan")
:file +org-capture-todo-file
:prepend t
:headline "Interesting"
:type entry
:template ("* [ ] %{desc}%? :%{i-type}:"
"%i %a")
:children (("Webpage" :keys "w"
:icon ("globe" :set "faicon" :color "green")
:desc "%(org-cliplink-capture) "
:i-type "read:web"
)
("Article" :keys "a"
:icon ("file-text" :set "octicon" :color "yellow")
:desc ""
:i-type "read:reaserch"
)
("Information" :keys "i"
:icon ("info-circle" :set "faicon" :color "blue")
:desc ""
:i-type "read:info"
)
("Idea" :keys "I"
:icon ("bubble_chart" :set "material" :color "silver")
:desc ""
:i-type "idea"
)))
("Tasks" :keys "k"
:icon ("inbox" :set "octicon" :color "yellow")
:file +org-capture-todo-file
:prepend t
:headline "Tasks"
:type entry
:template ("* TODO %? %^G%{extra}"
"%i %a")
:children (("General Task" :keys "k"
:icon ("inbox" :set "octicon" :color "yellow")
:extra ""
)
("Task with deadline" :keys "d"
:icon ("timer" :set "material" :color "orange" :v-adjust -0.1)
:extra "\nDEADLINE: %^{Deadline:}t"
)
("Scheduled Task" :keys "s"
:icon ("calendar" :set "octicon" :color "orange")
:extra "\nSCHEDULED: %^{Start time:}t"
)
))
("Project" :keys "p"
:icon ("repo" :set "octicon" :color "silver")
:prepend t
:type entry
:headline "Inbox"
:template ("* %{time-or-todo} %?"
"%i"
"%a")
:custom (:time-or-todo "")
:children (("Project-local todo" :keys "t"
:icon ("checklist" :set "octicon" :color "green")
:time-or-todo "TODO"
:function +org-capture-project-todo-file)
("Project-local note" :keys "n"
:icon ("sticky-note" :set "faicon" :color "yellow")
:time-or-todo "%U"
:file +org-capture-project-notes-file)
("Project-local changelog" :keys "c"
:icon ("list" :set "faicon" :color "blue")
:time-or-todo "%U"
:heading "Unreleased"
:file +org-capture-project-changelog-file))
)
("\tCentralised project templates"
:keys "o"
:type entry
:prepend t
:template ("* %{time-or-todo} %?"
"%i"
"%a")
:children (("Project todo"
:keys "t"
:prepend nil
:time-or-todo "TODO"
:heading "Tasks"
:file +org-capture-central-project-todo-file)
("Project note"
:keys "n"
:time-or-todo "%U"
:heading "Notes"
:file +org-capture-central-project-notes-file)
("Project changelog"
:keys "c"
:time-or-todo "%U"
:heading "Unreleased"
:file +org-capture-central-project-changelog-file))
)))))
Expected Behaviour: After invoking org-capture from inside a project then select the Project parent with the key p
-->
If I select t
(Project todo) then It should capture the notes with the following template
:template ("* %{time-or-todo} %?"
"%i"
"%a")
but it is not using the above templates. instead, it just inserting the heading. Screenshot is attached .
I think I understand the issue.
You've declared a :custom
plist on the parent declaration which is overriding the property on the children because they are not declared as :custom
.
Here's a minimal reproduction case which illustrates this:
YODEL REPORT (2021-09-23 12:13:17):
(yodel
:user-dir "doct-test.yodel"
:formatter yodel-format-as-github-markdown
:packages*
(doct
:ref "origin/master")
:post*
(yodel-file "./test.org"
:overwrite t
:save t
:with*
"")
(setq org-directory default-directory org-capture-templates
(doct
'(("Parent"
:keys "p"
:file "test.org"
:immediate-finish t
:template
("* %{property}")
:custom
(:property "PARENT")
:children
(("A"
:keys "a"
:custom
(:property "Explicit"))
("B"
:keys "b"
:property "Implicit")
("C"
:keys "c"))))))
(org-capture nil "pa")
(org-capture nil "pb")
(org-capture nil "pc")
(princ
(with-current-buffer
(find-file "test.org")
(buffer-substring-no-properties
(point-min)
(point-max)))))
Here the implicitly declared :property
is ignored when filling template B
.
I've pushed a patch to the "development" branch which should correct this. Tested with the following:
YODEL REPORT (2021-09-23 12:27:53):
(yodel
:user-dir "doct-test.yodel"
:formatter yodel-format-as-github-markdown
:packages*
(doct
:branch "development")
:post*
(yodel-file "./test.org"
:overwrite t
:save t
:with*
"")
(setq org-directory default-directory org-capture-templates
(doct
'(("Parent"
:keys "p"
:file "test.org"
:immediate-finish t
:template
("* %{property}")
:custom
(:property "PARENT")
:children
(("A"
:keys "a"
:custom
(:property "Explicit"))
("B"
:keys "b"
:property "Implicit")
("C"
:keys "c"))))))
(org-capture nil "pa")
(org-capture nil "pb")
(org-capture nil "pc")
(princ
(with-current-buffer
(find-file "test.org")
(buffer-substring-no-properties
(point-min)
(point-max)))))
Here, child B
's implicit :property
is filled in correctly in the template.
Would you mind testing the development branch to see if this fixes your issue?
As a side note, the :custom
keyword isn't necessary in your declaration because time-or-todo
is not a member of doct-recognized-keywords
.
It will automatically be considered custom. I've fixed it so that it will work the way you're using it, but really it's only necessary when you want to use a keyword which is already a member of doct-recognized-keywords
.
See the example using :keys
here:
Thank you @progfolio for quickly fixing the issue. Now the template-related issue is solved. but :function +org-capture-project-todo-file)
is not able to find the right file. All the project-local-todo
are going in the file opened in the current buffer.
You're welcome. It's a little hard for me to diagnose what's wrong with that function considering you haven't provided the definition of that function.
@progfolio I am using doom-emacs and org-capture template I have taken from @tecosaur config. I hope he will be able to provide the definition of that function.
OK. I see you've opened an issue on his repo. I don't think this has anything more to do with doct, so I'm going to close this issue. If you find any more information that points to it being a bug in doct, just comment here and I will reopen this issue.
Part of my org-capture-template config is as follows:
This code is not using the specified templates. when I used "Project-local todo" it gives me this template: when I used "Project-local changelog" it gives me this template: when I used "Project-local note" it gives me this template: