I would like to use org-protocol to capture to an existing org file if one already exists. I am using a function to generate the file name interactively for the org file to be captured to:
(defun my/generate-org-note-name ()
(setq my-org-note--name (read-string "Name: "))
(setq my-org-note--time (format-time-string "%Y%m%d%H%M%S"))
(expand-file-name (format "%s-%s.org" my-org-note--time my-org-note--name) (concat org-directory "links/")))
So is there a way to make Emacs search for some property like "URL" in my org directory and if it finds one, it appends the capture to it otherwise if it doesn't exist it creates a new file? As it stands now, if I use the org-capture-extension, it runs the function to ask me for a file name and creates a new file.
My relevant capture templates are as follows:
("p" "Protocol" plain (file my/generate-org-note-name)
"#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
("L" "Protocol Link" plain (file my/generate-org-note-name)
"%(format \"#+title: %s\n#+date: %U\n\" my-org-note--name my-org-note--time)#+author: %^{Author}\n#+filetags: :Web_Link:%^{Tags}\nLink: [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n\n* %?\n")
Edit
I realise that org-roam-protocol exists. Since I use org-roam I'm also open to any suggestions that use org-roam as well
org-protocol
? This seems to concernorg-capture
only.