path: root/lisp/ob-js.el
diff options
Diffstat (limited to 'lisp/ob-js.el')
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/ob-js.el b/lisp/ob-js.el
index 9440aa9..1a20d7e 100644
--- a/lisp/ob-js.el
+++ b/lisp/ob-js.el
@@ -1,4 +1,4 @@
-;;; ob-js.el --- org-babel functions for Javascript
+;;; ob-js.el --- Babel Functions for Javascript -*- lexical-binding: t; -*-
;; Copyright (C) 2010-2016 Free Software Foundation, Inc.
@@ -39,7 +39,6 @@
;;; Code:
(require 'ob)
-(eval-when-compile (require 'cl))
(declare-function run-mozilla "ext:moz" (arg))
@@ -62,14 +61,14 @@
(defun org-babel-execute:js (body params)
"Execute a block of Javascript code with org-babel.
This function is called by `org-babel-execute-src-block'"
- (let* ((org-babel-js-cmd (or (cdr (assoc :cmd params)) org-babel-js-cmd))
- (result-type (cdr (assoc :result-type params)))
+ (let* ((org-babel-js-cmd (or (cdr (assq :cmd params)) org-babel-js-cmd))
+ (result-type (cdr (assq :result-type params)))
(full-body (org-babel-expand-body:generic
body params (org-babel-variable-assignments:js params)))
- (result (if (not (string= (cdr (assoc :session params)) "none"))
+ (result (if (not (string= (cdr (assq :session params)) "none"))
;; session evaluation
(let ((session (org-babel-prep-session:js
- (cdr (assoc :session params)) params)))
+ (cdr (assq :session params)) params)))
(nth 1
(session (format "%S" org-babel-js-eoe) t body)
@@ -89,7 +88,7 @@ This function is called by `org-babel-execute-src-block'"
(format "%s %s" org-babel-js-cmd
(org-babel-process-file-name script-file)) "")))))
- (org-babel-result-cond (cdr (assoc :result-params params))
+ (org-babel-result-cond (cdr (assq :result-params params))
result (org-babel-js-read result))))
(defun org-babel-js-read (results)
@@ -97,7 +96,9 @@ This function is called by `org-babel-execute-src-block'"
If RESULTS look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
- (if (and (stringp results) (string-match "^\\[[^\000]+\\]$" results))
+ (if (and (stringp results)
+ (string-prefix-p "[" results)
+ (string-suffix-p "]" results))
(concat "'"
@@ -134,7 +135,7 @@ specifying a variable of the same value."
(lambda (pair) (format "var %s=%s;"
(car pair) (org-babel-js-var-to-js (cdr pair))))
- (mapcar #'cdr (org-babel-get-header params :var))))
+ (org-babel--get-vars params)))
(defun org-babel-js-initiate-session (&optional session)
"If there is not a current inferior-process-buffer in SESSION