From 54123cd7f20227d9679130bee907ede9e42e73fd Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Thu, 13 Dec 2018 10:11:25 -0500 Subject: [PATCH 1/2] Revert "org-capture: Do not save buffer when running `org-capture-finalize'" This reverts commit b4422add3745c26ec3b2e11b8da425844b2e9d3d. Revert the regression in Org capture + auto-saving behavior. Ref: https://lists.gnu.org/r/emacs-orgmode/2018-09/msg00325.html --- lisp/org-capture.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 2946b6fc5..a463e29fa 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -796,6 +796,7 @@ captured item after finalizing." (org-encrypt-entry))) ;; Kill the indirect buffer + (save-buffer) (let ((return-wconf (org-capture-get :return-to-wconf 'local)) (new-buffer (org-capture-get :new-buffer 'local)) (kill-buffer (org-capture-get :kill-buffer 'local)) From a60a0edc6fddb0e66077a602b241eb3d023266b2 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Thu, 13 Dec 2018 10:18:18 -0500 Subject: [PATCH 2/2] Add :no-save keyword for Org capture templates * lisp/org-capture.el (org-capture-finalize): Do not save the target capture file if :no-save keyword is non-nil in the capture template. * doc/org-manual.org (Template elements), lisp/org-capture.el (org-capture-templates): Document :no-save. Ref: https://lists.gnu.org/r/emacs-orgmode/2018-09/msg00325.html --- doc/org-manual.org | 4 ++++ lisp/org-capture.el | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 051ffaa4d..b301d0a6a 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -7352,6 +7352,10 @@ Now lets look at the elements of a template definition. Each entry in If the target file was not yet visited when capture was invoked, kill the buffer again after capture is completed. + - ~:no-save~ :: + + Do not save the target file after finishing the capture. + **** Template expansion :PROPERTIES: :DESCRIPTION: Filling in information about time and context. diff --git a/lisp/org-capture.el b/lisp/org-capture.el index a463e29fa..22e28f02e 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -266,6 +266,8 @@ properties are: capture was invoked, kill the buffer again after capture is finalized. + :no-save Do not save the target file after finishing the capture. + The template defines the text to be inserted. Often this is an Org mode entry (so the first line should start with a star) that will be filed as a child of the target headline. It can also be @@ -795,8 +797,8 @@ captured item after finalizing." (goto-char (org-capture-get :decrypted)) (org-encrypt-entry))) - ;; Kill the indirect buffer - (save-buffer) + (unless (org-capture-get :no-save) (save-buffer)) + (let ((return-wconf (org-capture-get :return-to-wconf 'local)) (new-buffer (org-capture-get :new-buffer 'local)) (kill-buffer (org-capture-get :kill-buffer 'local))