Browse Source

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.
Dan Davison 11 years ago
parent
commit
9592b6f1bd
1 changed files with 7 additions and 0 deletions
  1. 7 0
      lisp/org-src.el

+ 7 - 0
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