The problem with my implementation is that it modifies the org file before prompting the user for item entry. As a result, if I cancel/abort my org-capture, that modification will still be present. I've made another attempt which is slightly more successful using advice.

(defun my/diary-capture-advice (oldfun r)
    (let ((org-capture-templates `(("d"
   "Diary Template"
   item
   (file+headline (lambda () (expand-file-name
      (concat org-directory "Diary" "/" (format-time-string "%Y-%m-%d.org"))))
  ,(format-time-string (org-time-stamp-format t t) (current-time)))
   "- %?"
   :empty-lines 0))))
      (call-interactively oldfun)))
(advice-add #'org-capture :around #'my/diary-capture-advice)

On Tue, Apr 30, 2024 at 8:31 AM Ihor Radchenko <yantar92@posteo.net> wrote:
Nafiz Islam <nafiz.islam1001@gmail.com> writes:

>> Upon closer look at the `org-capture`, `org-capture-set-target-location`
> and `org-capture-place-entry`, I'm starting to realize that "file+function"
> can be used for what I'm looking for. I was just worried about the use of
> `(org-capture-put :exact-position (point))`
>
> My disappointing attempt at using file+function target to replicate my idea

What is the problem with it?

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>