all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] org-capture: Add a custom to control save target file or not.
@ 2018-04-12  1:20 tumashu
  2018-04-12 13:22 ` Nicolas Goaziou
  0 siblings, 1 reply; 24+ messages in thread
From: tumashu @ 2018-04-12  1:20 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 317 bytes --]

I use org-capture to capture text to a file of my mobile phone
with the help of tramp and termux's sshd, the save buffer is very
slow, so I want to org-capture-finalize just update buffer, and
I save buffer manually when need.


By the way, can we contribute org-mode with the help of PR feature in code.orgmode.org?

[-- Attachment #1.2: Type: text/html, Size: 427 bytes --]

[-- Attachment #2: 0001-org-capture-Add-a-custom-to-control-save-target-file.patch --]
[-- Type: application/octet-stream, Size: 1701 bytes --]

From ff25c3327914069f1dc3be6337c8ceb2d0e4f791 Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Thu, 12 Apr 2018 09:04:13 +0800
Subject: [PATCH] org-capture: Add a custom to control save target file or not.

* lisp/org-capture.el (org-capture-finalize-save-buffer): New variable.
(org-capture-finalize): Use org-capture-finalize-save-buffer.

I use org-capture to capture text to a file of my mobile phone
with the help of tramp and termux's sshd, the save buffer is very
slow, so I want to org-capture-finalize just update buffer, and
I save buffer manually when need.
---
 lisp/org-capture.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index f59e2ce6a..e2234e816 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -438,6 +438,12 @@ The capture buffer is current and still narrowed."
   :version "24.1"
   :type 'hook)
 
+(defcustom org-capture-finalize-save-buffer t
+  "When nil, org-capture-finalize will not save target file's buffer."
+  :group 'org-capture
+  :version "24.1"
+  :type 'boolean)
+
 (defcustom org-capture-bookmark t
   "When non-nil, add a bookmark pointing at the last stored
 position when capturing."
@@ -791,7 +797,10 @@ captured item after finalizing."
 	(org-encrypt-entry)))
 
     ;; Kill the indirect buffer
-    (save-buffer)
+    (if org-capture-finalize-save-buffer
+	(save-buffer)
+      (message "The capture target file is not auto saved, please save it manually."))
+
     (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))
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2018-12-13 19:12 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-12  1:20 [PATCH] org-capture: Add a custom to control save target file or not tumashu
2018-04-12 13:22 ` Nicolas Goaziou
2018-04-13  2:10   ` tumashu
2018-04-14  7:44     ` Nicolas Goaziou
2018-04-14  9:42       ` tumashu
2018-04-16  1:06         ` tumashu
2018-04-16 10:11           ` Nicolas Goaziou
2018-09-26 17:11         ` Kaushal Modi
2018-09-26 17:29           ` Kaushal Modi
2018-09-26 18:11             ` Kaushal Modi
2018-09-27  5:47           ` Eric S Fraga
2018-09-27 13:33             ` Kaushal Modi
2018-09-28 12:28               ` Kaushal Modi
2018-09-28 20:50                 ` Nicolas Goaziou
2018-09-28 21:17                   ` Kaushal Modi
2018-09-29  6:31                     ` Nicolas Goaziou
2018-09-29 10:27                       ` Eric S Fraga
2018-09-29 10:35                         ` Van L
2018-12-13 15:08                           ` Kaushal Modi
2018-12-13 15:24                             ` Kaushal Modi
2018-12-13 15:33                               ` Kaushal Modi
2018-12-13 16:25                               ` Nicolas Goaziou
2018-12-13 19:12                                 ` Kaushal Modi
2018-04-26 23:34   ` Bastien

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.