mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 19:07:52 +00:00
babel: replace org-babel-*-read-string functions with single version.
* lisp/ob-core.el (org-babel-strip-quotes): New function. * lisp/ob-haskell.el (org-babel-haskell-read-string): Remove. (org-babel-execute:haskell): Use new function. * lisp/ob-octave.el (org-babel-octave-read-string): Remove. (org-babel-octave-evaluate-session): Use new function. * lisp/ob-ruby.el (org-babel-ruby-read-string): Remove.
This commit is contained in:
parent
38de6b6ed4
commit
890ed78c0d
|
@ -3083,6 +3083,13 @@ Callers of this function will probably want to add an entry to
|
|||
(when (and sym (boundp sym))
|
||||
(defvaralias (intern (concat "org-babel-" var ":" new)) sym)))))
|
||||
|
||||
(defun org-babel-strip-quotes (string)
|
||||
"Strip \\\"s from around a string, if applicable."
|
||||
(if (and (string-prefix-p "\"" string)
|
||||
(string-suffix-p "\"" string))
|
||||
(substring string 1 -1)
|
||||
string))
|
||||
|
||||
(provide 'ob-core)
|
||||
|
||||
;; Local variables:
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
(insert org-babel-haskell-eoe)
|
||||
(comint-send-input nil t)))
|
||||
(results (mapcar
|
||||
#'org-babel-haskell-read-string
|
||||
#'org-babel-strip-quotes
|
||||
(cdr (member org-babel-haskell-eoe
|
||||
(reverse (mapcar #'org-trim raw)))))))
|
||||
(org-babel-reassemble-table
|
||||
|
@ -89,12 +89,6 @@
|
|||
(org-babel-pick-name (cdr (assoc :rowname-names params))
|
||||
(cdr (assoc :rowname-names params))))))
|
||||
|
||||
(defun org-babel-haskell-read-string (string)
|
||||
"Strip \\\"s from around a haskell string."
|
||||
(if (string-match "^\"\\([^\000]+\\)\"$" string)
|
||||
(match-string 1 string)
|
||||
string))
|
||||
|
||||
(defun org-babel-haskell-initiate-session (&optional _session _params)
|
||||
"Initiate a haskell session.
|
||||
If there is not a current inferior-process-buffer in SESSION
|
||||
|
|
|
@ -238,11 +238,11 @@ value of the last statement in BODY, as elisp."
|
|||
(setq results
|
||||
(if matlabp
|
||||
(cdr (reverse (delq "" (mapcar
|
||||
#'org-babel-octave-read-string
|
||||
#'org-babel-strip-quotes
|
||||
(mapcar #'org-trim raw)))))
|
||||
(cdr (member org-babel-octave-eoe-output
|
||||
(reverse (mapcar
|
||||
#'org-babel-octave-read-string
|
||||
#'org-babel-strip-quotes
|
||||
(mapcar #'org-trim raw)))))))
|
||||
(mapconcat #'identity (reverse results) "\n")))))
|
||||
|
||||
|
@ -259,12 +259,6 @@ This removes initial blank and comment lines and then calls
|
|||
(delete-region beg end)))
|
||||
(org-babel-import-elisp-from-file temp-file '(16))))
|
||||
|
||||
(defun org-babel-octave-read-string (string)
|
||||
"Strip \\\"s from around octave string."
|
||||
(if (string-match "^\"\\([^\000]+\\)\"$" string)
|
||||
(match-string 1 string)
|
||||
string))
|
||||
|
||||
(provide 'ob-octave)
|
||||
|
||||
|
||||
|
|
|
@ -254,12 +254,6 @@ return the value of the last statement in BODY, as elisp."
|
|||
(comint-send-input nil t))
|
||||
(org-babel-eval-read-file tmp-file))))))
|
||||
|
||||
(defun org-babel-ruby-read-string (string)
|
||||
"Strip \\\"s from around a ruby string."
|
||||
(if (string-match "^\"\\([^\000]+\\)\"$" string)
|
||||
(match-string 1 string)
|
||||
string))
|
||||
|
||||
(provide 'ob-ruby)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue