Closed jpretori closed 2 years ago
I'm unable to reproduce the issue with the example you've given me. For me, evaluating the following:
(doct '("Journal Entries"
:type entry
:keys "j"
:file "~/Dropbox/org/journal.org"
:datetree t
:children
(("General Journal Entry"
:keys "j"
:template "* %? \nENTERED: %U \n\n ")
("Retrospective"
:keys "r"
:template-file "~/Dropbox/org/templates/retro_journal_entry.org"))))
returns:
(("j" "Journal Entries")
("jj" "General Journal Entry" entry
(file+olp+datetree "~/Dropbox/org/journal.org")
"* %? \nENTERED: %U \n\n " :doct
(:doct-name "General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t))
("jr" "Retrospective" entry
(file+olp+datetree "~/Dropbox/org/journal.org")
#'doct--fill-template :doct
(:doct-name "Retrospective" :keys "r" :template-file "~/Dropbox/org/templates/retro_journal_entry.org" :type entry :inherited-keys "jr" :file "~/Dropbox/org/journal.org" :datetree t)))
In the backtrace you've provided, I see the following line:
apply(doct--convert ("General Journal Entry" :keys "j" :datetree "t" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org"))
Which has :datetree bound to the string "t". This indicates that the example you've provided (which has :datetree set correctly to the symbol t
) may be different from the declarations which are causing the error. There was a recent change to doct--target-file
which may be the source of this bug, but I'd need a reliable way to reproduce it to be sure. Can you provide the declarations which are causing the issue unaltered (or a minimal set which reliable reproduces the issue) please?
I tried out the declaration you provided, and got another debug window. Here is the backtrace. In case it is relevant, I am using Emacs v27.2 (recently built from source).
Doct info acording to package-list-packages
Status: Installed in ‘doct-20220220.456/’ (unsigned). Delete
Version: 20220220.456
Commit: 1e3c1962558d6545e453583793e1d48417d4ef14
Backtrace I get when I run your doct
declaration
Debugger entered--Lisp error: (void-variable datetree)
#f(compiled-function (type target path) #<bytecode 0x15773f61b045>)((nil) (nil) nil)
doct--target-file("~/Dropbox/org/journal.org")
doct--target()
doct--compose-entry("jj" "General Journal Entry" nil)
doct--convert("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t)
apply(doct--convert ("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t))
#f(compiled-function (child) #<bytecode 0x15773fe9cfb5>)(("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t))
mapcar(#f(compiled-function (child) #<bytecode 0x15773fe9cfb5>) (("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t) ("Retrospective" :keys "r" :template-file "~/Dropbox/org/templates/retro_journal_entry.org")))
doct--convert("Journal Entries" :type entry :keys "j" :file "~/Dropbox/org/journal.org" :datetree t :children (("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t) ("Retrospective" :keys "r" :template-file "~/Dropbox/org/templates/retro_journal_entry.org")))
apply(doct--convert ("Journal Entries" :type entry :keys "j" :file "~/Dropbox/org/journal.org" :datetree t :children (("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t) ("Retrospective" :keys "r" :template-file "~/Dropbox/org/templates/retro_journal_entry.org"))))
doct--convert-declaration-maybe(("Journal Entries" :type entry :keys "j" :file "~/Dropbox/org/journal.org" :datetree t :children (("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t) ("Retrospective" :keys "r" :template-file "~/Dropbox/org/templates/retro_journal_entry.org"))))
mapcar(doct--convert-declaration-maybe (("Journal Entries" :type entry :keys "j" :file "~/Dropbox/org/journal.org" :datetree t :children (("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n " :type entry :inherited-keys "jj" :file "~/Dropbox/org/journal.org" :datetree t) ("Retrospective" :keys "r" :template-file "~/Dropbox/org/templates/retro_journal_entry.org")))))
doct(("Journal Entries" :type entry :keys "j" :file "~/Dropbox/org/journal.org" :datetree t :children (("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n ") ("Retrospective" :keys "r" :template-file "~/Dropbox/org/templates/retro_journal_entry.org"))))
eval((doct '("Journal Entries" :type entry :keys "j" :file "~/Dropbox/org/journal.org" :datetree t :children (("General Journal Entry" :keys "j" :template "* %? \nENTERED: %U \n\n ") ("Retrospective" :keys "r" :template-file "~/Dropbox/org/templates/retro_journal_entry.org")))) nil)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
Finally, here is the unaltered declarations from my .emacs file.
(setq org-capture-templates
(doct '(
(:group "mygtd.org entries"
:type entry
:file "~/Dropbox/org/mygtd.org"
:children
(("Incoming Not-Yet-Clarified Thing"
:keys "t"
:headline "Inbox"
:template "* THING %? %u \n\n ")
("Action"
:keys "a"
:template "* TODO %? %u \n\n "
:children
(("Work Related"
:keys "w"
:headline "Work")
("Errand to run"
:keys "e"
:headline "Errands")
("Personal"
:keys "p"
:headline "Personal")
("At Polymorph Office"
:keys "o"
:headline "At Office")
("Reading"
:keys "r"
:headline "Reading")
("Factorio Related"
:keys "f"
:headline "Factorio")))
("Project"
:keys "p"
:template "* PROJECT %u %? \n\n "
:headline "Projects")
("Waiting For"
:keys "w"
:template "* WAITING %? %u \n\n "
:headline "Waiting For")))
("Journal Entries"
:type entry
:keys "j"
:file "~/Dropbox/org/journal.org"
:datetree t
:children
(("General Journal Entry"
:keys "j"
:template "* %? \nENTERED: %U \n\n ")
("Retrospective"
:keys "r"
:template-file "~/Dropbox/org/templates/retro_journal_entry.org")
))
)))
Emacs v27.2
The pcase pattern for the latest patch must not work for your Emacs version. I've used a different pattern which should work now (both the "master" and "development" branches have the patch applied). Testing is appreciated.
Testing is appreciated.
And gladly supplied!
I loaded the new doct package, and it seems to work now.
Thank you!
Hello! Thanks for making doct, looks like it is going to make my capture templates a lot easier to read and maintain.
I've run into a problem that I seem unable to solve by careful reading of the README. Maybe you could just point out where I need to read more carefully?
I am struggling with datetrees. Based on reading the docs, I expected the following config:
to produce something along these lines:
Instead, I get a debugger buffer starting with the below. Everything else seems to work fine, and this is the first time I'm trying to use
:datetree
. Am I doing it wrong?