From 9592b6f1bd0811fd1d7478755e5a44457ab9fc14 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 14 Oct 2009 18:43:25 -0400 Subject: [PATCH] New variable org-src-ask-before-returning-to-edit-buffer If an active edit buffer exists for a source block, and this variable is non-nil, then org-edit-src-code will not ask before returning to the edit buffer, and future saves will overwrite the source block's contents. --- lisp/org-src.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/org-src.el b/lisp/org-src.el index 03e5b4580..685a311ff 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -148,6 +148,12 @@ For example, there is no ocaml-mode in Emacs, but the mode to use is (defvar org-edit-src-overlay nil) (defvar org-edit-src-block-indentation nil) +(defvar org-src-ask-before-returning-to-edit-buffer t + "If nil, when org-edit-src code is used on a block that already + has an active edit buffer, it will switch to that edit buffer + immediately; otherwise it will ask whether you want to return + to the existing edit buffer.") + (define-minor-mode org-src-mode "Minor mode for language major mode buffers generated by org. This minor mode is turned on in two situations: @@ -191,6 +197,7 @@ the edited version." (error "No such language mode: %s" lang-f)) (org-goto-line line) (if (and (setq buffer (org-edit-src-find-buffer beg end)) + org-src-ask-before-returning-to-edit-buffer (y-or-n-p "Return to existing edit buffer? [n] will revert changes: ")) (switch-to-buffer buffer) (when buffer -- 2.11.4.GIT