One way is to write a custom function and use it as target: (function function-finding-location)
. But this would get complicated.
Another way is to use a variable as file and then use a wrapper around org-capture
to set that variable to the desired file first:
(defvar my-org-capture-filename nil
"File name for org capture template.")
(setq org-capture-templates
'(("j" "journal" entry (file+olp+datetree my-org-capture-filename)
"* %?
Entered on %U
%i
%a")))
(defun my-org-capture ()
"Read file name to capture to."
(interactive)
(setq my-org-capture-filename
(read-file-name "Capture to: " "~/Documents/write/notes/journal"
nil t "inbox.org"))
(call-interactively #'org-capture))
Then use M-x my-org-capture
You could create a template for each file and use ji
, jp
etc. as key to capture. To make the group work add ("j" "journal")
in the template:
(setq org-capture-templates
'(("j" "journal")
("ji" "inbox.org" entry
(file+olp+datetree "~/Documents/write/notes/journal/inbox.org")
"* %?
Entered on %U
%i
%a")
("jp" "pc.org" entry
(file+olp+datetree "~/Documents/write/notes/journal/pc.org")
"* %?
Entered on %U
%i
%a")))