comparison lisp/org/ob-ruby.el @ 111880:a7740098b594

Update to Org mode 7.4
author Carsten Dominik <carsten.dominik@gmail.com>
date Sat, 11 Dec 2010 17:42:53 +0100
parents 76c2ff4450eb
children 6378d1b57038
comparison
equal deleted inserted replaced
111879:4a0faa1cecc2 111880:a7740098b594
1 ;;; ob-ruby.el --- org-babel functions for ruby evaluation 1 ;;; ob-ruby.el --- org-babel functions for ruby evaluation
2 2
3 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. 3 ;; Copyright (C) 2009, 2010 Free Software Foundation
4 4
5 ;; Author: Eric Schulte 5 ;; Author: Eric Schulte
6 ;; Keywords: literate programming, reproducible research 6 ;; Keywords: literate programming, reproducible research
7 ;; Homepage: http://orgmode.org 7 ;; Homepage: http://orgmode.org
8 ;; Version: 7.3 8 ;; Version: 7.4
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software: you can redistribute it and/or modify 12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by 13 ;; it under the terms of the GNU General Public License as published by
27 ;; Org-Babel support for evaluating ruby source code. 27 ;; Org-Babel support for evaluating ruby source code.
28 28
29 ;;; Requirements: 29 ;;; Requirements:
30 30
31 ;; - ruby and irb executables :: http://www.ruby-lang.org/ 31 ;; - ruby and irb executables :: http://www.ruby-lang.org/
32 ;; 32 ;;
33 ;; - ruby-mode :: Can be installed through ELPA, or from 33 ;; - ruby-mode :: Can be installed through ELPA, or from
34 ;; http://github.com/eschulte/rinari/raw/master/util/ruby-mode.el 34 ;; http://github.com/eschulte/rinari/raw/master/util/ruby-mode.el
35 ;; 35 ;;
36 ;; - inf-ruby mode :: Can be installed through ELPA, or from 36 ;; - inf-ruby mode :: Can be installed through ELPA, or from
37 ;; http://github.com/eschulte/rinari/raw/master/util/inf-ruby.el 37 ;; http://github.com/eschulte/rinari/raw/master/util/inf-ruby.el
38 38
39 ;;; Code: 39 ;;; Code:
40 (require 'ob) 40 (require 'ob)
114 114
115 (defun org-babel-ruby-table-or-string (results) 115 (defun org-babel-ruby-table-or-string (results)
116 "Convert RESULTS into an appropriate elisp value. 116 "Convert RESULTS into an appropriate elisp value.
117 If RESULTS look like a table, then convert them into an 117 If RESULTS look like a table, then convert them into an
118 Emacs-lisp table, otherwise return the results as a string." 118 Emacs-lisp table, otherwise return the results as a string."
119 (org-babel-read 119 (org-babel-script-escape results))
120 (if (and (stringp results) (string-match "^\\[.+\\]$" results))
121 (org-babel-read
122 (concat "'"
123 (replace-regexp-in-string
124 "\\[" "(" (replace-regexp-in-string
125 "\\]" ")" (replace-regexp-in-string
126 ", " " " (replace-regexp-in-string
127 "'" "\"" results))))))
128 results)))
129 120
130 (defun org-babel-ruby-initiate-session (&optional session params) 121 (defun org-babel-ruby-initiate-session (&optional session params)
131 "Initiate a ruby session. 122 "Initiate a ruby session.
132 If there is not a current inferior-process-buffer in SESSION 123 If there is not a current inferior-process-buffer in SESSION
133 then create one. Return the initialized session." 124 then create one. Return the initialized session."