From: Julien Barnier <julien@no-log.org>
To: emacs-orgmode@gnu.org
Subject: [PATCH] [babel] Add option to display process buffer when editing R source code blocks
Date: Wed, 07 Apr 2010 16:41:55 +0200 [thread overview]
Message-ID: <87sk77tjd8.fsf@z.nozav.org> (raw)
Hi,
This is a small patch to org-babel-R.el which allows to automatically
display the R process buffer when editing R source code blocks with
org-edit-src-code.
A custom variable allows to choose between no process buffer
(default), only the source code block and the process buffer, or the
org file, the source code block and the process buffer.
As I'm quite new to git, I hope my patch is usable, because I
generated it from a org-babel-R.el file which already had some
modifications from master.
Sincerely,
--
Julien
---
contrib/babel/lisp/langs/org-babel-R.el | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/contrib/babel/lisp/langs/org-babel-R.el b/contrib/babel/lisp/langs/org-babel-R.el
index 8b333cc..3924089 100644
--- a/contrib/babel/lisp/langs/org-babel-R.el
+++ b/contrib/babel/lisp/langs/org-babel-R.el
@@ -218,7 +218,32 @@ Currently, insert hline if column names in output have been requested."
(if column-names-p
(cons (car result) (cons 'hline (cdr result)))
result))
-
+
+
+(defcustom org-babel-R-edit-src-show-process nil
+ "Layout of windows while editing R source blocks in org files"
+ :group 'org-babel
+ :type '(choice (const :tag "No process buffer" nil)
+ (const :tag "Show source block and process buffer" "full")
+ (const :tag "Show org file, source block and process buffer" "split")))
+
+(defadvice org-edit-src-code (around org-edit-src-code-with-R-process activate)
+ "Display process buffer when eidting R source code blocks"
+ (if org-babel-R-edit-src-show-process
+ (let* ((info (org-babel-get-src-block-info))
+ (lang (first info))
+ (R-src-block (and info (string= (upcase lang) "R"))))
+ ad-do-it
+ (when R-src-block
+ (cond ((string= org-babel-R-edit-src-show-process "split")
+ (split-window-vertically)
+ (ess-switch-to-end-of-ESS)
+ (other-window -1))
+ ((string= org-babel-R-edit-src-show-process "full")
+ (delete-other-windows)
+ (ess-switch-to-end-of-ESS)
+ (other-window 1)))))
+ ad-do-it))
(provide 'org-babel-R)
;;; org-babel-R.el ends here
--
1.7.0.4
next reply other threads:[~2010-04-07 14:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-07 14:41 Julien Barnier [this message]
2010-04-08 20:02 ` [PATCH] [babel] Add option to display process buffer when editing R source code blocks Dan Davison
2010-04-13 9:46 ` Julien Barnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sk77tjd8.fsf@z.nozav.org \
--to=julien@no-log.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).