> Also that suggestion to use org-capture-after-finalize-hook does not
> work.. I am investigating to find the right way.

I got the captures to auto-save with the below work-around:

(with-eval-after-load 'org-capture
  (defvar modi/org-capture-base-buffer nil)
  (defun modi/org-capture-before-finalize ()
    (let ((base-buffer (buffer-base-buffer (current-buffer))))
      (setq modi/org-capture-base-buffer base-buffer)))
  (add-hook 'org-capture-before-finalize-hook
#'modi/org-capture-before-finalize)

  (defun modi/org-capture-save-buffer ()
    (when modi/org-capture-base-buffer
      (let ((base-buffer-already-open (bufferp modi/org-capture-base-buffer)))
        (with-current-buffer modi/org-capture-base-buffer
          (save-buffer))))
    (setq modi/org-capture-base-buffer nil)) ;Reset the buffer name cache
  (add-hook 'org-capture-after-finalize-hook #'modi/org-capture-save-buffer))

tumashu: I am wondering if it's possible to undo this commit and we
can figure out how to prevent file saving during org-capture.

Reply via email to