summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Davison <davison@stats.ox.ac.uk>2010-08-17 17:01:37 -0400
committerDan Davison <davison@stats.ox.ac.uk>2010-08-17 17:32:23 -0400
commitb05f8c91fed5d743adf5df787f2b28fb58274bf5 (patch)
tree1b67575691d57b0fa81bc6a9ff6d472f494e5f5d
parentcbe5089e0f7389995b7c9d39113fa51f1bcbc3ab (diff)
downloadorg-mode-b05f8c91fed5d743adf5df787f2b28fb58274bf5.tar.gz
babel: new function `org-babel-switch-to-session-with-code'
* ob.el (org-babel-switch-to-session-with-code): new function to generate split frame displaying edit buffer and session. * ob-keys.el (org-babel-key-bindings): binding for `org-babel-switch-to-session-with-code'
-rw-r--r--lisp/ob-keys.el2
-rw-r--r--lisp/ob.el17
2 files changed, 18 insertions, 1 deletions
diff --git a/lisp/ob-keys.el b/lisp/ob-keys.el
index e9ba3d9..d405e02 100644
--- a/lisp/ob-keys.el
+++ b/lisp/ob-keys.el
@@ -74,7 +74,7 @@ functions which are assigned key bindings, and see
("\C-i" . org-babel-lob-ingest)
("i" . org-babel-lob-ingest)
("\C-z" . org-babel-switch-to-session)
- ("z" . org-babel-switch-to-session)
+ ("z" . org-babel-switch-to-session-with-code)
("\C-a" . org-babel-sha1-hash)
("a" . org-babel-sha1-hash)
("h" . org-babel-describe-bindings))
diff --git a/lisp/ob.el b/lisp/ob.el
index b5b9d8f..1375e02 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -465,6 +465,23 @@ of the source block to the kill ring."
(defalias 'org-babel-pop-to-session 'org-babel-switch-to-session)
+;;;###autoload
+(defun org-babel-switch-to-session-with-code (&optional arg info)
+ "Switch to code buffer and display session."
+ (interactive "P")
+ (flet ((swap-windows
+ ()
+ (let ((other-window-buffer (window-buffer (next-window))))
+ (set-window-buffer (next-window) (current-buffer))
+ (set-window-buffer (selected-window) other-window-buffer))
+ (other-window 1)))
+ (let ((info (org-babel-get-src-block-info))
+ (org-src-window-setup 'reorganize-frame))
+ (save-excursion
+ (org-babel-switch-to-session arg info))
+ (org-edit-src-code))
+ (swap-windows)))
+
(defvar org-bracket-link-regexp)
;;;###autoload
(defun org-babel-open-src-block-result (&optional re-run)