diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2011-04-02 11:46:08 -0600 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2011-04-02 11:46:08 -0600 |
commit | 30931bfe1d297feb52305fc88bdf177a39677601 (patch) | |
tree | 218c7fd9bba3d439acffac9e4a63e294e2763603 | |
parent | cd4ce494496eb4d19a490193120e75647d60412a (diff) | |
download | org-mode-30931bfe1d297feb52305fc88bdf177a39677601.tar.gz |
edit-prep: language specific src-edit buffer preparation, with R session association
* lisp/ob-R.el (org-babel-edit-prep:R): Associate the appropriate R
process with the edit buffer when :session is specified.
* lisp/org-src.el (org-edit-src-code): Allow language-specific
edit-buffer preparation by calling the org-babel-edit-prep:lang
function when it is defined.
-rw-r--r-- | lisp/ob-R.el | 6 | ||||
-rw-r--r-- | lisp/org-src.el | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lisp/ob-R.el b/lisp/ob-R.el index b72effc..713d59f 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -51,6 +51,12 @@ (defvar org-babel-R-command "R --slave --no-save" "Name of command to use for executing R code.") +(defun org-babel-edit-prep:R (info) + (let ((session (cdr (assoc :session (nth 2 info))))) + (when (and session (string-match "^\\*\\(.+?\\)\\*$" session)) + (save-match-data (org-babel-R-initiate-session session nil)) + (setq ess-local-process-name (match-string 1 session))))) + (defun org-babel-expand-body:R (body params &optional graphics-file) "Expand BODY according to PARAMS, return the expanded body." (let ((graphics-file diff --git a/lisp/org-src.el b/lisp/org-src.el index f72579a..7d42e00 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -214,6 +214,7 @@ buffer." (let ((mark (and (org-region-active-p) (mark))) (case-fold-search t) (info (org-edit-src-find-region-and-lang)) + (full-info (org-babel-get-src-block-info)) (org-mode-p (or (org-mode-p) (derived-mode-p 'org-mode))) (beg (make-marker)) (end (make-marker)) @@ -323,7 +324,10 @@ buffer." (org-src-mode) (set-buffer-modified-p nil) (and org-edit-src-persistent-message - (org-set-local 'header-line-format msg))) + (org-set-local 'header-line-format msg)) + (let ((edit-prep-func (intern (concat "org-babel-edit-prep:" lang)))) + (when (fboundp edit-prep-func) + (funcall edit-prep-func full-info)))) t))) (defun org-edit-src-continue (e) |