emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] org-capture: Add a custom to control save target file or


From: Kaushal Modi
Subject: Re: [O] [PATCH] org-capture: Add a custom to control save target file or not.
Date: Wed, 26 Sep 2018 14:11:40 -0400

> 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

[Prev in Thread] Current Thread [Next in Thread]