From 7adeca638eff962770874078822e2a3d23430b2b Mon Sep 17 00:00:00 2001 From: Matt Price Date: Fri, 23 Nov 2018 09:16:40 -0500 Subject: [PATCH] Make restoration of window config optional on exit from src buffer * org-srce.el (org-src-restore-window-config, org-exit-from-src): New variable org-src-rewtore-window-config allows user to opt out of restoring windor config when exiting from source buffer with org-exit-from-src. --- lisp/org-src.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 12163156f..386bad413 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -166,6 +166,14 @@ other-frame Use `switch-to-buffer-other-frame' to display edit buffer. (const other-window) (const reorganize-frame))) +(defcustom org-src-restore-saved-window-config t + "Whether to restore windows to previous configuration. +When non-nil (default), on exit from a source buffer, org will +try to restore the window configuration that was active when +the source buffer was created." + :group 'org-edit-structure + :type 'boolean) + (defvar org-src-mode-hook nil "Hook run after Org switched a source code snippet to its Emacs mode. \\ @@ -1173,8 +1181,8 @@ Throw an error if there is no such buffer." ;; Clean up left-over markers and restore window configuration. (set-marker beg nil) (set-marker end nil) - (when org-src--saved-temp-window-config - (set-window-configuration org-src--saved-temp-window-config) + (when (and org-src--saved-temp-window-config org-src-restore-saved-window-config) + (set-window-configuration org-src--saved-temp-window-config) (setq org-src--saved-temp-window-config nil)))) -- 2.19.1